Re: [PATCH v2] driver core: fix several coding style warnings

From: Joe Perches
Date: Mon Mar 09 2015 - 14:27:53 EST


On Mon, 2015-03-09 at 20:08 +0200, Ioana Antoche wrote:
> Fix checkpatch.pl warnings such as:
> * missing blank line after declarations
> * line over 80 characters
>
> Signed-off-by: Ioana Antoche <ioana.antoche@xxxxxxxxx>
> ---
> * undo changes related to "ERROR: that open brace { should be on the previous line".

Not quite.

> diff --git a/drivers/base/bus.c b/drivers/base/bus.c

> @@ -298,8 +299,7 @@ static struct device *next_device(struct klist_iter *i)
> * count in the supplied callback.
> */
> int bus_for_each_dev(struct bus_type *bus, struct device *start,
> - void *data, int (*fn)(struct device *, void *))
> -{
> + void *data, int (*fn)(struct device *, void *)) {

Don't want this change here.

> @@ -395,7 +395,8 @@ struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id
> return NULL;
>
> if (hint) {
> - klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus);
> + klist_iter_init_node(&subsys->p->klist_devices, &i,
> + &hint->p->knode_bus);

Please run your patches though checkpatch --strict.

This second line should be aligned to the open parenthesis like:

klist_iter_init_node(&subsys->p->klist_devices, &i,
&hint->p->knode_bus);


> @@ -448,8 +449,7 @@ static struct device_driver *next_driver(struct klist_iter *i)
> * so it doesn't disappear before returning to the caller.
> */
> int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
> - void *data, int (*fn)(struct device_driver *, void *))
> -{
> + void *data, int (*fn)(struct device_driver *, void *)) {

Maybe you re-sent your original patch?

> @@ -1092,7 +1095,8 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
> knode = klist_next(&iter->ki);
> if (!knode)
> return NULL;
> - dev = container_of(knode, struct device_private, knode_bus)->device;
> + dev = container_of(knode, struct device_private, knode_bus)
> + ->device;

That's not nice to read.
If it exceeds 80 columns, just leave it alone
or if it really bothers you, use a temporary
for container_of then dereference that.



--
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/