* [PATCH] nits: fix several coding style warnings
@ 2015-03-08 10:53 Ioana Antoche
2015-03-08 12:39 ` Greg KH
2015-03-08 22:14 ` Guennadi Liakhovetski
0 siblings, 2 replies; 5+ messages in thread
From: Ioana Antoche @ 2015-03-08 10:53 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Ioana Antoche
Fix checkpatch.pl warnings such as:
* missing blank line after declarations
* line over 80 characters
Signed-off-by: Ioana Antoche <ioana.antoche@gmail.com>
---
drivers/base/bus.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 876bae5..9e448e1 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -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 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);
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;
}
--
1.9.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nits: fix several coding style warnings
2015-03-08 10:53 [PATCH] nits: fix several coding style warnings Ioana Antoche
@ 2015-03-08 12:39 ` Greg KH
2015-03-08 16:20 ` Daniel Baluta
2015-03-08 22:14 ` Guennadi Liakhovetski
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2015-03-08 12:39 UTC (permalink / raw)
To: Ioana Antoche; +Cc: linux-kernel
On Sun, Mar 08, 2015 at 12:53:17PM +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@gmail.com>
The subject: of "nits" doesn't really say where in the kernel the
patch is for, please use "driver core" instead.
Can you please resend?
And was this part of a class project? I got about 10 of these all at
once, which is really odd.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nits: fix several coding style warnings
2015-03-08 12:39 ` Greg KH
@ 2015-03-08 16:20 ` Daniel Baluta
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Baluta @ 2015-03-08 16:20 UTC (permalink / raw)
To: Greg KH; +Cc: Ioana Antoche, Linux Kernel Mailing List
On Sun, Mar 8, 2015 at 2:39 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Sun, Mar 08, 2015 at 12:53:17PM +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@gmail.com>
>
> The subject: of "nits" doesn't really say where in the kernel the
> patch is for, please use "driver core" instead.
>
> Can you please resend?
>
> And was this part of a class project? I got about 10 of these all at
> once, which is really odd.
Hi Greg,
Once a year at University "POLITEHNICA" in Bucharest we have
an workshop called "Write your first Linux kernel patch".
This is inspired by your video:
https://www.youtube.com/watch?v=LLBrBBImJt4
thanks,
Daniel.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nits: fix several coding style warnings
2015-03-08 10:53 [PATCH] nits: fix several coding style warnings Ioana Antoche
2015-03-08 12:39 ` Greg KH
@ 2015-03-08 22:14 ` Guennadi Liakhovetski
2015-03-08 22:18 ` Joe Perches
1 sibling, 1 reply; 5+ messages in thread
From: Guennadi Liakhovetski @ 2015-03-08 22:14 UTC (permalink / raw)
To: Ioana Antoche; +Cc: gregkh, linux-kernel
On Sun, 8 Mar 2015, 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@gmail.com>
> ---
> drivers/base/bus.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index 876bae5..9e448e1 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -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 *)) {
Really curious: is this change (and a similar one below) really fixing a
style violation?
Thanks
Guennadi
> 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 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);
> 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;
> }
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nits: fix several coding style warnings
2015-03-08 22:14 ` Guennadi Liakhovetski
@ 2015-03-08 22:18 ` Joe Perches
0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2015-03-08 22:18 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: Ioana Antoche, gregkh, linux-kernel
On Sun, 2015-03-08 at 23:14 +0100, Guennadi Liakhovetski wrote:
> On Sun, 8 Mar 2015, Ioana Antoche wrote:
> > Fix checkpatch.pl warnings such as:
> > * missing blank line after declarations
> > * line over 80 characters
[]
> > @@ -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 *)) {
>
> Really curious: is this change (and a similar one below) really fixing a
> style violation?
Nope.
The "for_each" use in a function name confuses checkpatch.
Normally, those are macros.
> > @@ -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 *)) {
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-08 22:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-08 10:53 [PATCH] nits: fix several coding style warnings Ioana Antoche
2015-03-08 12:39 ` Greg KH
2015-03-08 16:20 ` Daniel Baluta
2015-03-08 22:14 ` Guennadi Liakhovetski
2015-03-08 22:18 ` Joe Perches
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®