Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1633018

Re: [PATCH] staging: ks7010: remove line continuations in quoted strings

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: ks7010: remove line continuations in quoted strings
Date 2017-04-28 18:50 +0200
Message-ID <tBhfH-1AI-3@gated-at.bofh.it> (permalink)
References <tBeUy-8u3-13@gated-at.bofh.it> <tBf4d-6x-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2017-04-28 at 17:26 +0300, Dan Carpenter wrote:
> On Fri, Apr 28, 2017 at 04:19:28PM +0200, Ilia Sergachev wrote:
> > Checkpatch emits WARNING: Avoid line continuations in quoted strings.
> > 
> > Remove line continuations - split strings using quotes.
> > 
> > Signed-off-by: Ilia Sergachev <ilia.sergachev@unibas.ch>
> > ---
> >  drivers/staging/ks7010/ks_hostif.c | 20 ++++++++++++++------
> >  1 file changed, 14 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> > index 7151f16e2f9c..a0c632a52f48 100644
> > --- a/drivers/staging/ks7010/ks_hostif.c
> > +++ b/drivers/staging/ks7010/ks_hostif.c
> > @@ -191,9 +191,15 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info_t *ap_info)
> >  		wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL);
> >  	}
> >  	DPRINTK(4, "\n    Link AP\n");
> > -	DPRINTK(4, "    bssid=%02X:%02X:%02X:%02X:%02X:%02X\n \
> > -   essid=%s\n    rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n    channel=%d\n \
> > -   rssi=%d\n    sq=%d\n    capability=%04X\n", ap->bssid[0], ap->bssid[1], ap->bssid[2], ap->bssid[3], ap->bssid[4], ap->bssid[5], &(ap->ssid.body[0]), ap->rate_set.body[0], ap->rate_set.body[1], ap->rate_set.body[2], ap->rate_set.body[3], ap->rate_set.body[4], ap->rate_set.body[5], ap->rate_set.body[6], ap->rate_set.body[7], ap->channel, ap->rssi, ap->sq, ap->capability);
> > +	DPRINTK(4, "    bssid=%02X:%02X:%02X:%02X:%02bX:%02X\n"
> > +	"    essid=%s\n    rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n"
> > +	"    channel=%d\n    rssi=%d\n    sq=%d\n    capability=%04X\n",
> > +	ap->bssid[0], ap->bssid[1], ap->bssid[2],
> > +	ap->bssid[3], ap->bssid[4], ap->bssid[5],
> > +	&(ap->ssid.body[0]), ap->rate_set.body[0], ap->rate_set.body[1],
> > +	ap->rate_set.body[2], ap->rate_set.body[3], ap->rate_set.body[4],
> > +	ap->rate_set.body[5], ap->rate_set.body[6], ap->rate_set.body[7],
> > +	ap->channel, ap->rssi, ap->sq, ap->capability);
> 
> Could you indent it like this:
> 
> 	DPRINTK(4, "    bssid=%02X:%02X:%02X:%02X:%02X:%02X\n"
> 		   "    essid=%s\n    rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n"
> 		   "    channel=%d\n    rssi=%d\n    sq=%d\n    capability=%04X\n",
> 		ap->bssid[0], ap->bssid[1], ap->bssid[2],
> 		ap->bssid[3], ap->bssid[4], ap->bssid[5],
> 		&(ap->ssid.body[0]), ap->rate_set.body[0], ap->rate_set.body[1],
> 		ap->rate_set.body[2], ap->rate_set.body[3], ap->rate_set.body[4],
> 		ap->rate_set.body[5], ap->rate_set.body[6], ap->rate_set.body[7],
> 		ap->channel, ap->rssi, ap->sq, ap->capability);
> 
> And actually it might be more readable to break it up more:
> 
> 	DPRINTK(4, "    bssid=%02X:%02X:%02X:%02X:%02X:%02X\n"
> 		   "    essid=%s\n"
> 		   "    rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n"
> 		   "    channel=%d\n"
> 		   "    rssi=%d\n"
> 		   "    sq=%d\n"
> 		   "    capability=%04X\n",
> 		ap->bssid[0], ap->bssid[1], ap->bssid[2],
> 		ap->bssid[3], ap->bssid[4], ap->bssid[5],
> 		&(ap->ssid.body[0]), ap->rate_set.body[0], ap->rate_set.body[1],
> 		ap->rate_set.body[2], ap->rate_set.body[3], ap->rate_set.body[4],
> 		ap->rate_set.body[5], ap->rate_set.body[6], ap->rate_set.body[7],
> 		ap->channel, ap->rssi, ap->sq, ap->capability);

And it might be smaller object code for some arches
to use one DPRINTK call for each line.

Probably more readable in the logs too with each line
timestamped instead of just the first line.

(and use %pM assuming bssid is char)

	DPRINTK(4, "    bssid=%pM\n", ap->bssid);
	DPRINTK(4, "    essud=%s\n", ap->ssid.body);
	DPRINTK(4, "    rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n",
		ap->rate_set.body[0], ap->rate_set.body[1],
		ap->rate_set.body[2], ap->rate_set.body[3],
		ap->rate_set.body[4], ap->rate_set.body[5],
		ap->rate_set.body[6], ap->rate_set.body[7]);
	DPRINTK(4, "    channel=%d\n", ap->channel);
	DPRINTK(4, "    rssi=%d\n", ap->rssi);
	DPRINTK(4, "    sq=%d\n", ap->sq);
	DPRINTK(4, "    capability=%04X\n", ap->capability);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] staging: ks7010: remove line continuations in quoted strings Ilia Sergachev <ilia.sergachev@unibas.ch> - 2017-04-28 16:20 +0200
  Re: [PATCH] staging: ks7010: remove line continuations in quoted  strings Dan Carpenter <dan.carpenter@oracle.com> - 2017-04-28 16:30 +0200
    Re: [PATCH] staging: ks7010: remove line continuations in quoted  strings Joe Perches <joe@perches.com> - 2017-04-28 18:50 +0200
    Re: [PATCH] staging: ks7010: remove line continuations in quoted  strings "Tobin C. Harding" <me@tobin.cc> - 2017-04-30 11:10 +0200
  [PATCH v2] staging: ks7010: remove line continuations in quoted strings Ilia Sergachev <ilia.sergachev@unibas.ch> - 2017-04-28 17:40 +0200

csiph-web