Message ID | 20241109091748.4037589-1-zhangheng@kylinos.cn |
---|---|
State | Superseded |
Headers | show |
Series | [1/4] tty: rfcomm: use sysfs_emit() instead of sprintf() | expand |
Dear zhangheng, Thank you for your patch. Am 09.11.24 um 10:17 schrieb zhangheng: > Follow the advice in Documentation/filesystems/sysfs.rst: > show() should only use sysfs_emit() or sysfs_emit_at() when formatting > the value to be returned to user space. > > Signed-off-by: zhangheng <zhangheng@kylinos.cn> Currently your username is used. Could it be Zhang Heng? $ git config --global user.name "Zhang Heng" $ git commit --amend --author="Zhang Heng <zhangheng@kylinos.cn>" > --- > net/bluetooth/rfcomm/tty.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c > index af80d599c337..21a5b5535ebc 100644 > --- a/net/bluetooth/rfcomm/tty.c > +++ b/net/bluetooth/rfcomm/tty.c > @@ -201,14 +201,14 @@ static ssize_t address_show(struct device *tty_dev, > struct device_attribute *attr, char *buf) > { > struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); > - return sprintf(buf, "%pMR\n", &dev->dst); > + return sysfs_emit(buf, "%pMR\n", &dev->dst); > } > > static ssize_t channel_show(struct device *tty_dev, > struct device_attribute *attr, char *buf) > { > struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); > - return sprintf(buf, "%d\n", dev->channel); > + return sysfs_emit(buf, "%d\n", dev->channel); > } > > static DEVICE_ATTR_RO(address); With the nit above addressed: Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de> Kind regards, Paul
Hi, Heng, Thanks for your patch. zhangheng <zhangheng@kylinos.cn> writes: > Follow the advice in Documentation/filesystems/sysfs.rst: > show() should only use sysfs_emit() or sysfs_emit_at() when formatting > the value to be returned to user space. Please provide a cover letter [0/4] for your series, and send your series with `git send-email '[0/4]' '[1/4]' ... '[4/4]', so that it will be shown as a thread in most email clients, like shown in lore, https://lore.kernel.org/linux-mm/20241107101005.69121-1-21cnbao@gmail.com/ While your email are shown as separate emails, https://lore.kernel.org/lkml/20241109091748.4037589-1-zhangheng@kylinos.cn/ If there are no direct relationship among 4 patches in series, you can send them separately instead of a series. > Signed-off-by: zhangheng <zhangheng@kylinos.cn> > --- > net/bluetooth/rfcomm/tty.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c > index af80d599c337..21a5b5535ebc 100644 > --- a/net/bluetooth/rfcomm/tty.c > +++ b/net/bluetooth/rfcomm/tty.c > @@ -201,14 +201,14 @@ static ssize_t address_show(struct device *tty_dev, > struct device_attribute *attr, char *buf) > { > struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); > - return sprintf(buf, "%pMR\n", &dev->dst); > + return sysfs_emit(buf, "%pMR\n", &dev->dst); > } > > static ssize_t channel_show(struct device *tty_dev, > struct device_attribute *attr, char *buf) > { > struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); > - return sprintf(buf, "%d\n", dev->channel); > + return sysfs_emit(buf, "%d\n", dev->channel); > } > > static DEVICE_ATTR_RO(address); -- Best Regards, Huang, Ying
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index af80d599c337..21a5b5535ebc 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -201,14 +201,14 @@ static ssize_t address_show(struct device *tty_dev, struct device_attribute *attr, char *buf) { struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); - return sprintf(buf, "%pMR\n", &dev->dst); + return sysfs_emit(buf, "%pMR\n", &dev->dst); } static ssize_t channel_show(struct device *tty_dev, struct device_attribute *attr, char *buf) { struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); - return sprintf(buf, "%d\n", dev->channel); + return sysfs_emit(buf, "%d\n", dev->channel); } static DEVICE_ATTR_RO(address);
Follow the advice in Documentation/filesystems/sysfs.rst: show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: zhangheng <zhangheng@kylinos.cn> --- net/bluetooth/rfcomm/tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)