[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7c9690c70c89aac590de139766b5be3bc9162725.camel@perches.com>
Date: Mon, 26 Jun 2023 22:09:46 -0700
From: Joe Perches <joe@...ches.com>
To: Alexandra Winter <wintera@...ux.ibm.com>, David Miller
<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, linux-s390@...r.kernel.org, Heiko Carstens
<hca@...ux.ibm.com>, Thorsten Winkler <twinkler@...ux.ibm.com>, Jules
Irenge <jbi.octave@...il.com>, Simon Horman <simon.horman@...igine.com>
Subject: Re: [PATCH net-next v2 1/4] s390/lcs: Convert sysfs sprintf to
sysfs_emit
On Wed, 2023-06-21 at 15:49 +0200, Alexandra Winter wrote:
> From: Thorsten Winkler <twinkler@...ux.ibm.com>
>
> Following the advice of the Documentation/filesystems/sysfs.rst.
> All sysfs related show()-functions should only use sysfs_emit() or
> sysfs_emit_at() when formatting the value to be returned to user space.
>
> While at it, follow Linux kernel coding style and unify indentation
[]
> diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
[]
> @@ -1901,14 +1901,14 @@ lcs_open_device(struct net_device *dev)
> static ssize_t
> lcs_portno_show (struct device *dev, struct device_attribute *attr, char *buf)
> {
> - struct lcs_card *card;
> + struct lcs_card *card;
>
> card = dev_get_drvdata(dev);
>
> - if (!card)
> - return 0;
> + if (!card)
> + return 0;
>
> - return sprintf(buf, "%d\n", card->portno);
> + return sysfs_emit(buf, "%d\n", card->portno);
[]
> @@ -1970,7 +1971,7 @@ lcs_timeout_show(struct device *dev, struct device_attribute *attr, char *buf)
>
> card = dev_get_drvdata(dev);
>
> - return card ? sprintf(buf, "%u\n", card->lancmd_timeout) : 0;
> + return card ? sysfs_emit(buf, "%u\n", card->lancmd_timeout) : 0;
Like the other show function
I think it'd be nicer to use:
card = dev_get_drvdata(dev);
if (!card)
return 0;
return sysfs_emit(buf, "%u\n", card->lancmd_timeout);
Powered by blists - more mailing lists