Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp137527pxv; Thu, 24 Jun 2021 04:46:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1ctHi8BHJYL9rndk0EmgbuxpirC+XqU4WPGTh4dThhY5z1fajI5bMz1qTbgXHi1d50b1p X-Received: by 2002:a6b:4418:: with SMTP id r24mr3701721ioa.123.1624535194176; Thu, 24 Jun 2021 04:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624535194; cv=none; d=google.com; s=arc-20160816; b=lJel7e3UsWhHUzr4kNO8AW3F3fzcIYezfbOX1MbLz99t/Cu5T+Rq/KTSJGQBGsN6f2 eaoD5sh7LEGlozQfywzMspaRCNDvcFoV/wawXTeeZwdMBNjwD0xGB7Eck8LISZKI2kEQ zJqwwOQf6cK2ozmAG/Gy2cvh4SQlMjTay/P5HBhLaYmz6PWjwtWjOgByeJuvC8DGBl7H NGWDW09XByzFl2vRnx8Y7KeazqLXACP2VRBy7bus6orDjyh64DazRvqnCjLf/yH3UOO9 efxwFhkn6haDE9VPnG3Ru54m7bhqcJCTQQdIocQX7YM+OCzK4pl8zkHdNrOn+haYcPJ3 Y2+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:to:subject:ironport-sdr:ironport-sdr; bh=b1inZ+kaG+vUE74WHhWcRcLOWBsWduDyCqNJUSedAjU=; b=TaQxzzdZxhhIxWbKVwOeBRBrxFEaBZ949SBVu06gqAwNzzZx/lP3MW7MLryHUTp0o1 mBKnAI/MH7WPsZFQP0AybyugtEsp/dsosZ8N3ALDlTTl6QkWCAZtbzmM/H61qPwajJ05 3DXUEbAExLad0YKaJHpCW7h7DiWDzAFiHqO9dV/ME0Dw+sM0Su6PCg/vMd42jJPrzQ9+ Ilw3CssV3+trK/bhgAbh0+QWi2PBGi5DHIWEJ2VW2oivWsU6J8z9QN/OoBJMdtpr2oNW lGDwIGf0Wgfd1A98gaboEoVyAA3qACNcUSTZqbqy8aMlhazfTvTNu6CTq/ke3eNxSEGL dJNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x3si2177994ion.71.2021.06.24.04.46.22; Thu, 24 Jun 2021 04:46:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbhFXLsF (ORCPT + 99 others); Thu, 24 Jun 2021 07:48:05 -0400 Received: from mga07.intel.com ([134.134.136.100]:59479 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbhFXLsE (ORCPT ); Thu, 24 Jun 2021 07:48:04 -0400 IronPort-SDR: DtRH+tJHV728X3wNWWua2nCcDwUAEh4oWKa9mTUhcxPo1WpxcpfyHRHzrXBvt8KWsyccacUd0D +GxT8dohxckA== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="271299477" X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="271299477" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2021 04:45:45 -0700 IronPort-SDR: G/x/Aj4ZfK6zrckJse1ZzlSVn5Arrtq/Y3Huf2aZZ5c3UOL8GRzgC/ju8hgpINp0HQ4cADtBjo bc6+VzipzOMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="406617865" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.79]) ([10.237.72.79]) by orsmga006.jf.intel.com with ESMTP; 24 Jun 2021 04:45:40 -0700 Subject: Re: [PATCH] scsi: ufs: Refactor ufshcd_is_intr_aggr_allowed() To: keosung.park@samsung.com, "joe@perches.com" , ALIM AKHTAR , "avri.altman@wdc.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "stanley.chu@mediatek.com" , "cang@codeaurora.org" , "beanhuo@micron.com" , "asutoshd@codeaurora.org" , Kiwoong Kim , "satyat@google.com" , "bvanassche@acm.org" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Joao Pinto , Pedro Sousa , Pedro Sousa References: <42c2978f-f0ca-3efb-7762-cac813a0a5fe@intel.com> <1891546521.01624267081897.JavaMail.epsvc@epcpadp4> <37380050.31624517282371.JavaMail.epsvc@epcpadp4> <1891546521.01624533302400.JavaMail.epsvc@epcpadp3> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Thu, 24 Jun 2021 14:46:02 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <1891546521.01624533302400.JavaMail.epsvc@epcpadp3> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/06/21 1:44 pm, Keoseong Park wrote: >> On 24/06/21 9:41 am, Keoseong Park wrote: >>>> On 21/06/21 11:51 am, Keoseong Park wrote: >>>>> Change conditional compilation to IS_ENABLED macro, >>>>> and simplify if else statement to return statement. >>>>> No functional change. >>>>> >>>>> Signed-off-by: Keoseong Park >>>>> --- >>>>> drivers/scsi/ufs/ufshcd.h | 17 ++++++++--------- >>>>> 1 file changed, 8 insertions(+), 9 deletions(-) >>>>> >>>>> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h >>>>> index c98d540ac044..6d239a855753 100644 >>>>> --- a/drivers/scsi/ufs/ufshcd.h >>>>> +++ b/drivers/scsi/ufs/ufshcd.h >>>>> @@ -893,16 +893,15 @@ static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba) >>>>> >>>>> static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba) >>>>> { >>>>> -/* DWC UFS Core has the Interrupt aggregation feature but is not detectable*/ >>>>> -#ifndef CONFIG_SCSI_UFS_DWC >>>>> - if ((hba->caps & UFSHCD_CAP_INTR_AGGR) && >>>>> - !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR)) >>>>> + /* >>>>> + * DWC UFS Core has the Interrupt aggregation feature >>>>> + * but is not detectable. >>>>> + */ >>>>> + if (IS_ENABLED(CONFIG_SCSI_UFS_DWC)) >>>> >>>> Why is this needed? It seems like you could just set UFSHCD_CAP_INTR_AGGR >>>> and clear UFSHCD_QUIRK_BROKEN_INTR_AGGR instead? >>> >>> Hello Adrian, >>> Sorry for late reply. >>> >>> The code that returns true when CONFIG_SCSI_UFS_DWC is set in the original code >>> is only changed using the IS_ENABLED macro. >>> (Linux kernel coding style, 21) Conditional Compilation) >>> >>> When CONFIG_SCSI_UFS_DWC is not defined, the code for checking quirk >>> and caps has been moved to the newly added return statement below. >> >> Looking closer I cannot find CONFIG_SCSI_UFS_DWC at all. It seems like it >> never existed. >> >> Why should we not remove the code related to CONFIG_SCSI_UFS_DWC entirely? > > You're right. What do you think of deleting the code related to CONFIG_SCSI_UFS_DWC > and changing it to the patch below? Yes, but cc Joao Pinto who introduced the code > > --- > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index c98d540ac044..c9faca237290 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -893,16 +893,8 @@ static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba) > > static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba) > { > -/* DWC UFS Core has the Interrupt aggregation feature but is not detectable*/ > -#ifndef CONFIG_SCSI_UFS_DWC > - if ((hba->caps & UFSHCD_CAP_INTR_AGGR) && > - !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR)) > - return true; > - else > - return false; > -#else > -return true; > -#endif > + return (hba->caps & UFSHCD_CAP_INTR_AGGR) && > + !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR); > } > >> >> >>> >>> Thanks, >>> Keoseong >>> >>>> >>>>> return true; >>>>> - else >>>>> - return false; >>>>> -#else >>>>> -return true; >>>>> -#endif >>>>> + >>>>> + return (hba->caps & UFSHCD_CAP_INTR_AGGR) && >>>>> + !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR); >>>>> } >>>>> >>>>> static inline bool ufshcd_can_aggressive_pc(struct ufs_hba *hba) >>>>> >>>> >>