Commit bd7d075a authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman

[PATCH] Driver Core: Whitespace fixes

Whitespace and formatting changes (a,b,c -> a, b, c) in drivers/base
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 2d586ba5
......@@ -6,12 +6,13 @@ extern void bus_remove_driver(struct device_driver *);
static inline struct class_device *to_class_dev(struct kobject *obj)
{
return container_of(obj,struct class_device,kobj);
return container_of(obj, struct class_device, kobj);
}
static inline
struct class_device_attribute *to_class_dev_attr(struct attribute *_attr)
{
return container_of(_attr,struct class_device_attribute,attr);
return container_of(_attr, struct class_device_attribute, attr);
}
......@@ -147,7 +147,7 @@ struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev,
s_dev->class_dev.dev = device;
s_dev->class_dev.class = &cs->class;
va_start(args,fmt);
va_start(args, fmt);
vsnprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, fmt, args);
va_end(args);
retval = class_device_register(&s_dev->class_dev);
......
......@@ -28,8 +28,8 @@ int (*platform_notify_remove)(struct device * dev) = NULL;
* sysfs bindings for devices.
*/
#define to_dev(obj) container_of(obj,struct device,kobj)
#define to_dev_attr(_attr) container_of(_attr,struct device_attribute,attr)
#define to_dev(obj) container_of(obj, struct device, kobj)
#define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr)
extern struct attribute * dev_default_attrs[];
......@@ -41,7 +41,7 @@ dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
ssize_t ret = 0;
if (dev_attr->show)
ret = dev_attr->show(dev,buf);
ret = dev_attr->show(dev, buf);
return ret;
}
......@@ -54,7 +54,7 @@ dev_attr_store(struct kobject * kobj, struct attribute * attr,
ssize_t ret = 0;
if (dev_attr->store)
ret = dev_attr->store(dev,buf,count);
ret = dev_attr->store(dev, buf, count);
return ret;
}
......@@ -153,7 +153,7 @@ int device_create_file(struct device * dev, struct device_attribute * attr)
{
int error = 0;
if (get_device(dev)) {
error = sysfs_create_file(&dev->kobj,&attr->attr);
error = sysfs_create_file(&dev->kobj, &attr->attr);
put_device(dev);
}
return error;
......@@ -168,7 +168,7 @@ int device_create_file(struct device * dev, struct device_attribute * attr)
void device_remove_file(struct device * dev, struct device_attribute * attr)
{
if (get_device(dev)) {
sysfs_remove_file(&dev->kobj,&attr->attr);
sysfs_remove_file(&dev->kobj, &attr->attr);
put_device(dev);
}
}
......@@ -187,7 +187,7 @@ void device_remove_file(struct device * dev, struct device_attribute * attr)
void device_initialize(struct device *dev)
{
kobj_set_kset_s(dev,devices_subsys);
kobj_set_kset_s(dev, devices_subsys);
kobject_init(&dev->kobj);
INIT_LIST_HEAD(&dev->node);
INIT_LIST_HEAD(&dev->children);
......@@ -221,7 +221,7 @@ int device_add(struct device *dev)
pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id);
/* first, register with generic layer. */
kobject_set_name(&dev->kobj,dev->bus_id);
kobject_set_name(&dev->kobj, dev->bus_id);
if (parent)
dev->kobj.parent = &parent->kobj;
......@@ -233,7 +233,7 @@ int device_add(struct device *dev)
goto BusError;
down_write(&devices_subsys.rwsem);
if (parent)
list_add_tail(&dev->node,&parent->children);
list_add_tail(&dev->node, &parent->children);
up_write(&devices_subsys.rwsem);
/* notify platform of device entry */
......@@ -370,8 +370,8 @@ int device_for_each_child(struct device * dev, void * data,
int error = 0;
down_read(&devices_subsys.rwsem);
list_for_each_entry(child,&dev->children,node) {
if((error = fn(child,data)))
list_for_each_entry(child, &dev->children, node) {
if((error = fn(child, data)))
break;
}
up_read(&devices_subsys.rwsem);
......
......@@ -15,8 +15,8 @@
#include <linux/string.h>
#include "base.h"
#define to_dev(node) container_of(node,struct device,driver_list)
#define to_drv(obj) container_of(obj,struct device_driver,kobj)
#define to_dev(node) container_of(node, struct device, driver_list)
#define to_drv(obj) container_of(obj, struct device_driver, kobj)
/**
* driver_create_file - create sysfs file for driver.
......@@ -28,7 +28,7 @@ int driver_create_file(struct device_driver * drv, struct driver_attribute * att
{
int error;
if (get_driver(drv)) {
error = sysfs_create_file(&drv->kobj,&attr->attr);
error = sysfs_create_file(&drv->kobj, &attr->attr);
put_driver(drv);
} else
error = -EINVAL;
......@@ -45,7 +45,7 @@ int driver_create_file(struct device_driver * drv, struct driver_attribute * att
void driver_remove_file(struct device_driver * drv, struct driver_attribute * attr)
{
if (get_driver(drv)) {
sysfs_remove_file(&drv->kobj,&attr->attr);
sysfs_remove_file(&drv->kobj, &attr->attr);
put_driver(drv);
}
}
......
......@@ -12,11 +12,11 @@
#include <linux/module.h>
#include <linux/init.h>
static decl_subsys(firmware,NULL,NULL);
static decl_subsys(firmware, NULL, NULL);
int firmware_register(struct subsystem * s)
{
kset_set_kset_s(s,firmware_subsys);
kset_set_kset_s(s, firmware_subsys);
return subsystem_register(s);
}
......
......@@ -29,20 +29,20 @@
static ssize_t detach_show(struct device * dev, char * buf)
{
return sprintf(buf,"%u\n",dev->detach_state);
return sprintf(buf, "%u\n", dev->detach_state);
}
static ssize_t detach_store(struct device * dev, const char * buf, size_t n)
{
u32 state;
state = simple_strtoul(buf,NULL,10);
state = simple_strtoul(buf, NULL, 10);
if (state > 4)
return -EINVAL;
dev->detach_state = state;
return n;
}
static DEVICE_ATTR(detach_state,0644,detach_show,detach_store);
static DEVICE_ATTR(detach_state, 0644, detach_show, detach_store);
struct attribute * dev_default_attrs[] = {
......
......@@ -29,7 +29,7 @@ static ssize_t node_read_cpumap(struct sys_device * dev, char * buf)
return len;
}
static SYSDEV_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL);
static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumap, NULL);
/* Can be overwritten by architecture specific code. */
int __attribute__((weak)) hugetlb_report_node_meminfo(int node, char *buf)
......@@ -54,17 +54,17 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
"Node %d LowFree: %8lu kB\n",
nid, K(i.totalram),
nid, K(i.freeram),
nid, K(i.totalram-i.freeram),
nid, K(i.totalram - i.freeram),
nid, K(i.totalhigh),
nid, K(i.freehigh),
nid, K(i.totalram-i.totalhigh),
nid, K(i.freeram-i.freehigh));
nid, K(i.totalram - i.totalhigh),
nid, K(i.freeram - i.freehigh));
n += hugetlb_report_node_meminfo(nid, buf + n);
return n;
}
#undef K
static SYSDEV_ATTR(meminfo,S_IRUGO,node_read_meminfo,NULL);
static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
{
......@@ -104,7 +104,7 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
local_node,
other_node);
}
static SYSDEV_ATTR(numastat,S_IRUGO,node_read_numastat,NULL);
static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
/*
* register_node - Setup a driverfs device for a node.
......
......@@ -123,7 +123,7 @@ int platform_device_register(struct platform_device * pdev)
strlcpy(pdev->dev.bus_id, pdev->name, BUS_ID_SIZE);
pr_debug("Registering platform device '%s'. Parent at %s\n",
pdev->dev.bus_id,pdev->dev.parent->bus_id);
pdev->dev.bus_id, pdev->dev.parent->bus_id);
return device_register(&pdev->dev);
}
......
......@@ -74,10 +74,10 @@ int device_pm_add(struct device * dev)
pr_debug("PM: Adding info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus", dev->kobj.name);
atomic_set(&dev->power.pm_users,0);
atomic_set(&dev->power.pm_users, 0);
down(&dpm_sem);
list_add_tail(&dev->power.entry,&dpm_active);
device_pm_set_parent(dev,dev->parent);
list_add_tail(&dev->power.entry, &dpm_active);
device_pm_set_parent(dev, dev->parent);
if ((error = dpm_sysfs_add(dev)))
list_del(&dev->power.entry);
up(&dpm_sem);
......
......@@ -37,12 +37,12 @@ extern struct list_head dpm_off_irq;
static inline struct dev_pm_info * to_pm_info(struct list_head * entry)
{
return container_of(entry,struct dev_pm_info,entry);
return container_of(entry, struct dev_pm_info, entry);
}
static inline struct device * to_device(struct list_head * entry)
{
return container_of(to_pm_info(entry),struct device,power);
return container_of(to_pm_info(entry), struct device, power);
}
extern int device_pm_add(struct device *);
......
......@@ -39,7 +39,7 @@ void dpm_resume(void)
if (!dev->power.prev_state)
resume_device(dev);
list_add_tail(entry,&dpm_active);
list_add_tail(entry, &dpm_active);
}
}
......@@ -78,7 +78,7 @@ void dpm_power_up(void)
struct list_head * entry = dpm_off_irq.next;
list_del_init(entry);
resume_device(to_device(entry));
list_add_tail(entry,&dpm_active);
list_add_tail(entry, &dpm_active);
}
}
......
......@@ -55,7 +55,7 @@ int dpm_runtime_suspend(struct device * dev, u32 state)
if (dev->power.power_state)
runtime_resume(dev);
if (!(error = suspend_device(dev,state)))
if (!(error = suspend_device(dev, state)))
dev->power.power_state = state;
Done:
up(&dpm_sem);
......
......@@ -14,7 +14,7 @@
#include "power.h"
#define to_dev(node) container_of(node,struct device,kobj.entry)
#define to_dev(node) container_of(node, struct device, kobj.entry)
extern struct subsystem devices_subsys;
......@@ -29,7 +29,7 @@ int device_detach_shutdown(struct device * dev)
dev->driver->shutdown(dev);
return 0;
}
return dpm_runtime_suspend(dev,dev->detach_state);
return dpm_runtime_suspend(dev, dev->detach_state);
}
......@@ -52,8 +52,8 @@ void device_shutdown(void)
struct device * dev;
down_write(&devices_subsys.rwsem);
list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
pr_debug("shutting down %s: ",dev->bus_id);
list_for_each_entry_reverse(dev, &devices_subsys.kset.list, kobj.entry) {
pr_debug("shutting down %s: ", dev->bus_id);
if (dev->driver && dev->driver->shutdown) {
pr_debug("Ok\n");
dev->driver->shutdown(dev);
......
......@@ -44,7 +44,7 @@ int suspend_device(struct device * dev, u32 state)
dev->power.prev_state = dev->power.power_state;
if (dev->bus && dev->bus->suspend && !dev->power.power_state)
error = dev->bus->suspend(dev,state);
error = dev->bus->suspend(dev, state);
return error;
}
......@@ -78,14 +78,14 @@ int device_suspend(u32 state)
while(!list_empty(&dpm_active)) {
struct list_head * entry = dpm_active.prev;
struct device * dev = to_device(entry);
error = suspend_device(dev,state);
error = suspend_device(dev, state);
if (!error) {
list_del(&dev->power.entry);
list_add(&dev->power.entry,&dpm_off);
list_add(&dev->power.entry, &dpm_off);
} else if (error == -EAGAIN) {
list_del(&dev->power.entry);
list_add(&dev->power.entry,&dpm_off_irq);
list_add(&dev->power.entry, &dpm_off_irq);
} else {
printk(KERN_ERR "Could not suspend device %s: "
"error %d\n", kobject_name(&dev->kobj), error);
......@@ -117,8 +117,8 @@ int device_power_down(u32 state)
int error = 0;
struct device * dev;
list_for_each_entry_reverse(dev,&dpm_off_irq,power.entry) {
if ((error = suspend_device(dev,state)))
list_for_each_entry_reverse(dev, &dpm_off_irq, power.entry) {
if ((error = suspend_device(dev, state)))
break;
}
if (error)
......
......@@ -26,7 +26,7 @@
static ssize_t state_show(struct device * dev, char * buf)
{
return sprintf(buf,"%u\n",dev->power.power_state);
return sprintf(buf, "%u\n", dev->power.power_state);
}
static ssize_t state_store(struct device * dev, const char * buf, size_t n)
......@@ -35,17 +35,17 @@ static ssize_t state_store(struct device * dev, const char * buf, size_t n)
char * rest;
int error = 0;
state = simple_strtoul(buf,&rest,10);
state = simple_strtoul(buf, &rest, 10);
if (*rest)
return -EINVAL;
if (state)
error = dpm_runtime_suspend(dev,state);
error = dpm_runtime_suspend(dev, state);
else
dpm_runtime_resume(dev);
return error ? error : n;
}
static DEVICE_ATTR(state,0644,state_show,state_store);
static DEVICE_ATTR(state, 0644, state_show, state_store);
static struct attribute * power_attrs[] = {
......@@ -59,10 +59,10 @@ static struct attribute_group pm_attr_group = {
int dpm_sysfs_add(struct device * dev)
{
return sysfs_create_group(&dev->kobj,&pm_attr_group);
return sysfs_create_group(&dev->kobj, &pm_attr_group);
}
void dpm_sysfs_remove(struct device * dev)
{
sysfs_remove_group(&dev->kobj,&pm_attr_group);
sysfs_remove_group(&dev->kobj, &pm_attr_group);
}
......@@ -24,8 +24,8 @@
extern struct subsystem devices_subsys;
#define to_sysdev(k) container_of(k,struct sys_device,kobj)
#define to_sysdev_attr(a) container_of(a,struct sysdev_attribute,attr)
#define to_sysdev(k) container_of(k, struct sys_device, kobj)
#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr)
static ssize_t
......@@ -35,7 +35,7 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer)
struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr);
if (sysdev_attr->show)
return sysdev_attr->show(sysdev,buffer);
return sysdev_attr->show(sysdev, buffer);
return 0;
}
......@@ -48,7 +48,7 @@ sysdev_store(struct kobject * kobj, struct attribute * attr,
struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr);
if (sysdev_attr->store)
return sysdev_attr->store(sysdev,buffer,count);
return sysdev_attr->store(sysdev, buffer, count);
return 0;
}
......@@ -64,13 +64,13 @@ static struct kobj_type ktype_sysdev = {
int sysdev_create_file(struct sys_device * s, struct sysdev_attribute * a)
{
return sysfs_create_file(&s->kobj,&a->attr);
return sysfs_create_file(&s->kobj, &a->attr);
}
void sysdev_remove_file(struct sys_device * s, struct sysdev_attribute * a)
{
sysfs_remove_file(&s->kobj,&a->attr);
sysfs_remove_file(&s->kobj, &a->attr);
}
EXPORT_SYMBOL(sysdev_create_file);
......@@ -79,7 +79,7 @@ EXPORT_SYMBOL(sysdev_remove_file);
/*
* declare system_subsys
*/
decl_subsys(system,&ktype_sysdev,NULL);
decl_subsys(system, &ktype_sysdev, NULL);
int sysdev_class_register(struct sysdev_class * cls)
{
......@@ -87,7 +87,7 @@ int sysdev_class_register(struct sysdev_class * cls)
kobject_name(&cls->kset.kobj));
INIT_LIST_HEAD(&cls->drivers);
cls->kset.subsys = &system_subsys;
kset_set_kset_s(cls,system_subsys);
kset_set_kset_s(cls, system_subsys);
return kset_register(&cls->kset);
}
......@@ -121,7 +121,7 @@ int sysdev_driver_register(struct sysdev_class * cls,
{
down_write(&system_subsys.rwsem);
if (cls && kset_get(&cls->kset)) {
list_add_tail(&drv->entry,&cls->drivers);
list_add_tail(&drv->entry, &cls->drivers);
/* If devices of this class already exist, tell the driver */
if (drv->add) {
......@@ -130,7 +130,7 @@ int sysdev_driver_register(struct sysdev_class * cls,
drv->add(dev);
}
} else
list_add_tail(&drv->entry,&global_drivers);
list_add_tail(&drv->entry, &global_drivers);
up_write(&system_subsys.rwsem);
return 0;
}
......@@ -180,12 +180,12 @@ int sysdev_register(struct sys_device * sysdev)
/* But make sure we point to the right type for sysfs translation */
sysdev->kobj.ktype = &ktype_sysdev;
error = kobject_set_name(&sysdev->kobj,"%s%d",
kobject_name(&cls->kset.kobj),sysdev->id);
error = kobject_set_name(&sysdev->kobj, "%s%d",
kobject_name(&cls->kset.kobj), sysdev->id);
if (error)
return error;
pr_debug("Registering sys device '%s'\n",kobject_name(&sysdev->kobj));
pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj));
/* Register the object */
error = kobject_register(&sysdev->kobj);
......@@ -199,13 +199,13 @@ int sysdev_register(struct sys_device * sysdev)
*/
/* Notify global drivers */
list_for_each_entry(drv,&global_drivers,entry) {
list_for_each_entry(drv, &global_drivers, entry) {
if (drv->add)
drv->add(sysdev);
}
/* Notify class auxillary drivers */
list_for_each_entry(drv,&cls->drivers,entry) {
list_for_each_entry(drv, &cls->drivers, entry) {
if (drv->add)
drv->add(sysdev);
}
......@@ -219,12 +219,12 @@ void sysdev_unregister(struct sys_device * sysdev)
struct sysdev_driver * drv;
down_write(&system_subsys.rwsem);
list_for_each_entry(drv,&global_drivers,entry) {
list_for_each_entry(drv, &global_drivers, entry) {
if (drv->remove)
drv->remove(sysdev);
}
list_for_each_entry(drv,&sysdev->cls->drivers,entry) {
list_for_each_entry(drv, &sysdev->cls->drivers, entry) {
if (drv->remove)
drv->remove(sysdev);
}
......@@ -256,25 +256,25 @@ void sysdev_shutdown(void)
pr_debug("Shutting Down System Devices\n");
down_write(&system_subsys.rwsem);
list_for_each_entry_reverse(cls,&system_subsys.kset.list,
list_for_each_entry_reverse(cls, &system_subsys.kset.list,
kset.kobj.entry) {
struct sys_device * sysdev;
pr_debug("Shutting down type '%s':\n",
kobject_name(&cls->kset.kobj));
list_for_each_entry(sysdev,&cls->kset.list,kobj.entry) {
list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) {
struct sysdev_driver * drv;
pr_debug(" %s\n",kobject_name(&sysdev->kobj));
pr_debug(" %s\n", kobject_name(&sysdev->kobj));
/* Call global drivers first. */
list_for_each_entry(drv,&global_drivers,entry) {
list_for_each_entry(drv, &global_drivers, entry) {
if (drv->shutdown)
drv->shutdown(sysdev);
}
/* Call auxillary drivers next. */
list_for_each_entry(drv,&cls->drivers,entry) {
list_for_each_entry(drv, &cls->drivers, entry) {
if (drv->shutdown)
drv->shutdown(sysdev);
}
......@@ -307,32 +307,32 @@ int sysdev_suspend(u32 state)
pr_debug("Suspending System Devices\n");
list_for_each_entry_reverse(cls,&system_subsys.kset.list,
list_for_each_entry_reverse(cls, &system_subsys.kset.list,
kset.kobj.entry) {
struct sys_device * sysdev;
pr_debug("Suspending type '%s':\n",
kobject_name(&cls->kset.kobj));
list_for_each_entry(sysdev,&cls->kset.list,kobj.entry) {
list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) {
struct sysdev_driver * drv;
pr_debug(" %s\n",kobject_name(&sysdev->kobj));
pr_debug(" %s\n", kobject_name(&sysdev->kobj));
/* Call global drivers first. */
list_for_each_entry(drv,&global_drivers,entry) {
list_for_each_entry(drv, &global_drivers, entry) {
if (drv->suspend)
drv->suspend(sysdev,state);
drv->suspend(sysdev, state);
}
/* Call auxillary drivers next. */
list_for_each_entry(drv,&cls->drivers,entry) {
list_for_each_entry(drv, &cls->drivers, entry) {
if (drv->suspend)
drv->suspend(sysdev,state);
drv->suspend(sysdev, state);
}
/* Now call the generic one */
if (cls->suspend)
cls->suspend(sysdev,state);
cls->suspend(sysdev, state);
}
}
return 0;
......@@ -354,28 +354,28 @@ int sysdev_resume(void)
pr_debug("Resuming System Devices\n");
list_for_each_entry(cls,&system_subsys.kset.list,kset.kobj.entry) {
list_for_each_entry(cls, &system_subsys.kset.list, kset.kobj.entry) {
struct sys_device * sysdev;
pr_debug("Resuming type '%s':\n",
kobject_name(&cls->kset.kobj));
list_for_each_entry(sysdev,&cls->kset.list,kobj.entry) {
list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) {
struct sysdev_driver * drv;
pr_debug(" %s\n",kobject_name(&sysdev->kobj));
pr_debug(" %s\n", kobject_name(&sysdev->kobj));
/* First, call the class-specific one */
if (cls->resume)
cls->resume(sysdev);
/* Call auxillary drivers next. */
list_for_each_entry(drv,&cls->drivers,entry) {
list_for_each_entry(drv, &cls->drivers, entry) {
if (drv->resume)
drv->resume(sysdev);
}
/* Call global drivers. */
list_for_each_entry(drv,&global_drivers,entry) {
list_for_each_entry(drv, &global_drivers, entry) {
if (drv->resume)
drv->resume(sysdev);
}
......
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