[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+zupgymZusMgecUyD8f2-AnoT3OR_O_wjy6uTxjZgSv9BLHLw@mail.gmail.com>
Date: Wed, 7 Jun 2023 18:58:08 -0700
From: Roy Luo <royluo@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: raychi@...gle.com, badhri@...gle.com,
Alan Stern <stern@...land.harvard.edu>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Michael Grzeschik <m.grzeschik@...gutronix.de>,
Bastien Nocera <hadess@...ess.net>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Matthias Kaehlcke <mka@...omium.org>,
Flavio Suligoi <f.suligoi@...m.it>,
Douglas Anderson <dianders@...omium.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
kernel test robot <oliver.sang@...el.com>
Subject: Re: [PATCH v3] usb: core: add sysfs entry for usb device state
> > @@ -160,6 +160,16 @@ static ssize_t connect_type_show(struct device *dev,
> > }
> > static DEVICE_ATTR_RO(connect_type);
> >
> > +static ssize_t state_show(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > + struct usb_port *port_dev = to_usb_port(dev);
> > + enum usb_device_state state = READ_ONCE(port_dev->state);
> > +
> > + return sprintf(buf, "%s\n", usb_state_string(state));
>
> I thought checkpatch would warn you that you should be using
> sysfs_emit() here, wonder why it didn't.
>
> thanks,
>
> greg k-h
I was using sprintf() instead of sysfs_emit() because I randomly referred
to one of the nearby attributes. Looks like there are still many attributes in
port.c that uses sprintf(), any reason why we didn't replace them?
If not, I'm happy to do a clean-up so that others don't make the same mistake
as I did :D
Regards,
Roy
Powered by blists - more mailing lists