public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: keosung.park@samsung.com, "joe@perches.com" <joe@perches.com>,
	ALIM AKHTAR <alim.akhtar@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"cang@codeaurora.org" <cang@codeaurora.org>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
	Kiwoong Kim <kwmad.kim@samsung.com>,
	"satyat@google.com" <satyat@google.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Joao Pinto <jpinto@synopsys.com>,
	Pedro Sousa <sousa@synopsys.com>,
	Pedro Sousa <pedrom.sousa@synopsys.com>
Subject: Re: [PATCH] scsi: ufs: Refactor ufshcd_is_intr_aggr_allowed()
Date: Thu, 24 Jun 2021 14:46:02 +0300	[thread overview]
Message-ID: <abd587ed-6666-34b8-b545-8ea97bcf0515@intel.com> (raw)
In-Reply-To: <1891546521.01624533302400.JavaMail.epsvc@epcpadp3>

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 <keosung.park@samsung.com>
>>>>> ---
>>>>>  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 <jpinto@synopsys.com> 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)
>>>>>
>>>>
>>


  reply	other threads:[~2021-06-24 11:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210621085158epcms2p46170ba48174547df00b9720dbc843110@epcms2p4>
2021-06-21  8:51 ` [PATCH] scsi: ufs: Refactor ufshcd_is_intr_aggr_allowed() Keoseong Park
2021-06-21  9:29   ` Adrian Hunter
2021-06-24  6:41     ` Keoseong Park
2021-06-24  7:25       ` Adrian Hunter
2021-06-24 10:44         ` Keoseong Park
2021-06-24 11:46           ` Adrian Hunter [this message]
2021-06-25  2:38             ` Keoseong Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abd587ed-6666-34b8-b545-8ea97bcf0515@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=jejb@linux.ibm.com \
    --cc=joe@perches.com \
    --cc=jpinto@synopsys.com \
    --cc=keosung.park@samsung.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=pedrom.sousa@synopsys.com \
    --cc=satyat@google.com \
    --cc=sousa@synopsys.com \
    --cc=stanley.chu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox