aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/pktcdvd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:35:13 -0500
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /drivers/block/pktcdvd.c
parent556a169dab38b5100df6f4a45b655dddd3db94c1 (diff)
parent4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas: - Documentation updates (language translations and fixes, as well as kobject and kset documenatation updates.) - major kset/kobject/ktype rework and fixes. This cleans up the kset and kobject and ktype relationship and architecture, making sense of things now, and good documenation and samples are provided for others to use. Also the attributes for kobjects are much easier to handle now. This cleaned up a LOT of code all through the kernel, making kobjects easier to use if you want to. - struct bus_type has been reworked to now handle the lifetime rules properly, as the kobject is properly dynamic. - struct driver has also been reworked, and now the lifetime issues are resolved. - the block subsystem has been converted to use struct device now, and not "raw" kobjects. This patch has been in the -mm tree for over a year now, and finally all the issues are worked out with it. Older distros now properly work with new kernels, and no userspace updates are needed at all. - nozomi driver is added. This has also been in -mm for a long time, and many people have asked for it to go in. It is now in good enough shape to do so. - lots of class_device conversions to use struct device instead. The tree is almost all cleaned up now, only SCSI and IB is the remaining code to fix up... * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits) Driver core: coding style fixes Kobject: fix coding style issues in kobject c files Kobject: fix coding style issues in kobject.h Driver core: fix coding style issues in device.h spi: use class iteration api scsi: use class iteration api rtc: use class iteration api power supply : use class iteration api ieee1394: use class iteration api Driver Core: add class iteration api Driver core: Cleanup get_device_parent() in device_add() and device_move() UIO: constify function pointer tables Driver Core: constify the name passed to platform_device_register_simple driver core: fix build with SYSFS=n sysfs: make SYSFS_DEPRECATED depend on SYSFS Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init kobject: add sample code for how to use ksets/ktypes/kobjects kobject: add sample code for how to use kobjects in a simple manner. kobject: update the kobject/kset documentation kobject: remove old, outdated documentation. ...
Diffstat (limited to 'drivers/block/pktcdvd.c')
-rw-r--r--drivers/block/pktcdvd.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 3535ef896677..e9de1712e5a0 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -110,17 +110,18 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
110 struct kobj_type* ktype) 110 struct kobj_type* ktype)
111{ 111{
112 struct pktcdvd_kobj *p; 112 struct pktcdvd_kobj *p;
113 int error;
114
113 p = kzalloc(sizeof(*p), GFP_KERNEL); 115 p = kzalloc(sizeof(*p), GFP_KERNEL);
114 if (!p) 116 if (!p)
115 return NULL; 117 return NULL;
116 kobject_set_name(&p->kobj, "%s", name);
117 p->kobj.parent = parent;
118 p->kobj.ktype = ktype;
119 p->pd = pd; 118 p->pd = pd;
120 if (kobject_register(&p->kobj) != 0) { 119 error = kobject_init_and_add(&p->kobj, ktype, parent, "%s", name);
120 if (error) {
121 kobject_put(&p->kobj); 121 kobject_put(&p->kobj);
122 return NULL; 122 return NULL;
123 } 123 }
124 kobject_uevent(&p->kobj, KOBJ_ADD);
124 return p; 125 return p;
125} 126}
126/* 127/*
@@ -129,7 +130,7 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
129static void pkt_kobj_remove(struct pktcdvd_kobj *p) 130static void pkt_kobj_remove(struct pktcdvd_kobj *p)
130{ 131{
131 if (p) 132 if (p)
132 kobject_unregister(&p->kobj); 133 kobject_put(&p->kobj);
133} 134}
134/* 135/*
135 * default release function for pktcdvd kernel objects. 136 * default release function for pktcdvd kernel objects.
@@ -301,18 +302,16 @@ static struct kobj_type kobj_pkt_type_wqueue = {
301static void pkt_sysfs_dev_new(struct pktcdvd_device *pd) 302static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
302{ 303{
303 if (class_pktcdvd) { 304 if (class_pktcdvd) {
304 pd->clsdev = class_device_create(class_pktcdvd, 305 pd->dev = device_create(class_pktcdvd, NULL, pd->pkt_dev, "%s", pd->name);
305 NULL, pd->pkt_dev, 306 if (IS_ERR(pd->dev))
306 NULL, "%s", pd->name); 307 pd->dev = NULL;
307 if (IS_ERR(pd->clsdev))
308 pd->clsdev = NULL;
309 } 308 }
310 if (pd->clsdev) { 309 if (pd->dev) {
311 pd->kobj_stat = pkt_kobj_create(pd, "stat", 310 pd->kobj_stat = pkt_kobj_create(pd, "stat",
312 &pd->clsdev->kobj, 311 &pd->dev->kobj,
313 &kobj_pkt_type_stat); 312 &kobj_pkt_type_stat);
314 pd->kobj_wqueue = pkt_kobj_create(pd, "write_queue", 313 pd->kobj_wqueue = pkt_kobj_create(pd, "write_queue",
315 &pd->clsdev->kobj, 314 &pd->dev->kobj,
316 &kobj_pkt_type_wqueue); 315 &kobj_pkt_type_wqueue);
317 } 316 }
318} 317}
@@ -322,7 +321,7 @@ static void pkt_sysfs_dev_remove(struct pktcdvd_device *pd)
322 pkt_kobj_remove(pd->kobj_stat); 321 pkt_kobj_remove(pd->kobj_stat);
323 pkt_kobj_remove(pd->kobj_wqueue); 322 pkt_kobj_remove(pd->kobj_wqueue);
324 if (class_pktcdvd) 323 if (class_pktcdvd)
325 class_device_destroy(class_pktcdvd, pd->pkt_dev); 324 device_destroy(class_pktcdvd, pd->pkt_dev);
326} 325}
327 326
328 327