All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arthur Simchaev <Arthur.Simchaev@wdc.com>
To: Greg KH <gregkh@linuxfoundation.org>,
	Bart Van Assche <bvanassche@acm.org>
Cc: "James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	Bean Huo <beanhuo@micron.com>
Subject: RE: [PATCH] scsi: ufs: sysfs: add is_ascii_output entry
Date: Sun, 14 Feb 2021 14:21:01 +0000	[thread overview]
Message-ID: <CY4PR04MB0632E76E54562E36707B4BA3ED899@CY4PR04MB0632.namprd04.prod.outlook.com> (raw)
In-Reply-To: <YCjzKOEV9fUPf3Ja@kroah.com>

Done.

Regards
Arthur

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Sunday, February 14, 2021 11:54 AM
> To: Bart Van Assche <bvanassche@acm.org>
> Cc: Arthur Simchaev <Arthur.Simchaev@wdc.com>; James E . J . Bottomley
> <jejb@linux.vnet.ibm.com>; Martin K . Petersen
> <martin.petersen@oracle.com>; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org; alim.akhtar@samsung.com; Bean Huo
> <beanhuo@micron.com>; Arthur Simchaev <Arthur.Simchaev@wdc.com>
> Subject: Re: [PATCH] scsi: ufs: sysfs: add is_ascii_output entry
> 
> CAUTION: This email originated from outside of Western Digital. Do not click
> on links or open attachments unless you recognize the sender and know that
> the content is safe.
> 
> 
> On Wed, Feb 10, 2021 at 07:35:25PM -0800, Bart Van Assche wrote:
> > On 2/10/21 2:53 AM, Arthur Simchaev wrote:
> > > +static bool is_ascii_output = true;
> >
> > [ ... ]
> >
> > >  static const char *ufschd_uic_link_state_to_string(
> > >                     enum uic_link_state state)
> > >  {
> > > @@ -693,7 +695,15 @@ static ssize_t _name##_show(struct device *dev,
> \
> > >                                   SD_ASCII_STD);                    \
> > >     if (ret < 0)                                                    \
> > >             goto out;                                               \
> > > -   ret = sysfs_emit(buf, "%s\n", desc_buf);                        \
> > > +   if (is_ascii_output) {                                          \
> > > +           ret = sysfs_emit(buf, "%s\n", desc_buf);                \
> > > +   } else {                                                        \
> > > +           int i;                                                  \
> > > +                                                                   \
> > > +           for (i = 0; i < desc_buf[0]; i++)                       \
> > > +                   hex_byte_pack(buf + i * 2, desc_buf[i]);        \
> > > +           ret = sysfs_emit(buf, "%s\n", buf);                     \
> > > +   }                                                               \
> > >  out:                                                                       \
> > >     pm_runtime_put_sync(hba->dev);                                  \
> > >     kfree(desc_buf);                                                \
> >
> > Please do not introduce a mode variable but instead introduce a new
> > attribute such that there is one attribute for the unicode output and
> > one attribute for the ASCII output. Mode variables are troublesome when
> > e.g. two scripts try to set the mode attribute concurrently.
> 
> Agreed, just make a new sysfs file, please never change the output of an
> existing sysfs file, that way will guarantee confusion in userspace.
> 
> thanks,
> 
> greg k-h

      reply	other threads:[~2021-02-14 14:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 10:53 [PATCH] scsi: ufs: sysfs: add is_ascii_output entry Arthur Simchaev
2021-02-11  3:35 ` Bart Van Assche
2021-02-14  9:53   ` Greg KH
2021-02-14 14:21     ` Arthur Simchaev [this message]

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=CY4PR04MB0632E76E54562E36707B4BA3ED899@CY4PR04MB0632.namprd04.prod.outlook.com \
    --to=arthur.simchaev@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=gregkh@linuxfoundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.