diff mbox series

[net-next] s390/qeth: use sysfs_emit() to instead of scnprintf()

Message ID 202212051152565871940@zte.com.cn (mailing list archive)
State Changes Requested
Headers show
Series [net-next] s390/qeth: use sysfs_emit() to instead of scnprintf() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

ye.xingchen@zte.com.cn Dec. 5, 2022, 3:52 a.m. UTC
From: ye xingchen <ye.xingchen@zte.com.cn>

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/s390/net/qeth_l3_sys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexandra Winter Dec. 5, 2022, 11:38 a.m. UTC | #1
On 05.12.22 04:52, ye.xingchen@zte.com.cn wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting the
> value to be returned to user space.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
>  drivers/s390/net/qeth_l3_sys.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
> index 1082380b21f8..65eea667e469 100644
> --- a/drivers/s390/net/qeth_l3_sys.c
> +++ b/drivers/s390/net/qeth_l3_sys.c
> @@ -395,7 +395,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
>  	}
>  	mutex_unlock(&card->ip_lock);
> 
> -	return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> +	return str_len ? str_len : sysfs_emit(buf, "\n");
>  }
> 
>  static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev,
> @@ -614,7 +614,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
>  	}
>  	mutex_unlock(&card->ip_lock);
> 
> -	return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> +	return str_len ? str_len : sysfs_emit(buf, "\n");
>  }
> 
>  static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,
There are more instances of scnprintf in s390/net that can be replaced by sysfs_emit. 
We are already working on that. 

But thanks for improving those two.
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Alexander Gordeev Dec. 5, 2022, 11:50 a.m. UTC | #2
On Mon, Dec 05, 2022 at 12:38:59PM +0100, Alexandra Winter wrote:
> 
> 
> On 05.12.22 04:52, ye.xingchen@zte.com.cn wrote:
> > From: ye xingchen <ye.xingchen@zte.com.cn>
> > 
> > Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> > should only use sysfs_emit() or sysfs_emit_at() when formatting the
> > value to be returned to user space.
> > 
> > Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> > ---
> >  drivers/s390/net/qeth_l3_sys.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
> > index 1082380b21f8..65eea667e469 100644
> > --- a/drivers/s390/net/qeth_l3_sys.c
> > +++ b/drivers/s390/net/qeth_l3_sys.c
> > @@ -395,7 +395,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
> >  	}
> >  	mutex_unlock(&card->ip_lock);
> > 
> > -	return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> > +	return str_len ? str_len : sysfs_emit(buf, "\n");
> >  }
> > 
> >  static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev,
> > @@ -614,7 +614,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
> >  	}
> >  	mutex_unlock(&card->ip_lock);
> > 
> > -	return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> > +	return str_len ? str_len : sysfs_emit(buf, "\n");
> >  }
> > 
> >  static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,
> There are more instances of scnprintf in s390/net that can be replaced by sysfs_emit. 
> We are already working on that. 

It seems this particular fix misses scnprintf() to sysfs_emit()
conversion within same very functions just few lines above.

> But thanks for improving those two.
> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
diff mbox series

Patch

diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index 1082380b21f8..65eea667e469 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -395,7 +395,7 @@  static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
 	}
 	mutex_unlock(&card->ip_lock);

-	return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
+	return str_len ? str_len : sysfs_emit(buf, "\n");
 }

 static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev,
@@ -614,7 +614,7 @@  static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
 	}
 	mutex_unlock(&card->ip_lock);

-	return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
+	return str_len ? str_len : sysfs_emit(buf, "\n");
 }

 static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,