Re: [PATCH] fixing some coding style issues on line6 driver.c
From: Joe Perches
Date: Sun Mar 16 2014 - 12:55:41 EST
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[] = {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/