Commit d7677dc7 authored by Patrick Mochel's avatar Patrick Mochel

Merge bk://linux.bkbits.net/linux-2.5

into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
parents 1d0619c5 8624ae3d
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
static DECLARE_MUTEX(bus_sem); static DECLARE_MUTEX(bus_sem);
#define to_dev(node) container_of(node,struct device,bus_list) #define to_dev(node) container_of(node,struct device,bus_list)
#define to_drv(node) container_of(node,struct device_driver,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_attr(_attr) container_of(_attr,struct bus_attribute,attr)
#define to_bus(obj) container_of(obj,struct bus_type,subsys.kobj) #define to_bus(obj) container_of(obj,struct bus_type,subsys.kobj)
...@@ -203,9 +203,9 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, ...@@ -203,9 +203,9 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
if(!(bus = get_bus(bus))) if(!(bus = get_bus(bus)))
return -EINVAL; return -EINVAL;
head = start ? &start->bus_list : &bus->drivers; head = start ? &start->kobj.entry : &bus->drvsubsys.list;
down_read(&bus->subsys.rwsem); down_read(&bus->drvsubsys.rwsem);
list_for_each(entry,head) { list_for_each(entry,head) {
struct device_driver * drv = get_driver(to_drv(entry)); struct device_driver * drv = get_driver(to_drv(entry));
error = fn(drv,data); error = fn(drv,data);
...@@ -213,7 +213,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, ...@@ -213,7 +213,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
if(error) if(error)
break; break;
} }
up_read(&bus->subsys.rwsem); up_read(&bus->drvsubsys.rwsem);
return error; return error;
} }
...@@ -287,9 +287,8 @@ static int device_attach(struct device * dev) ...@@ -287,9 +287,8 @@ static int device_attach(struct device * dev)
if (!bus->match) if (!bus->match)
return 0; return 0;
list_for_each(entry,&bus->drivers) { list_for_each(entry,&bus->drvsubsys.list) {
struct device_driver * drv = struct device_driver * drv = to_drv(entry);
container_of(entry,struct device_driver,bus_list);
if (!(error = bus_match(dev,drv))) if (!(error = bus_match(dev,drv)))
break; break;
} }
...@@ -437,7 +436,6 @@ int bus_add_driver(struct device_driver * drv) ...@@ -437,7 +436,6 @@ int bus_add_driver(struct device_driver * drv)
kobject_register(&drv->kobj); kobject_register(&drv->kobj);
devclass_add_driver(drv); devclass_add_driver(drv);
list_add_tail(&drv->bus_list,&bus->drivers);
driver_attach(drv); driver_attach(drv);
up_write(&bus->subsys.rwsem); up_write(&bus->subsys.rwsem);
} }
...@@ -460,7 +458,6 @@ void bus_remove_driver(struct device_driver * drv) ...@@ -460,7 +458,6 @@ void bus_remove_driver(struct device_driver * drv)
down_write(&drv->bus->subsys.rwsem); 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); driver_detach(drv);
list_del_init(&drv->bus_list);
devclass_remove_driver(drv); devclass_remove_driver(drv);
kobject_unregister(&drv->kobj); kobject_unregister(&drv->kobj);
up_write(&drv->bus->subsys.rwsem); up_write(&drv->bus->subsys.rwsem);
...@@ -491,7 +488,6 @@ void put_bus(struct bus_type * bus) ...@@ -491,7 +488,6 @@ void put_bus(struct bus_type * bus)
int bus_register(struct bus_type * bus) int bus_register(struct bus_type * bus)
{ {
INIT_LIST_HEAD(&bus->devices); INIT_LIST_HEAD(&bus->devices);
INIT_LIST_HEAD(&bus->drivers);
down(&bus_sem); down(&bus_sem);
strncpy(bus->subsys.kobj.name,bus->name,KOBJ_NAME_LEN); strncpy(bus->subsys.kobj.name,bus->name,KOBJ_NAME_LEN);
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
#define to_data(e) container_of(e,struct intf_data,kobj.entry) #define to_data(e) container_of(e,struct intf_data,kobj.entry)
#define intf_from_data(d) container_of(d->kobj.subsys,struct device_interface, subsys);
/** /**
* intf_dev_link - create sysfs symlink for interface. * intf_dev_link - create sysfs symlink for interface.
* @data: interface data descriptor. * @data: interface data descriptor.
...@@ -61,15 +58,18 @@ static void intf_dev_unlink(struct intf_data * data) ...@@ -61,15 +58,18 @@ static void intf_dev_unlink(struct intf_data * data)
int interface_add_data(struct intf_data * data) int interface_add_data(struct intf_data * data)
{ {
struct device_interface * intf = intf_from_data(data); struct device_interface * intf = data->intf;
data->intf_num = data->intf->devnum++; if (intf) {
data->intf_num = intf->devnum++;
data->kobj.subsys = &intf->subsys; data->kobj.subsys = &intf->subsys;
kobject_register(&data->kobj); kobject_register(&data->kobj);
list_add_tail(&data->dev_entry,&data->dev->intf_list); list_add_tail(&data->dev_entry,&data->dev->intf_list);
intf_dev_link(data); intf_dev_link(data);
return 0; return 0;
}
return -EINVAL;
} }
...@@ -121,9 +121,9 @@ static int add(struct device_interface * intf, struct device * dev) ...@@ -121,9 +121,9 @@ static int add(struct device_interface * intf, struct device * dev)
static void del(struct intf_data * data) static void del(struct intf_data * data)
{ {
struct device_interface * intf = intf_from_data(data); struct device_interface * intf = data->intf;
pr_debug(" -> %s ",data->intf->name); pr_debug(" -> %s ",intf->name);
interface_remove_data(data); interface_remove_data(data);
if (intf->remove_device) if (intf->remove_device)
intf->remove_device(data); intf->remove_device(data);
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <../drivers/base/fs/fs.h> /* Eeeeewwwww */
#include "check.h" #include "check.h"
...@@ -399,13 +398,15 @@ void register_disk(struct gendisk *disk) ...@@ -399,13 +398,15 @@ void register_disk(struct gendisk *disk)
struct block_device *bdev; struct block_device *bdev;
char *s; char *s;
int j; int j;
int err;
strncpy(disk->kobj.name,disk->disk_name,KOBJ_NAME_LEN); strncpy(disk->kobj.name,disk->disk_name,KOBJ_NAME_LEN);
/* ewww... some of these buggers have / in name... */ /* ewww... some of these buggers have / in name... */
s = strchr(disk->kobj.name, '/'); s = strchr(disk->kobj.name, '/');
if (s) if (s)
*s = '!'; *s = '!';
kobject_add(&disk->kobj); if ((err = kobject_add(&disk->kobj)))
return;
disk_sysfs_symlinks(disk); disk_sysfs_symlinks(disk);
if (disk->flags & GENHD_FL_CD) if (disk->flags & GENHD_FL_CD)
......
...@@ -69,7 +69,6 @@ struct bus_type { ...@@ -69,7 +69,6 @@ struct bus_type {
struct subsystem drvsubsys; struct subsystem drvsubsys;
struct subsystem devsubsys; struct subsystem devsubsys;
struct list_head devices; struct list_head devices;
struct list_head drivers;
int (*match)(struct device * dev, struct device_driver * drv); int (*match)(struct device * dev, struct device_driver * drv);
struct device * (*add) (struct device * parent, char * bus_id); struct device * (*add) (struct device * parent, char * bus_id);
...@@ -119,7 +118,6 @@ struct device_driver { ...@@ -119,7 +118,6 @@ struct device_driver {
struct semaphore unload_sem; struct semaphore unload_sem;
struct kobject kobj; struct kobject kobj;
struct list_head bus_list;
struct list_head class_list; struct list_head class_list;
struct list_head devices; struct list_head devices;
......
...@@ -52,7 +52,7 @@ extern void subsystem_unregister(struct subsystem *); ...@@ -52,7 +52,7 @@ extern void subsystem_unregister(struct subsystem *);
static inline struct subsystem * subsys_get(struct subsystem * s) static inline struct subsystem * subsys_get(struct subsystem * s)
{ {
return container_of(kobject_get(&s->kobj),struct subsystem,kobj); return s ? container_of(kobject_get(&s->kobj),struct subsystem,kobj) : NULL;
} }
static inline void subsys_put(struct subsystem * s) static inline void subsys_put(struct subsystem * s)
......
...@@ -74,10 +74,13 @@ int kobject_add(struct kobject * kobj) ...@@ -74,10 +74,13 @@ int kobject_add(struct kobject * kobj)
{ {
int error = 0; int error = 0;
struct subsystem * s = kobj->subsys; struct subsystem * s = kobj->subsys;
struct kobject * parent = kobject_get(kobj->parent); struct kobject * parent;
if (!(kobj = kobject_get(kobj))) if (!(kobj = kobject_get(kobj)))
return -ENOENT; return -ENOENT;
parent = kobject_get(kobj->parent);
pr_debug("kobject %s: registering. parent: %s, subsys: %s\n", pr_debug("kobject %s: registering. parent: %s, subsys: %s\n",
kobj->name, parent ? parent->name : "<NULL>", kobj->name, parent ? parent->name : "<NULL>",
kobj->subsys ? kobj->subsys->kobj.name : "<NULL>" ); kobj->subsys ? kobj->subsys->kobj.name : "<NULL>" );
...@@ -93,8 +96,8 @@ int kobject_add(struct kobject * kobj) ...@@ -93,8 +96,8 @@ int kobject_add(struct kobject * kobj)
up_write(&s->rwsem); up_write(&s->rwsem);
} }
error = create_dir(kobj); error = create_dir(kobj);
if (error && kobj->parent) if (error && parent)
kobject_put(kobj->parent); kobject_put(parent);
return error; return error;
} }
...@@ -218,7 +221,7 @@ int subsystem_register(struct subsystem * s) ...@@ -218,7 +221,7 @@ int subsystem_register(struct subsystem * s)
s->kobj.parent = &s->parent->kobj; s->kobj.parent = &s->parent->kobj;
pr_debug("subsystem %s: registering, parent: %s\n", pr_debug("subsystem %s: registering, parent: %s\n",
s->kobj.name,s->parent ? s->parent->kobj.name : "<none>"); s->kobj.name,s->parent ? s->parent->kobj.name : "<none>");
return kobject_register(&s->kobj); return kobject_add(&s->kobj);
} }
void subsystem_unregister(struct subsystem * s) void subsystem_unregister(struct subsystem * s)
......
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