Messages in this thread |  | | Date | Mon, 5 Dec 2022 03:53:49 +0300 | From | Serge Semin <> | Subject | Re: [PATCH] bus: use sysfs_emit() to instead of scnprintf() |
| |
On Thu, Dec 01, 2022 at 09:38:14AM +0800, ye.xingchen@zte.com.cn wrote: > From: ye xingchen <ye.xingchen@zte.com.cn> > > Replace the open-code with sysfs_emit() to simplify the code.
Nice cleanup. Thanks. Acked-by: Serge Semin <fancer.lancer@gmail.com>
* One note. Next time please use the scripts/get_maintainer.pl script to get the driver maintainers list and their actual email addresses.
-Sergey
> > Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> > --- > drivers/bus/bt1-apb.c | 6 +++--- > drivers/bus/bt1-axi.c | 4 ++-- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c > index 63b1b4a76671..bcf10f1d6dc1 100644 > --- a/drivers/bus/bt1-apb.c > +++ b/drivers/bus/bt1-apb.c > @@ -265,7 +265,7 @@ static ssize_t count_show(struct device *dev, struct device_attribute *attr, > { > struct bt1_apb *apb = dev_get_drvdata(dev); > > - return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&apb->count)); > + return sysfs_emit(buf, "%d\n", atomic_read(&apb->count)); > } > static DEVICE_ATTR_RO(count); > > @@ -283,7 +283,7 @@ static ssize_t timeout_show(struct device *dev, struct device_attribute *attr, > > timeout = bt1_apb_n_to_timeout_us(apb, n); > > - return scnprintf(buf, PAGE_SIZE, "%lu\n", timeout); > + return sysfs_emit(buf, "%lu\n", timeout); > } > > static ssize_t timeout_store(struct device *dev, > @@ -310,7 +310,7 @@ static DEVICE_ATTR_RW(timeout); > static ssize_t inject_error_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > - return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n"); > + return sysfs_emit(buf, "Error injection: nodev irq\n"); > } > > static ssize_t inject_error_store(struct device *dev, > diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c > index 70e49a6e5374..04c14821bb3c 100644 > --- a/drivers/bus/bt1-axi.c > +++ b/drivers/bus/bt1-axi.c > @@ -197,14 +197,14 @@ static ssize_t count_show(struct device *dev, > { > struct bt1_axi *axi = dev_get_drvdata(dev); > > - return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&axi->count)); > + return sysfs_emit(buf, "%d\n", atomic_read(&axi->count)); > } > static DEVICE_ATTR_RO(count); > > static ssize_t inject_error_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > - return scnprintf(buf, PAGE_SIZE, "Error injection: bus unaligned\n"); > + return sysfs_emit(buf, "Error injection: bus unaligned\n"); > } > > static ssize_t inject_error_store(struct device *dev, > -- > 2.25.1 >
|  |