aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/ccwgroup.c
diff options
context:
space:
mode:
authorCornelia Huck <cohuck@de.ibm.com>2005-06-25 17:55:27 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:36 -0400
commitb0744bd2925a4a24865963322534107d2ad553f9 (patch)
tree7e09f76872685d29dd03a0955ee948c4f00f4f8b /drivers/s390/cio/ccwgroup.c
parent84dd8d7e9c080b4db66b00b8bc36ccf09a90f824 (diff)
[PATCH] s/390: Use klist in cio
Convert the common I/O layer to use the klist interfaces. This patch has been adapted from the previous version to the changed interface semantics. Also, gcc 4.0 compile warnings have been removed. Signed-off-by: Cornelia Huck <cohuck@de.ibm.com> Cc: Greg KH <greg@kroah.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/cio/ccwgroup.c')
-rw-r--r--drivers/s390/cio/ccwgroup.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 306525acb9f8..91ea8e4777f3 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -403,34 +403,22 @@ ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
403 return driver_register(&cdriver->driver); 403 return driver_register(&cdriver->driver);
404} 404}
405 405
406static inline struct device * 406static int
407__get_next_ccwgroup_device(struct device_driver *drv) 407__ccwgroup_driver_unregister_device(struct device *dev, void *data)
408{ 408{
409 struct device *dev, *d; 409 __ccwgroup_remove_symlinks(to_ccwgroupdev(dev));
410 410 device_unregister(dev);
411 down_read(&drv->bus->subsys.rwsem); 411 put_device(dev);
412 dev = NULL; 412 return 0;
413 list_for_each_entry(d, &drv->devices, driver_list) {
414 dev = get_device(d);
415 if (dev)
416 break;
417 }
418 up_read(&drv->bus->subsys.rwsem);
419 return dev;
420} 413}
421 414
422void 415void
423ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver) 416ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver)
424{ 417{
425 struct device *dev;
426
427 /* We don't want ccwgroup devices to live longer than their driver. */ 418 /* We don't want ccwgroup devices to live longer than their driver. */
428 get_driver(&cdriver->driver); 419 get_driver(&cdriver->driver);
429 while ((dev = __get_next_ccwgroup_device(&cdriver->driver))) { 420 driver_for_each_device(&cdriver->driver, NULL, NULL,
430 __ccwgroup_remove_symlinks(to_ccwgroupdev(dev)); 421 __ccwgroup_driver_unregister_device);
431 device_unregister(dev);
432 put_device(dev);
433 };
434 put_driver(&cdriver->driver); 422 put_driver(&cdriver->driver);
435 driver_unregister(&cdriver->driver); 423 driver_unregister(&cdriver->driver);
436} 424}
@@ -449,7 +437,7 @@ __ccwgroup_get_gdev_by_cdev(struct ccw_device *cdev)
449 if (cdev->dev.driver_data) { 437 if (cdev->dev.driver_data) {
450 gdev = (struct ccwgroup_device *)cdev->dev.driver_data; 438 gdev = (struct ccwgroup_device *)cdev->dev.driver_data;
451 if (get_device(&gdev->dev)) { 439 if (get_device(&gdev->dev)) {
452 if (!list_empty(&gdev->dev.node)) 440 if (klist_node_attached(&gdev->dev.knode_bus))
453 return gdev; 441 return gdev;
454 put_device(&gdev->dev); 442 put_device(&gdev->dev);
455 } 443 }