driver core: fix several coding style warnings
PATCH v2 1/1 driver core: fix several coding style warnings
Fix checkpatch.pl warnings such as:
* missing blank line after declarations
* line over 80 characters
---
* undo changes related to "ERROR: that open brace { should be on the previous line". This is a checkpatch defect
* fixed commit message as suggested by Greg.
drivers/base/bus.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/base/bus.c +14 -10
@@ -128,6 +128,7 @@ static const struct sysfs_ops bus_sysfs_ops = {int bus_create_file (struct bus_type *bus,struct bus_attribute *attr) {int error; +if (bus_get (bus)) { error =sysfs_create_file (&bus->p->subsys.kobj, &attr->attr);bus_put (bus);
@@ -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 *)) {struct klist_iter i;struct device *dev;int error =0 ;
@@ -385,8 +385,8 @@ EXPORT_SYMBOL_GPL(bus_find_device_by_name);* otherwise, fall back to a full list search. Either way a reference for * the returned object is taken. */ -struct device *subsys_find_device_by_id (struct bus_type *subsys,unsigned int id, -struct device *hint) +struct device *subsys_find_device_by_id (struct bus_type *subsys, +unsigned int id,struct device *hint) {struct klist_iter i;struct device *dev;
@@ -395,7 +395,8 @@ struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int idreturn 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); dev =next_device (&i);if (dev && dev->id == id &&get_device (dev)) {klist_iter_exit (&i);
@@ -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 *)) {struct klist_iter i;struct device_driver *drv;int error =0 ;
@@ -509,7 +509,8 @@ int bus_add_device(struct device *dev)int error =0 ;if (bus) { -pr_debug ("bus: '%s': add device %s\n" , bus->name,dev_name (dev)); +pr_debug ("bus: '%s': add device %s\n" , bus->name, +dev_name (dev)); error =device_add_attrs (bus, dev);if (error) goto out_put;
@@ -819,6 +820,7 @@ EXPORT_SYMBOL_GPL(device_reprobe);struct bus_type *find_bus (char *name) {struct kobject *k =kset_find_obj (bus_kset, name); +return k ?to_bus (k) :NULL ; }#endif /* 0 */
@@ -1000,7 +1002,8 @@ EXPORT_SYMBOL_GPL(bus_get_device_klist);* holding the lock for the list, so objects can't otherwise be * added/removed while we're swizzling. */ -static void device_insertion_sort_klist (struct device *a,struct list_head *list, +static void device_insertion_sort_klist (struct device *a, +struct list_head *list,int (*compare)(const struct device *a,const struct device *b)) {
@@ -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;if (!iter->type || iter->type == dev->type)return dev; }
Signature · 1 line
1.9.1
Quoted 7 lines · Ioana Antoche
Fix checkpatch.pl warnings such as:
* missing blank line after declarations
* line over 80 charactersSigned-off-by Ioana Antoche <[email protected]>---
* undo changes related to "ERROR: that open brace { should be on the previous line".
Not quite.
drivers/base/bus.c static struct device *next_device(struct klist_iter *i) · line 302
Quoted 9 lines
drivers/base/bus.c +1
-2@@ -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.
drivers/base/bus.c struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id · line 399
Quoted 7 lines
drivers/base/bus.c +2
-1@@ -395,7 +395,8 @@ struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int idreturn 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);
drivers/base/bus.c static struct device_driver *next_driver(struct klist_iter *i) · line 452
Quoted 7 lines
drivers/base/bus.c +1
-2@@ -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?
drivers/base/bus.c struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter) · line 1099
Quoted 7 lines
drivers/base/bus.c +2
-1@@ -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.