mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Davide Berardi <berardi.dav@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fixing some coding style issues on line6 driver.c
Date: Sun, 16 Mar 2014 09:55:26 -0700	[thread overview]
Message-ID: <1394988926.5689.39.camel@joe-AO722> (raw)
In-Reply-To: <20140316163700.GA1781@kroah.com>

On Sun, 2014-03-16 at 16:37 +0000, Greg KH wrote:
> On Sun, Mar 16, 2014 at 01:20:16PM +0100, Davide Berardi wrote:
> > Fixed some over-80 characters lines.
> > (this is for eudyptula challenge task 10).
[]
> > diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
[]
> > @@ -59,26 +59,46 @@ MODULE_DEVICE_TABLE(usb, line6_id_table);
> >  
> >  /* *INDENT-OFF* */
> >  static struct line6_properties line6_properties_table[] = {
> > -	{ LINE6_BIT_BASSPODXT,     "BassPODxt",     "BassPODxt",        LINE6_BIT_CONTROL_PCM_HWMON },
> > -	{ LINE6_BIT_BASSPODXTLIVE, "BassPODxtLive", "BassPODxt Live",   LINE6_BIT_CONTROL_PCM_HWMON },
[]
> > +	{ LINE6_BIT_BASSPODXT,     "BassPODxt",
> > +		"BassPODxt",        LINE6_BIT_CONTROL_PCM_HWMON },
> > +	{ LINE6_BIT_BASSPODXTLIVE, "BassPODxtLive",
> > +		"BassPODxt Live",   LINE6_BIT_CONTROL_PCM_HWMON },
> 
> That looks worse, sorry, I can't take this.

Thanks Greg.

Davide, you _might_ add a simplifying macro if you really
wanted this to be a bit neater, but any gains are going
to be _very_ minor.

>  static struct line6_properties line6_properties_table[] = {
> > -	{ LINE6_BIT_BASSPODXT,     "BassPODxt",     "BassPODxt",        LINE6_BIT_CONTROL_PCM_HWMON },

The struct is:

struct line6_properties {
	int device_bit;
	const char *id;
	const char *name;
	int capabilities;
};

Here's a possible simplifying macro:

#define L6_PROP(dev, id, name, cap) \
	{.int = LINE6_BIT_##bit, .id = id, .name = name, .capabilities = LINE6_BIT_##cap}

so the entries could become:

static struct line6_properties line6_properties_table[] = {
	L6_PROP(BASSPODXT, "BassPODxt", "BassPODxt", CONTROL_PCM_HWMON),
etc.

But even that isn't necessarily better.

Probably the better improvement here would be to change
the declaration of line6_properties_table to

static const struct line6_properties line6_properties_table[] = {



  reply	other threads:[~2014-03-16 16:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-16 12:20 Davide Berardi
2014-03-16 16:37 ` Greg KH
2014-03-16 16:55   ` Joe Perches [this message]
2014-03-17  2:34     ` Davide Berardi
2014-03-17 19:08       ` Greg KH

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=1394988926.5689.39.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=berardi.dav@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®