Commit 3499c9eb authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Driver Core: more whitespace fixups

This catches the files I had to do by hand as Dmitry's patch differed from my tree.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent bd7d075a
......@@ -17,17 +17,17 @@
#include "base.h"
#include "power/power.h"
#define to_dev(node) container_of(node,struct device,bus_list)
#define to_drv(node) container_of(node,struct device_driver,kobj.entry)
#define to_dev(node) container_of(node, struct device, bus_list)
#define to_drv(node) container_of(node, struct device_driver, kobj.entry)
#define to_bus_attr(_attr) container_of(_attr,struct bus_attribute,attr)
#define to_bus(obj) container_of(obj,struct bus_type,subsys.kset.kobj)
#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
#define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj)
/*
* sysfs bindings for drivers
*/
#define to_drv_attr(_attr) container_of(_attr,struct driver_attribute,attr)
#define to_drv_attr(_attr) container_of(_attr, struct driver_attribute, attr)
#define to_driver(obj) container_of(obj, struct device_driver, kobj)
......@@ -39,7 +39,7 @@ drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
ssize_t ret = 0;
if (drv_attr->show)
ret = drv_attr->show(drv,buf);
ret = drv_attr->show(drv, buf);
return ret;
}
......@@ -52,7 +52,7 @@ drv_attr_store(struct kobject * kobj, struct attribute * attr,
ssize_t ret = 0;
if (drv_attr->store)
ret = drv_attr->store(drv,buf,count);
ret = drv_attr->store(drv, buf, count);
return ret;
}
......@@ -87,7 +87,7 @@ bus_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
ssize_t ret = 0;
if (bus_attr->show)
ret = bus_attr->show(bus,buf);
ret = bus_attr->show(bus, buf);
return ret;
}
......@@ -100,7 +100,7 @@ bus_attr_store(struct kobject * kobj, struct attribute * attr,
ssize_t ret = 0;
if (bus_attr->store)
ret = bus_attr->store(bus,buf,count);
ret = bus_attr->store(bus, buf, count);
return ret;
}
......@@ -113,7 +113,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
{
int error;
if (get_bus(bus)) {
error = sysfs_create_file(&bus->subsys.kset.kobj,&attr->attr);
error = sysfs_create_file(&bus->subsys.kset.kobj, &attr->attr);
put_bus(bus);
} else
error = -EINVAL;
......@@ -123,7 +123,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
{
if (get_bus(bus)) {
sysfs_remove_file(&bus->subsys.kset.kobj,&attr->attr);
sysfs_remove_file(&bus->subsys.kset.kobj, &attr->attr);
put_bus(bus);
}
}
......@@ -133,7 +133,7 @@ static struct kobj_type ktype_bus = {
};
decl_subsys(bus,&ktype_bus,NULL);
decl_subsys(bus, &ktype_bus, NULL);
/**
* bus_for_each_dev - device iterator.
......@@ -170,7 +170,7 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start,
down_read(&bus->subsys.rwsem);
list_for_each_entry_continue(dev, head, bus_list) {
get_device(dev);
error = fn(dev,data);
error = fn(dev, data);
put_device(dev);
if (error)
break;
......@@ -216,7 +216,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
down_read(&bus->subsys.rwsem);
list_for_each_entry_continue(drv, head, kobj.entry) {
get_driver(drv);
error = fn(drv,data);
error = fn(drv, data);
put_driver(drv);
if(error)
break;
......@@ -242,9 +242,9 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
void device_bind_driver(struct device * dev)
{
pr_debug("bound device '%s' to driver '%s'\n",
dev->bus_id,dev->driver->name);
list_add_tail(&dev->driver_list,&dev->driver->devices);
sysfs_create_link(&dev->driver->kobj,&dev->kobj,
dev->bus_id, dev->driver->name);
list_add_tail(&dev->driver_list, &dev->driver->devices);
sysfs_create_link(&dev->driver->kobj, &dev->kobj,
kobject_name(&dev->kobj));
}
......@@ -266,7 +266,7 @@ void device_bind_driver(struct device * dev)
static int bus_match(struct device * dev, struct device_driver * drv)
{
int error = -ENODEV;
if (dev->bus->match(dev,drv)) {
if (dev->bus->match(dev, drv)) {
dev->driver = drv;
if (drv->probe) {
if ((error = drv->probe(dev))) {
......@@ -300,10 +300,10 @@ static int device_attach(struct device * dev)
}
if (bus->match) {
list_for_each(entry,&bus->drivers.list) {
list_for_each(entry, &bus->drivers.list) {
struct device_driver * drv = to_drv(entry);
error = bus_match(dev,drv);
if (!error )
error = bus_match(dev, drv);
if (!error)
/* success, driver matched */
return 1;
if (error != -ENODEV)
......@@ -339,10 +339,10 @@ void driver_attach(struct device_driver * drv)
if (!bus->match)
return;
list_for_each(entry,&bus->devices.list) {
struct device * dev = container_of(entry,struct device,bus_list);
list_for_each(entry, &bus->devices.list) {
struct device * dev = container_of(entry, struct device, bus_list);
if (!dev->driver) {
error = bus_match(dev,drv);
error = bus_match(dev, drv);
if (error && (error != -ENODEV))
/* driver matched but the probe failed */
printk(KERN_WARNING
......@@ -367,7 +367,7 @@ void device_release_driver(struct device * dev)
{
struct device_driver * drv = dev->driver;
if (drv) {
sysfs_remove_link(&drv->kobj,kobject_name(&dev->kobj));
sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj));
list_del_init(&dev->driver_list);
device_detach_shutdown(dev);
if (drv->remove)
......@@ -385,11 +385,10 @@ void device_release_driver(struct device * dev)
static void driver_detach(struct device_driver * drv)
{
struct list_head * entry, * next;
list_for_each_safe(entry,next,&drv->devices) {
struct device * dev = container_of(entry,struct device,driver_list);
list_for_each_safe(entry, next, &drv->devices) {
struct device * dev = container_of(entry, struct device, driver_list);
device_release_driver(dev);
}
}
static int device_add_attrs(struct bus_type * bus, struct device * dev)
......@@ -439,12 +438,12 @@ int bus_add_device(struct device * dev)
if (bus) {
down_write(&dev->bus->subsys.rwsem);
pr_debug("bus %s: add device %s\n",bus->name,dev->bus_id);
list_add_tail(&dev->bus_list,&dev->bus->devices.list);
pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
list_add_tail(&dev->bus_list, &dev->bus->devices.list);
device_attach(dev);
up_write(&dev->bus->subsys.rwsem);
device_add_attrs(bus,dev);
sysfs_create_link(&bus->devices.kobj,&dev->kobj,dev->bus_id);
device_add_attrs(bus, dev);
sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
}
return error;
}
......@@ -461,10 +460,10 @@ int bus_add_device(struct device * dev)
void bus_remove_device(struct device * dev)
{
if (dev->bus) {
sysfs_remove_link(&dev->bus->devices.kobj,dev->bus_id);
device_remove_attrs(dev->bus,dev);
sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
device_remove_attrs(dev->bus, dev);
down_write(&dev->bus->subsys.rwsem);
pr_debug("bus %s: remove device %s\n",dev->bus->name,dev->bus_id);
pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
device_release_driver(dev);
list_del_init(&dev->bus_list);
up_write(&dev->bus->subsys.rwsem);
......@@ -484,8 +483,8 @@ int bus_add_driver(struct device_driver * drv)
int error = 0;
if (bus) {
pr_debug("bus %s: add driver %s\n",bus->name,drv->name);
error = kobject_set_name(&drv->kobj,drv->name);
pr_debug("bus %s: add driver %s\n", bus->name, drv->name);
error = kobject_set_name(&drv->kobj, drv->name);
if (error) {
put_bus(bus);
return error;
......@@ -518,7 +517,7 @@ void bus_remove_driver(struct device_driver * drv)
{
if (drv->bus) {
down_write(&drv->bus->subsys.rwsem);
pr_debug("bus %s: remove driver %s\n",drv->bus->name,drv->name);
pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
driver_detach(drv);
up_write(&drv->bus->subsys.rwsem);
kobject_unregister(&drv->kobj);
......@@ -560,7 +559,7 @@ int bus_rescan_devices(struct bus_type * bus)
struct bus_type * get_bus(struct bus_type * bus)
{
return bus ? container_of(subsys_get(&bus->subsys),struct bus_type,subsys) : NULL;
return bus ? container_of(subsys_get(&bus->subsys), struct bus_type, subsys) : NULL;
}
void put_bus(struct bus_type * bus)
......@@ -579,7 +578,7 @@ void put_bus(struct bus_type * bus)
struct bus_type * find_bus(char * name)
{
struct kobject * k = kset_find_obj(&bus_subsys.kset,name);
struct kobject * k = kset_find_obj(&bus_subsys.kset, name);
return k ? to_bus(k) : NULL;
}
......@@ -630,11 +629,11 @@ int bus_register(struct bus_type * bus)
{
int retval;
retval = kobject_set_name(&bus->subsys.kset.kobj,bus->name);
retval = kobject_set_name(&bus->subsys.kset.kobj, bus->name);
if (retval)
goto out;
subsys_set_kset(bus,bus_subsys);
subsys_set_kset(bus, bus_subsys);
retval = subsystem_register(&bus->subsys);
if (retval)
goto out;
......@@ -653,7 +652,7 @@ int bus_register(struct bus_type * bus)
goto bus_drivers_fail;
bus_add_attrs(bus);
pr_debug("bus type '%s' registered\n",bus->name);
pr_debug("bus type '%s' registered\n", bus->name);
return 0;
bus_drivers_fail:
......@@ -674,7 +673,7 @@ int bus_register(struct bus_type * bus)
*/
void bus_unregister(struct bus_type * bus)
{
pr_debug("bus %s: unregistering\n",bus->name);
pr_debug("bus %s: unregistering\n", bus->name);
bus_remove_attrs(bus);
kset_unregister(&bus->drivers);
kset_unregister(&bus->devices);
......
......@@ -17,8 +17,8 @@
#include <linux/string.h>
#include "base.h"
#define to_class_attr(_attr) container_of(_attr,struct class_attribute,attr)
#define to_class(obj) container_of(obj,struct class,subsys.kset.kobj)
#define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
#define to_class(obj) container_of(obj, struct class, subsys.kset.kobj)
static ssize_t
class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
......@@ -28,7 +28,7 @@ class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
ssize_t ret = 0;
if (class_attr->show)
ret = class_attr->show(dc,buf);
ret = class_attr->show(dc, buf);
return ret;
}
......@@ -41,7 +41,7 @@ class_attr_store(struct kobject * kobj, struct attribute * attr,
ssize_t ret = 0;
if (class_attr->store)
ret = class_attr->store(dc,buf,count);
ret = class_attr->store(dc, buf, count);
return ret;
}
......@@ -69,14 +69,14 @@ static struct kobj_type ktype_class = {
};
/* Hotplug events for classes go to the class_obj subsys */
static decl_subsys(class,&ktype_class,NULL);
static decl_subsys(class, &ktype_class, NULL);
int class_create_file(struct class * cls, const struct class_attribute * attr)
{
int error;
if (cls) {
error = sysfs_create_file(&cls->subsys.kset.kobj,&attr->attr);
error = sysfs_create_file(&cls->subsys.kset.kobj, &attr->attr);
} else
error = -EINVAL;
return error;
......@@ -85,13 +85,13 @@ int class_create_file(struct class * cls, const struct class_attribute * attr)
void class_remove_file(struct class * cls, const struct class_attribute * attr)
{
if (cls)
sysfs_remove_file(&cls->subsys.kset.kobj,&attr->attr);
sysfs_remove_file(&cls->subsys.kset.kobj, &attr->attr);
}
struct class * class_get(struct class * cls)
{
if (cls)
return container_of(subsys_get(&cls->subsys),struct class,subsys);
return container_of(subsys_get(&cls->subsys), struct class, subsys);
return NULL;
}
......@@ -135,15 +135,15 @@ int class_register(struct class * cls)
{
int error;
pr_debug("device class '%s': registering\n",cls->name);
pr_debug("device class '%s': registering\n", cls->name);
INIT_LIST_HEAD(&cls->children);
INIT_LIST_HEAD(&cls->interfaces);
error = kobject_set_name(&cls->subsys.kset.kobj,cls->name);
error = kobject_set_name(&cls->subsys.kset.kobj, cls->name);
if (error)
return error;
subsys_set_kset(cls,class_subsys);
subsys_set_kset(cls, class_subsys);
error = subsystem_register(&cls->subsys);
if (!error) {
......@@ -155,7 +155,7 @@ int class_register(struct class * cls)
void class_unregister(struct class * cls)
{
pr_debug("device class '%s': unregistering\n",cls->name);
pr_debug("device class '%s': unregistering\n", cls->name);
remove_class_attrs(cls);
subsystem_unregister(&cls->subsys);
}
......@@ -215,7 +215,7 @@ class_device_attr_show(struct kobject * kobj, struct attribute * attr,
ssize_t ret = 0;
if (class_dev_attr->show)
ret = class_dev_attr->show(cd,buf);
ret = class_dev_attr->show(cd, buf);
return ret;
}
......@@ -228,7 +228,7 @@ class_device_attr_store(struct kobject * kobj, struct attribute * attr,
ssize_t ret = 0;
if (class_dev_attr->store)
ret = class_dev_attr->store(cd,buf,count);
ret = class_dev_attr->store(cd, buf, count);
return ret;
}
......@@ -242,7 +242,7 @@ static void class_dev_release(struct kobject * kobj)
struct class_device *cd = to_class_dev(kobj);
struct class * cls = cd->class;
pr_debug("device class '%s': release.\n",cd->class_id);
pr_debug("device class '%s': release.\n", cd->class_id);
if (cls->release)
cls->release(cd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment