* [PATCH] firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions
@ 2025-10-15 9:41 Rahul Kumar
2025-11-03 5:55 ` Rahul Kumar
0 siblings, 1 reply; 5+ messages in thread
From: Rahul Kumar @ 2025-10-15 9:41 UTC (permalink / raw)
To: dinguyen; +Cc: linux-kernel, linux-kernel-mentees, skhan, rk0006818
Replace scnprintf() with sysfs_emit() in sysfs *_show() functions
in stratix10-rsu.c to follow the kernel's guidelines from
Documentation/filesystems/sysfs.rst.
This improves consistency, safety, and makes the code easier to
maintain and update in the future.
Signed-off-by: Rahul Kumar <rk0006818@gmail.com>
---
drivers/firmware/stratix10-rsu.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
index 1ea39a0a76c7..53c896ceca9a 100644
--- a/drivers/firmware/stratix10-rsu.c
+++ b/drivers/firmware/stratix10-rsu.c
@@ -454,8 +454,7 @@ static ssize_t max_retry_show(struct device *dev,
if (!priv)
return -ENODEV;
- return scnprintf(buf, sizeof(priv->max_retry),
- "0x%08x\n", priv->max_retry);
+ return sysfs_emit(buf, "0x%08x\n", priv->max_retry);
}
static ssize_t dcmf0_show(struct device *dev,
@@ -632,7 +631,7 @@ static ssize_t spt0_address_show(struct device *dev,
if (priv->spt0_address == INVALID_SPT_ADDRESS)
return -EIO;
- return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address);
+ return sysfs_emit(buf, "0x%08lx\n", priv->spt0_address);
}
static ssize_t spt1_address_show(struct device *dev,
@@ -646,7 +645,7 @@ static ssize_t spt1_address_show(struct device *dev,
if (priv->spt1_address == INVALID_SPT_ADDRESS)
return -EIO;
- return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address);
+ return sysfs_emit(buf, "0x%08lx\n", priv->spt1_address);
}
static DEVICE_ATTR_RO(current_image);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions
2025-10-15 9:41 [PATCH] firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions Rahul Kumar
@ 2025-11-03 5:55 ` Rahul Kumar
2025-11-04 4:45 ` Dinh Nguyen
0 siblings, 1 reply; 5+ messages in thread
From: Rahul Kumar @ 2025-11-03 5:55 UTC (permalink / raw)
To: dinguyen; +Cc: linux-kernel, linux-kernel-mentees, skhan
On Wed, Oct 15, 2025 at 3:11 PM Rahul Kumar <rk0006818@gmail.com> wrote:
>
> Replace scnprintf() with sysfs_emit() in sysfs *_show() functions
> in stratix10-rsu.c to follow the kernel's guidelines from
> Documentation/filesystems/sysfs.rst.
>
> This improves consistency, safety, and makes the code easier to
> maintain and update in the future.
>
> Signed-off-by: Rahul Kumar <rk0006818@gmail.com>
> ---
> drivers/firmware/stratix10-rsu.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
> index 1ea39a0a76c7..53c896ceca9a 100644
> --- a/drivers/firmware/stratix10-rsu.c
> +++ b/drivers/firmware/stratix10-rsu.c
> @@ -454,8 +454,7 @@ static ssize_t max_retry_show(struct device *dev,
> if (!priv)
> return -ENODEV;
>
> - return scnprintf(buf, sizeof(priv->max_retry),
> - "0x%08x\n", priv->max_retry);
> + return sysfs_emit(buf, "0x%08x\n", priv->max_retry);
> }
>
> static ssize_t dcmf0_show(struct device *dev,
> @@ -632,7 +631,7 @@ static ssize_t spt0_address_show(struct device *dev,
> if (priv->spt0_address == INVALID_SPT_ADDRESS)
> return -EIO;
>
> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address);
> + return sysfs_emit(buf, "0x%08lx\n", priv->spt0_address);
> }
>
> static ssize_t spt1_address_show(struct device *dev,
> @@ -646,7 +645,7 @@ static ssize_t spt1_address_show(struct device *dev,
> if (priv->spt1_address == INVALID_SPT_ADDRESS)
> return -EIO;
>
> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address);
> + return sysfs_emit(buf, "0x%08lx\n", priv->spt1_address);
> }
>
> static DEVICE_ATTR_RO(current_image);
> --
> 2.43.0
>
Hi Dinguyen,
Just following up to see if you’ve had a chance to review this patch,
or if there’s anything more needed from my side.
Link to v1:
https://lore.kernel.org/all/20251015094117.535157-1-rk0006818@gmail.com/
Thanks,
Rahul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions
2025-11-03 5:55 ` Rahul Kumar
@ 2025-11-04 4:45 ` Dinh Nguyen
2025-11-11 6:38 ` Rahul Kumar
0 siblings, 1 reply; 5+ messages in thread
From: Dinh Nguyen @ 2025-11-04 4:45 UTC (permalink / raw)
To: Rahul Kumar; +Cc: linux-kernel, linux-kernel-mentees, skhan
On 11/2/25 23:55, Rahul Kumar wrote:
> On Wed, Oct 15, 2025 at 3:11 PM Rahul Kumar <rk0006818@gmail.com> wrote:
>>
>> Replace scnprintf() with sysfs_emit() in sysfs *_show() functions
>> in stratix10-rsu.c to follow the kernel's guidelines from
>> Documentation/filesystems/sysfs.rst.
>>
>> This improves consistency, safety, and makes the code easier to
>> maintain and update in the future.
>>
>> Signed-off-by: Rahul Kumar <rk0006818@gmail.com>
>> ---
>> drivers/firmware/stratix10-rsu.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
>> index 1ea39a0a76c7..53c896ceca9a 100644
>> --- a/drivers/firmware/stratix10-rsu.c
>> +++ b/drivers/firmware/stratix10-rsu.c
>> @@ -454,8 +454,7 @@ static ssize_t max_retry_show(struct device *dev,
>> if (!priv)
>> return -ENODEV;
>>
>> - return scnprintf(buf, sizeof(priv->max_retry),
>> - "0x%08x\n", priv->max_retry);
>> + return sysfs_emit(buf, "0x%08x\n", priv->max_retry);
>> }
>>
>> static ssize_t dcmf0_show(struct device *dev,
>> @@ -632,7 +631,7 @@ static ssize_t spt0_address_show(struct device *dev,
>> if (priv->spt0_address == INVALID_SPT_ADDRESS)
>> return -EIO;
>>
>> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address);
>> + return sysfs_emit(buf, "0x%08lx\n", priv->spt0_address);
>> }
>>
>> static ssize_t spt1_address_show(struct device *dev,
>> @@ -646,7 +645,7 @@ static ssize_t spt1_address_show(struct device *dev,
>> if (priv->spt1_address == INVALID_SPT_ADDRESS)
>> return -EIO;
>>
>> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address);
>> + return sysfs_emit(buf, "0x%08lx\n", priv->spt1_address);
>> }
>>
>> static DEVICE_ATTR_RO(current_image);
>> --
>> 2.43.0
>>
>
> Hi Dinguyen,
>
> Just following up to see if you’ve had a chance to review this patch,
> or if there’s anything more needed from my side.
>
> Link to v1:
> https://lore.kernel.org/all/20251015094117.535157-1-rk0006818@gmail.com/
>
> Thanks,
> Rahul
Sorry about that. I've applied it.
Thanks,
Dinh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions
2025-11-04 4:45 ` Dinh Nguyen
@ 2025-11-11 6:38 ` Rahul Kumar
2025-11-11 11:42 ` Dinh Nguyen
0 siblings, 1 reply; 5+ messages in thread
From: Rahul Kumar @ 2025-11-11 6:38 UTC (permalink / raw)
To: Dinh Nguyen; +Cc: linux-kernel, linux-kernel-mentees, skhan
On Tue, Nov 4, 2025 at 10:15 AM Dinh Nguyen <dinguyen@kernel.org> wrote:
>
>
>
> On 11/2/25 23:55, Rahul Kumar wrote:
> > On Wed, Oct 15, 2025 at 3:11 PM Rahul Kumar <rk0006818@gmail.com> wrote:
> >>
> >> Replace scnprintf() with sysfs_emit() in sysfs *_show() functions
> >> in stratix10-rsu.c to follow the kernel's guidelines from
> >> Documentation/filesystems/sysfs.rst.
> >>
> >> This improves consistency, safety, and makes the code easier to
> >> maintain and update in the future.
> >>
> >> Signed-off-by: Rahul Kumar <rk0006818@gmail.com>
> >> ---
> >> drivers/firmware/stratix10-rsu.c | 7 +++----
> >> 1 file changed, 3 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
> >> index 1ea39a0a76c7..53c896ceca9a 100644
> >> --- a/drivers/firmware/stratix10-rsu.c
> >> +++ b/drivers/firmware/stratix10-rsu.c
> >> @@ -454,8 +454,7 @@ static ssize_t max_retry_show(struct device *dev,
> >> if (!priv)
> >> return -ENODEV;
> >>
> >> - return scnprintf(buf, sizeof(priv->max_retry),
> >> - "0x%08x\n", priv->max_retry);
> >> + return sysfs_emit(buf, "0x%08x\n", priv->max_retry);
> >> }
> >>
> >> static ssize_t dcmf0_show(struct device *dev,
> >> @@ -632,7 +631,7 @@ static ssize_t spt0_address_show(struct device *dev,
> >> if (priv->spt0_address == INVALID_SPT_ADDRESS)
> >> return -EIO;
> >>
> >> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address);
> >> + return sysfs_emit(buf, "0x%08lx\n", priv->spt0_address);
> >> }
> >>
> >> static ssize_t spt1_address_show(struct device *dev,
> >> @@ -646,7 +645,7 @@ static ssize_t spt1_address_show(struct device *dev,
> >> if (priv->spt1_address == INVALID_SPT_ADDRESS)
> >> return -EIO;
> >>
> >> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address);
> >> + return sysfs_emit(buf, "0x%08lx\n", priv->spt1_address);
> >> }
> >>
> >> static DEVICE_ATTR_RO(current_image);
> >> --
> >> 2.43.0
> >>
> >
> > Hi Dinguyen,
> >
> > Just following up to see if you’ve had a chance to review this patch,
> > or if there’s anything more needed from my side.
> >
> > Link to v1:
> > https://lore.kernel.org/all/20251015094117.535157-1-rk0006818@gmail.com/
> >
> > Thanks,
> > Rahul
>
> Sorry about that. I've applied it.
>
> Thanks,
> Dinh
>
Hi Dinh,
Could you please share the commit ID where this patch was applied?
Thanks,
Rahul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions
2025-11-11 6:38 ` Rahul Kumar
@ 2025-11-11 11:42 ` Dinh Nguyen
0 siblings, 0 replies; 5+ messages in thread
From: Dinh Nguyen @ 2025-11-11 11:42 UTC (permalink / raw)
To: Rahul Kumar; +Cc: linux-kernel, linux-kernel-mentees, skhan
On 11/11/25 00:38, Rahul Kumar wrote:
> On Tue, Nov 4, 2025 at 10:15 AM Dinh Nguyen <dinguyen@kernel.org> wrote:
>>
>>
>>
>> On 11/2/25 23:55, Rahul Kumar wrote:
>>> On Wed, Oct 15, 2025 at 3:11 PM Rahul Kumar <rk0006818@gmail.com> wrote:
>>>>
>>>> Replace scnprintf() with sysfs_emit() in sysfs *_show() functions
>>>> in stratix10-rsu.c to follow the kernel's guidelines from
>>>> Documentation/filesystems/sysfs.rst.
>>>>
>>>> This improves consistency, safety, and makes the code easier to
>>>> maintain and update in the future.
>>>>
>>>> Signed-off-by: Rahul Kumar <rk0006818@gmail.com>
>>>> ---
>>>> drivers/firmware/stratix10-rsu.c | 7 +++----
>>>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
>>>> index 1ea39a0a76c7..53c896ceca9a 100644
>>>> --- a/drivers/firmware/stratix10-rsu.c
>>>> +++ b/drivers/firmware/stratix10-rsu.c
>>>> @@ -454,8 +454,7 @@ static ssize_t max_retry_show(struct device *dev,
>>>> if (!priv)
>>>> return -ENODEV;
>>>>
>>>> - return scnprintf(buf, sizeof(priv->max_retry),
>>>> - "0x%08x\n", priv->max_retry);
>>>> + return sysfs_emit(buf, "0x%08x\n", priv->max_retry);
>>>> }
>>>>
>>>> static ssize_t dcmf0_show(struct device *dev,
>>>> @@ -632,7 +631,7 @@ static ssize_t spt0_address_show(struct device *dev,
>>>> if (priv->spt0_address == INVALID_SPT_ADDRESS)
>>>> return -EIO;
>>>>
>>>> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address);
>>>> + return sysfs_emit(buf, "0x%08lx\n", priv->spt0_address);
>>>> }
>>>>
>>>> static ssize_t spt1_address_show(struct device *dev,
>>>> @@ -646,7 +645,7 @@ static ssize_t spt1_address_show(struct device *dev,
>>>> if (priv->spt1_address == INVALID_SPT_ADDRESS)
>>>> return -EIO;
>>>>
>>>> - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address);
>>>> + return sysfs_emit(buf, "0x%08lx\n", priv->spt1_address);
>>>> }
>>>>
>>>> static DEVICE_ATTR_RO(current_image);
>>>> --
>>>> 2.43.0
>>>>
>>>
>>> Hi Dinguyen,
>>>
>>> Just following up to see if you’ve had a chance to review this patch,
>>> or if there’s anything more needed from my side.
>>>
>>> Link to v1:
>>> https://lore.kernel.org/all/20251015094117.535157-1-rk0006818@gmail.com/
>>>
>>> Thanks,
>>> Rahul
>>
>> Sorry about that. I've applied it.
>>
>> Thanks,
>> Dinh
>>
>
> Hi Dinh,
>
> Could you please share the commit ID where this patch was applied?
>
I've applied this to my branch on kernel.org and will send a PR sometime
this week.
Dinh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-11 11:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 9:41 [PATCH] firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions Rahul Kumar
2025-11-03 5:55 ` Rahul Kumar
2025-11-04 4:45 ` Dinh Nguyen
2025-11-11 6:38 ` Rahul Kumar
2025-11-11 11:42 ` Dinh Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox