mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Avri Altman <avri.altman@wdc.com>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Adrian Hunter <adrian.hunter@intel.com>,
	Bean Huo <beanhuo@micron.com>
Subject: Re: [PATCH 3/3] scsi: ufs-sysfs: Add sysfs entries for temperature notification
Date: Wed, 1 Sep 2021 09:52:48 -0700	[thread overview]
Message-ID: <0c547d74-481f-0c5e-9f7a-8c29218a0d3a@acm.org> (raw)
In-Reply-To: <20210901123707.5014-4-avri.altman@wdc.com>

On 9/1/21 5:37 AM, Avri Altman wrote:
> +What:		/sys/bus/platform/drivers/ufshcd/*/attributes/case_rough_temp
> +Date:		September 2021
> +Contact:	Avri Altman <avri.altman@wdc.com>
> +Description:	The device case rough temperature (bDeviceCaseRoughTemperature
> +		attribute). It is termed "rough" due to the inherent inaccuracy
> +		of the temperature sensor inside a semiconductor device,
> +		e.g. +- 10 degrees centigrade error range.

My understanding is that the word Celsius is more common than centigrade 
so please use Celsius instead of centigrade. See also 
https://www.brannan.co.uk/celsius-centigrade-and-fahrenheit/

> +		allowable range is [-79..170].
> +		The temperature readings are in decimal degrees Celsius.
> +
> +		Please note that the Tcase validity depends on the state of the
> +		wExceptionEventControl attribute: it is up to the user to
> +		verify that the applicable mask (TOO_HIGH_TEMP_EN, and / or
> +		TOO_LOW_TEMP_EN) is set for the exception handling control.
> +		This can be either done by ufs-bsg or ufs-debugfs.

Instead of making the user verify whether case_rough_temp is valid, 
please modify the kernel code such that case_rough_temp only reports a 
value if that value is valid. One possible approach is to make the show 
method return an error code if case_rough_temp is not valid. Another and 
probably better approach is to define a sysfs attribute group and to 
make case_rough_temp visible only if it is valid.

> diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
> index 5c405ff7b6ea..a9abe33c40e4 100644
> --- a/drivers/scsi/ufs/ufs-sysfs.c
> +++ b/drivers/scsi/ufs/ufs-sysfs.c
> @@ -1047,6 +1047,86 @@ static inline bool ufshcd_is_wb_attrs(enum attr_idn idn)
>   		idn <= QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE;
>   }
>   
> +static inline bool ufshcd_is_temp_attrs(enum attr_idn idn)
> +{
> +	return idn >= QUERY_ATTR_IDN_CASE_ROUGH_TEMP &&
> +	       idn <= QUERY_ATTR_IDN_LOW_TEMP_BOUND;
> +}

Modern compilers are good at deciding when to inline a function so 
please leave out the 'inline' keyword from the above function.

> +static bool ufshcd_case_temp_legal(struct ufs_hba *hba)\

Please use another word than "legal" since the primary meaning of 
"legal" is "of or relating to law".

> +	ufshcd_rpm_get_sync(hba);
> +	ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> +				QUERY_ATTR_IDN_EE_CONTROL, 0, 0, &ee_mask);
> +	ufshcd_rpm_put_sync(hba);

Are there any ufshcd_query_attr() calls that are not surrounded by 
ufshcd_rpm_{get,put}_sync()? If not, please move the 
ufshcd_rpm_{get,put}_sync() calls into ufshcd_query_attr().

Thanks,

Bart.

  reply	other threads:[~2021-09-01 16:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 12:37 [PATCH 0/3] Add temperature notification support Avri Altman
2021-09-01 12:37 ` [PATCH 1/3] scsi: ufs: Probe for " Avri Altman
2021-09-01 16:35   ` Bart Van Assche
2021-09-02  6:24     ` Avri Altman
2021-09-01 12:37 ` [PATCH 2/3] scsi: ufs: Add temperature notification exception handling Avri Altman
2021-09-01 15:51   ` Asutosh Das (asd)
2021-09-01 16:39   ` Bart Van Assche
2021-09-01 19:40     ` Asutosh Das (asd)
2021-09-02  6:46       ` Avri Altman
2021-09-01 12:37 ` [PATCH 3/3] scsi: ufs-sysfs: Add sysfs entries for temperature notification Avri Altman
2021-09-01 16:52   ` Bart Van Assche [this message]
2021-09-02  6:52     ` Avri Altman
2021-09-02 19:58       ` Avri Altman

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=0c547d74-481f-0c5e-9f7a-8c29218a0d3a@acm.org \
    --to=bvanassche@acm.org \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

all inboxes | Powered by JetHome®