From: Sicilia Cristian <sicilia.cristian@gmail.com>
To: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] staging: greybus: Added space between string concatenated
Date: Wed, 5 Dec 2018 22:00:34 +0100 [thread overview]
Message-ID: <20181205210034.GA24054@peano> (raw)
In-Reply-To: <42632636-9b08-bd75-b789-88ef82f52c2c@nexus-software.ie>
[-- Attachment #1: Type: text/plain, Size: 2554 bytes --]
On Wed, Dec 05, 2018 at 10:12:24AM +0000, Bryan O'Donoghue wrote:
> On 04/12/2018 20:58, Cristian Sicilia wrote:
> >Some concatenated strings are now spaced.
> >
> >Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
> >---
> > drivers/staging/greybus/loopback.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> >diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> >index 1085e06..acfa392 100644
> >--- a/drivers/staging/greybus/loopback.c
> >+++ b/drivers/staging/greybus/loopback.c
> >@@ -141,7 +141,7 @@ static ssize_t name##_##field##_show(struct device *dev, \
> > /* Report 0 for min and max if no transfer successed */ \
> > if (!gb->requests_completed) \
> > return sprintf(buf, "0\n"); \
> >- return sprintf(buf, "%"#type"\n", gb->name.field); \
> >+ return sprintf(buf, "%" #type "\n", gb->name.field); \
> > } \
> > static DEVICE_ATTR_RO(name##_##field)
> >@@ -176,7 +176,7 @@ static ssize_t field##_show(struct device *dev, \
> > char *buf) \
> > { \
> > struct gb_loopback *gb = dev_get_drvdata(dev); \
> >- return sprintf(buf, "%"#type"\n", gb->field); \
> >+ return sprintf(buf, "%" #type "\n", gb->field); \
> > } \
> > static ssize_t field##_store(struct device *dev, \
> > struct device_attribute *attr, \
> >@@ -212,7 +212,7 @@ static ssize_t field##_show(struct device *dev, \
> > char *buf) \
> > { \
> > struct gb_loopback *gb = dev_get_drvdata(dev); \
> >- return sprintf(buf, "%"#type"\n", gb->field); \
> >+ return sprintf(buf, "%" #type "\n", gb->field); \
> > } \
> > static ssize_t field##_store(struct device *dev, \
> > struct device_attribute *attr, \
> >
> Eh.
>
> But doesn't all of this add an extra two space to the resultant string ?
>
> Not what we want.
It doesn't change the result string, if I well understand the question your
doubt is if there are some space between % and type or between type and
end of line:
This (supposing type=u and field=min):
return sprintf(buf, "%"#type"\n", gb->field);
Will expanded in this
return sprintf(buf, "%""u""\n", gb->min);
That's is like:
return sprintf(buf, "%u\n", gb->min);
This (supposing type=u and field=min):
return sprintf(buf, "%" #type "\n", gb->field);
Will expanded in this
return sprintf(buf, "%" "u" "\n", gb->min);
That's is like:
return sprintf(buf, "%u\n", gb->min);
>
> ---
> bod
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2018-12-05 21:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 20:58 [PATCH 0/2] staging: greybus: Fix parameters alignment and strings concatenation Cristian Sicilia
2018-12-04 20:58 ` [PATCH 1/2] staging: greybus: Align function call parameters to parenthesis Cristian Sicilia
2018-12-05 8:46 ` Greg Kroah-Hartman
2018-12-05 21:09 ` Sicilia Cristian
2018-12-04 20:58 ` [PATCH 2/2] staging: greybus: Added space between string concatenated Cristian Sicilia
2018-12-05 10:12 ` Bryan O'Donoghue
2018-12-05 21:00 ` Sicilia Cristian [this message]
2018-12-06 9:43 ` Bryan O'Donoghue
2018-12-06 15:05 ` Greg Kroah-Hartman
2018-12-06 16:14 ` Bryan O'Donoghue
2018-12-06 16:23 ` Greg Kroah-Hartman
2018-12-06 16:24 ` Bryan O'Donoghue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181205210034.GA24054@peano \
--to=sicilia.cristian@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pure.logic@nexus-software.ie \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox