firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions
PATCH 1/1 firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions
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.
--- drivers/firmware/stratix10-rsu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/firmware/stratix10-rsu.c +3 -4
@@ -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);
Signature · 1 line
2.43.0
Quoted 46 lines · Rahul Kumar
Replace
scnprintf()withsysfs_emit()in sysfs*_show()functions instratix10-rsu.cto follow the kernel's guidelines fromDocumentation/filesystems/sysfs.rst.This improves consistency, safety, and makes the code easier to maintain and update in the future.
Signed-off-by Rahul Kumar <[email protected]>--- drivers/firmware/stratix10-rsu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/firmware/stratix10-rsu.c +3
-5@@ -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); --
Quoted 2 lines
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/[email protected]/
Thanks,
Rahul
Dinh Nguyen
maintainerQuoted 52 lines · Rahul Kumar
Quoted 46 lines · Rahul Kumar
Replace
scnprintf()withsysfs_emit()in sysfs*_show()functions instratix10-rsu.cto follow the kernel's guidelines fromDocumentation/filesystems/sysfs.rst.This improves consistency, safety, and makes the code easier to maintain and update in the future.
Signed-off-by Rahul Kumar <[email protected]>--- drivers/firmware/stratix10-rsu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/firmware/stratix10-rsu.c +3
-5@@ -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); --Quoted 2 lines
2.43.0
Hi Dinguyen,
Quoted 8 lines
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/[email protected]/Thanks,
Rahul
Sorry about that. I've applied it.
Thanks,
Dinh
Quoted 62 lines · Dinh Nguyen
Quoted 58 lines · Rahul Kumar
Quoted 46 lines · Rahul Kumar
Replace
scnprintf()withsysfs_emit()in sysfs*_show()functions instratix10-rsu.cto follow the kernel's guidelines fromDocumentation/filesystems/sysfs.rst.This improves consistency, safety, and makes the code easier to maintain and update in the future.
Signed-off-by Rahul Kumar <[email protected]>--- drivers/firmware/stratix10-rsu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/firmware/stratix10-rsu.c +3
-5@@ -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); --Quoted 2 lines
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.
Quoted 8 lines
Quoted 2 lines
Thanks,
RahulSorry about that. I've applied it.
Thanks,
Dinh
Hi Dinh,
Could you please share the commit ID where this patch was applied?
Thanks,
Rahul
Dinh Nguyen
maintainerQuoted 68 lines · Rahul Kumar
Quoted 67 lines · Dinh Nguyen
Quoted 52 lines · Rahul Kumar
Quoted 46 lines · Rahul Kumar
Replace
scnprintf()withsysfs_emit()in sysfs*_show()functions instratix10-rsu.cto follow the kernel's guidelines fromDocumentation/filesystems/sysfs.rst.This improves consistency, safety, and makes the code easier to maintain and update in the future.
Signed-off-by Rahul Kumar <[email protected]>--- drivers/firmware/stratix10-rsu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/firmware/stratix10-rsu.c +3
-5@@ -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); --Quoted 2 lines
2.43.0
Hi Dinguyen,
Quoted 8 lines
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/[email protected]/Thanks,
RahulSorry about that. I've applied it.
Quoted 8 lines
Quoted 3 lines
Thanks,
DinhHi 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