driver-core: merge private parts of class and bus
As classes and busses are pretty much the same thing, and we want to merge them together into a 'subsystem' in the future, let us share the same private data parts to make that merge easier. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
14c05aa399
commit
6b6e39a6a8
@@ -20,7 +20,6 @@
|
||||
#include "power/power.h"
|
||||
|
||||
#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
|
||||
#define to_bus(obj) container_of(obj, struct bus_type_private, subsys.kobj)
|
||||
|
||||
/*
|
||||
* sysfs bindings for drivers
|
||||
@@ -96,11 +95,11 @@ static ssize_t bus_attr_show(struct kobject *kobj, struct attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct bus_attribute *bus_attr = to_bus_attr(attr);
|
||||
struct bus_type_private *bus_priv = to_bus(kobj);
|
||||
struct subsys_private *subsys_priv = to_subsys_private(kobj);
|
||||
ssize_t ret = 0;
|
||||
|
||||
if (bus_attr->show)
|
||||
ret = bus_attr->show(bus_priv->bus, buf);
|
||||
ret = bus_attr->show(subsys_priv->bus, buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -108,11 +107,11 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct bus_attribute *bus_attr = to_bus_attr(attr);
|
||||
struct bus_type_private *bus_priv = to_bus(kobj);
|
||||
struct subsys_private *subsys_priv = to_subsys_private(kobj);
|
||||
ssize_t ret = 0;
|
||||
|
||||
if (bus_attr->store)
|
||||
ret = bus_attr->store(bus_priv->bus, buf, count);
|
||||
ret = bus_attr->store(subsys_priv->bus, buf, count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -858,9 +857,9 @@ static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store);
|
||||
int bus_register(struct bus_type *bus)
|
||||
{
|
||||
int retval;
|
||||
struct bus_type_private *priv;
|
||||
struct subsys_private *priv;
|
||||
|
||||
priv = kzalloc(sizeof(struct bus_type_private), GFP_KERNEL);
|
||||
priv = kzalloc(sizeof(struct subsys_private), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Reference in New Issue
Block a user