From patchwork Wed Dec 14 09:50:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Simchaev X-Patchwork-Id: 13072913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86981C4332F for ; Wed, 14 Dec 2022 09:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237965AbiLNJue (ORCPT ); Wed, 14 Dec 2022 04:50:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237960AbiLNJue (ORCPT ); Wed, 14 Dec 2022 04:50:34 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DD1E5FDE; Wed, 14 Dec 2022 01:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1671011433; x=1702547433; h=from:to:cc:subject:date:message-id; bh=lNdVFhzpDK6ZRn8cspcCrkrVHGXbdDJwrbhpIaJaCdQ=; b=n6qF0oq/znFodv2R2F59uhFp1M5Y7p5gJg4SHFshhF4LhhshYHUAGWPS 8kGX1RShpYE1KRUZjOcd8aYC+WSY7ZMgBzpbNvTTlyTJPMva7eLxlfw78 Z1jeXQkwXi0wIBlc+Oqs/vnZtuedWVB4eWiXuBvySt5P9p6iC0sjaMhDQ eV2TJsOpUnWqWqiNJY/f4cBaKzQPwMpFrSa9oKRimd6RrXyCBm+3XBttE j3GR6yoUA35IlyPjXDLmKHR/JKI4nHdb3vcoIvWl2aZei5YeLoRLLvpCa AMC+taCHcORMByv3Fe03fz6J0ZxabpbgRuKcyU8DoNfzOPiYE7HIwLS7y g==; X-IronPort-AV: E=Sophos;i="5.96,244,1665417600"; d="scan'208";a="218870759" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 14 Dec 2022 17:50:32 +0800 IronPort-SDR: /I1FWXGPu9AqshsQT94/g2+hAhQ0RX77yJafqF5xnAl2+ohoXqxFOpskM7c6t8JyS7gf2IjsJZ a1ALsS18GQROmgACUTv/3qjCwPme6+gmDHUBkr2V89MrfUOJ3vqGV0MA3S7ZIHAUlRS6JqkpUE E8gxiscBUOl1jpRTOE/sW1eo4m8Z6tdsVbw2tVVT8EUJrJ07CI2bgI3LukD66EOHbFk4A07WFn iVDw3yFnzwCHfG0Pub0uMAV3BWAvfdK2dJBVUK2Ttn2EWDtVpZQ8427AfekYQzA4BEtVAum4VV y+I= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Dec 2022 01:08:54 -0800 IronPort-SDR: u8LeKzOHkfCLvuTPtI/isU3jvNZSZRjgKTAjliABEYcgBLqVFrsl/1Nt6Ff3ivgo0+4dG1yEV7 a3vPnNSmgQNKSAbSCTdo47UEPlZaMG7jVQjbkii47P5OWw1h9IqJ/QY1tmzSIJIhKjmeY28nKa W8FDo5pOCRmeNQJ2QGkVwwZB7HACrdt39P1hzGfNFPvTI+pMJCsgb1O4IeHVfe34G5WHTLUmw+ NhqsfPyR6FojWX5jYubvMVDU9NZ2mFvn3t+qW4qVk101NOYIkJgLAb2uwiNyw603YDcVlzMQwM jYM= WDCIronportException: Internal Received: from ilb001078.ad.shared (HELO ilb001078.sdcorp.global.sandisk.com) ([10.45.31.219]) by uls-op-cesaip02.wdc.com with ESMTP; 14 Dec 2022 01:50:31 -0800 From: Arthur Simchaev To: martin.petersen@oracle.com Cc: beanhuo@micron.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Arthur Simchaev Subject: [PATCH v6 0/4] ufs: core: Always read the descriptors with max length Date: Wed, 14 Dec 2022 11:50:23 +0200 Message-Id: <1671011427-26184-1-git-send-email-Arthur.Simchaev@wdc.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org v5--v6: Add Bart's "Reviewed-by" to patch 2 and 4 v4--v5: Change patch 2 according to Bart's comment v3--v4: Add "Reviewed-by" to patch's commits Use kzalloc instead of kmalloc in drivers/ufs/core/ufshcd.c - patch 2/4 v2--v3: Based on Bean's comments: 1)Use kzalloc instead of kmalloc in ufshcd_set_active_icc_lvl - patch 2/4 2)Delete UFS_RPMB_UNIT definition - patch 2/4 3)Delete len description - patch 3/4 v1--v2: Fix argument warning in ufshpb.c Read any descriptor with a maximum size of QUERY_DESC_MAX_SIZE. According to the spec the device rerurns the actual size. Thus can improve code readability and save CPU cycles. While at it, cleanup few leftovers around the descriptor size parameter. Suggested-by: Bean Huo Arthur Simchaev (4): ufs:core: Remove redundant wb check ufs:core: Remove redundant desc_size variable from hba ufs: core: Remove len parameter from ufshcd_set_active_icc_lvl ufs: core: Remove ufshcd_map_desc_id_to_length function drivers/ufs/core/ufs_bsg.c | 7 +-- drivers/ufs/core/ufshcd-priv.h | 3 -- drivers/ufs/core/ufshcd.c | 100 ++++++++++------------------------------- drivers/ufs/core/ufshpb.c | 5 +-- include/ufs/ufshcd.h | 1 - 5 files changed, 26 insertions(+), 90 deletions(-)