Commit 60530afe authored by Zhenwen Xu's avatar Zhenwen Xu Committed by Greg Kroah-Hartman

Driver core: some cleanup on drivers/base/sys.c

do some cleanup on drivers/base/sys.c
Signed-off-by: default avatarZhenwen Xu <helight.xu@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f67f129e
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
static ssize_t static ssize_t
sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) sysdev_show(struct kobject *kobj, struct attribute *attr, char *buffer)
{ {
struct sys_device * sysdev = to_sysdev(kobj); struct sys_device *sysdev = to_sysdev(kobj);
struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr);
if (sysdev_attr->show) if (sysdev_attr->show)
return sysdev_attr->show(sysdev, sysdev_attr, buffer); return sysdev_attr->show(sysdev, sysdev_attr, buffer);
...@@ -42,11 +42,11 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) ...@@ -42,11 +42,11 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer)
static ssize_t static ssize_t
sysdev_store(struct kobject * kobj, struct attribute * attr, sysdev_store(struct kobject *kobj, struct attribute *attr,
const char * buffer, size_t count) const char *buffer, size_t count)
{ {
struct sys_device * sysdev = to_sysdev(kobj); struct sys_device *sysdev = to_sysdev(kobj);
struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr);
if (sysdev_attr->store) if (sysdev_attr->store)
return sysdev_attr->store(sysdev, sysdev_attr, buffer, count); return sysdev_attr->store(sysdev, sysdev_attr, buffer, count);
...@@ -63,13 +63,13 @@ static struct kobj_type ktype_sysdev = { ...@@ -63,13 +63,13 @@ static struct kobj_type ktype_sysdev = {
}; };
int sysdev_create_file(struct sys_device * s, struct sysdev_attribute * a) 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) 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);
} }
...@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(sysdev_remove_file); ...@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(sysdev_remove_file);
static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr,
char *buffer) char *buffer)
{ {
struct sysdev_class * class = to_sysdev_class(kobj); struct sysdev_class *class = to_sysdev_class(kobj);
struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
if (class_attr->show) if (class_attr->show)
...@@ -95,8 +95,8 @@ static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, ...@@ -95,8 +95,8 @@ static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr,
static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr, static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,
const char *buffer, size_t count) const char *buffer, size_t count)
{ {
struct sysdev_class * class = to_sysdev_class(kobj); struct sysdev_class *class = to_sysdev_class(kobj);
struct sysdev_class_attribute * class_attr = to_sysdev_class_attr(attr); struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
if (class_attr->store) if (class_attr->store)
return class_attr->store(class, buffer, count); return class_attr->store(class, buffer, count);
...@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_remove_file); ...@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_remove_file);
static struct kset *system_kset; static struct kset *system_kset;
int sysdev_class_register(struct sysdev_class * cls) int sysdev_class_register(struct sysdev_class *cls)
{ {
pr_debug("Registering sysdev class '%s'\n", cls->name); pr_debug("Registering sysdev class '%s'\n", cls->name);
...@@ -141,7 +141,7 @@ int sysdev_class_register(struct sysdev_class * cls) ...@@ -141,7 +141,7 @@ int sysdev_class_register(struct sysdev_class * cls)
return kset_register(&cls->kset); return kset_register(&cls->kset);
} }
void sysdev_class_unregister(struct sysdev_class * cls) void sysdev_class_unregister(struct sysdev_class *cls)
{ {
pr_debug("Unregistering sysdev class '%s'\n", pr_debug("Unregistering sysdev class '%s'\n",
kobject_name(&cls->kset.kobj)); kobject_name(&cls->kset.kobj));
...@@ -203,8 +203,8 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) ...@@ -203,8 +203,8 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
* @cls: Class driver belongs to. * @cls: Class driver belongs to.
* @drv: Driver. * @drv: Driver.
*/ */
void sysdev_driver_unregister(struct sysdev_class * cls, void sysdev_driver_unregister(struct sysdev_class *cls,
struct sysdev_driver * drv) struct sysdev_driver *drv)
{ {
mutex_lock(&sysdev_drivers_lock); mutex_lock(&sysdev_drivers_lock);
list_del_init(&drv->entry); list_del_init(&drv->entry);
...@@ -229,10 +229,10 @@ EXPORT_SYMBOL_GPL(sysdev_driver_unregister); ...@@ -229,10 +229,10 @@ EXPORT_SYMBOL_GPL(sysdev_driver_unregister);
* @sysdev: device in question * @sysdev: device in question
* *
*/ */
int sysdev_register(struct sys_device * sysdev) int sysdev_register(struct sys_device *sysdev)
{ {
int error; int error;
struct sysdev_class * cls = sysdev->cls; struct sysdev_class *cls = sysdev->cls;
if (!cls) if (!cls)
return -EINVAL; return -EINVAL;
...@@ -252,7 +252,7 @@ int sysdev_register(struct sys_device * sysdev) ...@@ -252,7 +252,7 @@ int sysdev_register(struct sys_device * sysdev)
sysdev->id); sysdev->id);
if (!error) { if (!error) {
struct sysdev_driver * drv; struct sysdev_driver *drv;
pr_debug("Registering sys device '%s'\n", pr_debug("Registering sys device '%s'\n",
kobject_name(&sysdev->kobj)); kobject_name(&sysdev->kobj));
...@@ -274,9 +274,9 @@ int sysdev_register(struct sys_device * sysdev) ...@@ -274,9 +274,9 @@ int sysdev_register(struct sys_device * sysdev)
return error; return error;
} }
void sysdev_unregister(struct sys_device * sysdev) void sysdev_unregister(struct sys_device *sysdev)
{ {
struct sysdev_driver * drv; struct sysdev_driver *drv;
mutex_lock(&sysdev_drivers_lock); mutex_lock(&sysdev_drivers_lock);
list_for_each_entry(drv, &sysdev->cls->drivers, entry) { list_for_each_entry(drv, &sysdev->cls->drivers, entry) {
...@@ -305,19 +305,19 @@ void sysdev_unregister(struct sys_device * sysdev) ...@@ -305,19 +305,19 @@ void sysdev_unregister(struct sys_device * sysdev)
*/ */
void sysdev_shutdown(void) void sysdev_shutdown(void)
{ {
struct sysdev_class * cls; struct sysdev_class *cls;
pr_debug("Shutting Down System Devices\n"); pr_debug("Shutting Down System Devices\n");
mutex_lock(&sysdev_drivers_lock); mutex_lock(&sysdev_drivers_lock);
list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) { list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
struct sys_device * sysdev; struct sys_device *sysdev;
pr_debug("Shutting down type '%s':\n", pr_debug("Shutting down type '%s':\n",
kobject_name(&cls->kset.kobj)); 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; struct sysdev_driver *drv;
pr_debug(" %s\n", kobject_name(&sysdev->kobj)); pr_debug(" %s\n", kobject_name(&sysdev->kobj));
/* Call auxillary drivers first */ /* Call auxillary drivers first */
...@@ -364,7 +364,7 @@ static void __sysdev_resume(struct sys_device *dev) ...@@ -364,7 +364,7 @@ static void __sysdev_resume(struct sys_device *dev)
*/ */
int sysdev_suspend(pm_message_t state) int sysdev_suspend(pm_message_t state)
{ {
struct sysdev_class * cls; struct sysdev_class *cls;
struct sys_device *sysdev, *err_dev; struct sys_device *sysdev, *err_dev;
struct sysdev_driver *drv, *err_drv; struct sysdev_driver *drv, *err_drv;
int ret; int ret;
...@@ -442,12 +442,12 @@ EXPORT_SYMBOL_GPL(sysdev_suspend); ...@@ -442,12 +442,12 @@ EXPORT_SYMBOL_GPL(sysdev_suspend);
*/ */
int sysdev_resume(void) int sysdev_resume(void)
{ {
struct sysdev_class * cls; struct sysdev_class *cls;
pr_debug("Resuming System Devices\n"); pr_debug("Resuming System Devices\n");
list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) { list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) {
struct sys_device * sysdev; struct sys_device *sysdev;
pr_debug("Resuming type '%s':\n", pr_debug("Resuming type '%s':\n",
kobject_name(&cls->kset.kobj)); kobject_name(&cls->kset.kobj));
......
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