* [PATCH v2][next] mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks
@ 2024-10-17 9:13 Paulo Miguel Almeida
2024-10-24 23:22 ` Maciej W. Rozycki
2024-10-30 11:15 ` Thomas Bogendoerfer
0 siblings, 2 replies; 3+ messages in thread
From: Paulo Miguel Almeida @ 2024-10-17 9:13 UTC (permalink / raw)
To: tsbogend, bvanassche, paulo.miguel.almeida.rodenas, gregkh,
ricardo, zhanggenjian, linux-mips, linux-kernel
Cc: paulo.miguel.almeida.rodenas, linux-hardening
Replace open-coded pieces with sysfs_emit() helper in sysfs .show()
callbacks.
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
Changelog:
- v2: amend commit message (Req: Maciej W. Rozycki)
- v1: https://lore.kernel.org/lkml/Zw2GRQkbx8Z8DlcS@mail.google.com/
---
arch/mips/sgi-ip22/ip22-gio.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index d20eec742bfa..5893ea4e382c 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -165,9 +165,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
char *buf)
{
struct gio_device *gio_dev = to_gio_device(dev);
- int len = snprintf(buf, PAGE_SIZE, "gio:%x\n", gio_dev->id.id);
- return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
+ return sysfs_emit(buf, "gio:%x\n", gio_dev->id.id);
}
static DEVICE_ATTR_RO(modalias);
@@ -177,7 +176,7 @@ static ssize_t name_show(struct device *dev,
struct gio_device *giodev;
giodev = to_gio_device(dev);
- return sprintf(buf, "%s", giodev->name);
+ return sysfs_emit(buf, "%s\n", giodev->name);
}
static DEVICE_ATTR_RO(name);
@@ -187,7 +186,7 @@ static ssize_t id_show(struct device *dev,
struct gio_device *giodev;
giodev = to_gio_device(dev);
- return sprintf(buf, "%x", giodev->id.id);
+ return sysfs_emit(buf, "%x\n", giodev->id.id);
}
static DEVICE_ATTR_RO(id);
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2][next] mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks
2024-10-17 9:13 [PATCH v2][next] mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks Paulo Miguel Almeida
@ 2024-10-24 23:22 ` Maciej W. Rozycki
2024-10-30 11:15 ` Thomas Bogendoerfer
1 sibling, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2024-10-24 23:22 UTC (permalink / raw)
To: Paulo Miguel Almeida
Cc: Thomas Bogendoerfer, bvanassche, Greg Kroah-Hartman, ricardo,
zhanggenjian, linux-mips, linux-kernel, linux-hardening
On Thu, 17 Oct 2024, Paulo Miguel Almeida wrote:
> Replace open-coded pieces with sysfs_emit() helper in sysfs .show()
> callbacks.
>
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> Changelog:
> - v2: amend commit message (Req: Maciej W. Rozycki)
> - v1: https://lore.kernel.org/lkml/Zw2GRQkbx8Z8DlcS@mail.google.com/
> ---
Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk>
Thank you for this update.
Maciej
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2][next] mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks
2024-10-17 9:13 [PATCH v2][next] mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks Paulo Miguel Almeida
2024-10-24 23:22 ` Maciej W. Rozycki
@ 2024-10-30 11:15 ` Thomas Bogendoerfer
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2024-10-30 11:15 UTC (permalink / raw)
To: Paulo Miguel Almeida
Cc: bvanassche, gregkh, ricardo, zhanggenjian, linux-mips,
linux-kernel, linux-hardening
On Thu, Oct 17, 2024 at 10:13:42PM +1300, Paulo Miguel Almeida wrote:
> Replace open-coded pieces with sysfs_emit() helper in sysfs .show()
> callbacks.
>
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> Changelog:
> - v2: amend commit message (Req: Maciej W. Rozycki)
> - v1: https://lore.kernel.org/lkml/Zw2GRQkbx8Z8DlcS@mail.google.com/
> ---
> arch/mips/sgi-ip22/ip22-gio.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-30 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 9:13 [PATCH v2][next] mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks Paulo Miguel Almeida
2024-10-24 23:22 ` Maciej W. Rozycki
2024-10-30 11:15 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox