diff options
author | Cornelia Huck <cohuck@de.ibm.com> | 2005-06-25 17:55:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:36 -0400 |
commit | b0744bd2925a4a24865963322534107d2ad553f9 (patch) | |
tree | 7e09f76872685d29dd03a0955ee948c4f00f4f8b /drivers/s390/cio/device.c | |
parent | 84dd8d7e9c080b4db66b00b8bc36ccf09a90f824 (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/device.c')
-rw-r--r-- | drivers/s390/cio/device.c | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 809e1108a06e..14c76f5e4177 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -514,36 +514,39 @@ ccw_device_register(struct ccw_device *cdev) | |||
514 | return ret; | 514 | return ret; |
515 | } | 515 | } |
516 | 516 | ||
517 | struct match_data { | ||
518 | unsigned int devno; | ||
519 | struct ccw_device * sibling; | ||
520 | }; | ||
521 | |||
522 | static int | ||
523 | match_devno(struct device * dev, void * data) | ||
524 | { | ||
525 | struct match_data * d = (struct match_data *)data; | ||
526 | struct ccw_device * cdev; | ||
527 | |||
528 | cdev = to_ccwdev(dev); | ||
529 | if ((cdev->private->state == DEV_STATE_DISCONNECTED) && | ||
530 | (cdev->private->devno == d->devno) && | ||
531 | (cdev != d->sibling)) { | ||
532 | cdev->private->state = DEV_STATE_NOT_OPER; | ||
533 | return 1; | ||
534 | } | ||
535 | return 0; | ||
536 | } | ||
537 | |||
517 | static struct ccw_device * | 538 | static struct ccw_device * |
518 | get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling) | 539 | get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling) |
519 | { | 540 | { |
520 | struct ccw_device *cdev; | ||
521 | struct list_head *entry; | ||
522 | struct device *dev; | 541 | struct device *dev; |
542 | struct match_data data = { | ||
543 | .devno = devno, | ||
544 | .sibling = sibling, | ||
545 | }; | ||
523 | 546 | ||
524 | if (!get_bus(&ccw_bus_type)) | 547 | dev = bus_find_device(&css_bus_type, NULL, &data, match_devno); |
525 | return NULL; | ||
526 | down_read(&ccw_bus_type.subsys.rwsem); | ||
527 | cdev = NULL; | ||
528 | list_for_each(entry, &ccw_bus_type.devices.list) { | ||
529 | dev = get_device(container_of(entry, | ||
530 | struct device, bus_list)); | ||
531 | if (!dev) | ||
532 | continue; | ||
533 | cdev = to_ccwdev(dev); | ||
534 | if ((cdev->private->state == DEV_STATE_DISCONNECTED) && | ||
535 | (cdev->private->devno == devno) && | ||
536 | (cdev != sibling)) { | ||
537 | cdev->private->state = DEV_STATE_NOT_OPER; | ||
538 | break; | ||
539 | } | ||
540 | put_device(dev); | ||
541 | cdev = NULL; | ||
542 | } | ||
543 | up_read(&ccw_bus_type.subsys.rwsem); | ||
544 | put_bus(&ccw_bus_type); | ||
545 | 548 | ||
546 | return cdev; | 549 | return dev ? to_ccwdev(dev) : NULL; |
547 | } | 550 | } |
548 | 551 | ||
549 | static void | 552 | static void |
@@ -647,7 +650,7 @@ io_subchannel_register(void *data) | |||
647 | cdev = (struct ccw_device *) data; | 650 | cdev = (struct ccw_device *) data; |
648 | sch = to_subchannel(cdev->dev.parent); | 651 | sch = to_subchannel(cdev->dev.parent); |
649 | 652 | ||
650 | if (!list_empty(&sch->dev.children)) { | 653 | if (klist_node_attached(&cdev->dev.knode_parent)) { |
651 | bus_rescan_devices(&ccw_bus_type); | 654 | bus_rescan_devices(&ccw_bus_type); |
652 | goto out; | 655 | goto out; |
653 | } | 656 | } |
@@ -1019,30 +1022,29 @@ ccw_device_probe_console(void) | |||
1019 | /* | 1022 | /* |
1020 | * get ccw_device matching the busid, but only if owned by cdrv | 1023 | * get ccw_device matching the busid, but only if owned by cdrv |
1021 | */ | 1024 | */ |
1025 | static int | ||
1026 | __ccwdev_check_busid(struct device *dev, void *id) | ||
1027 | { | ||
1028 | char *bus_id; | ||
1029 | |||
1030 | bus_id = (char *)id; | ||
1031 | |||
1032 | return (strncmp(bus_id, dev->bus_id, BUS_ID_SIZE) == 0); | ||
1033 | } | ||
1034 | |||
1035 | |||
1022 | struct ccw_device * | 1036 | struct ccw_device * |
1023 | get_ccwdev_by_busid(struct ccw_driver *cdrv, const char *bus_id) | 1037 | get_ccwdev_by_busid(struct ccw_driver *cdrv, const char *bus_id) |
1024 | { | 1038 | { |
1025 | struct device *d, *dev; | 1039 | struct device *dev; |
1026 | struct device_driver *drv; | 1040 | struct device_driver *drv; |
1027 | 1041 | ||
1028 | drv = get_driver(&cdrv->driver); | 1042 | drv = get_driver(&cdrv->driver); |
1029 | if (!drv) | 1043 | if (!drv) |
1030 | return 0; | 1044 | return NULL; |
1031 | |||
1032 | down_read(&drv->bus->subsys.rwsem); | ||
1033 | |||
1034 | dev = NULL; | ||
1035 | list_for_each_entry(d, &drv->devices, driver_list) { | ||
1036 | dev = get_device(d); | ||
1037 | 1045 | ||
1038 | if (dev && !strncmp(bus_id, dev->bus_id, BUS_ID_SIZE)) | 1046 | dev = driver_find_device(drv, NULL, (void *)bus_id, |
1039 | break; | 1047 | __ccwdev_check_busid); |
1040 | else if (dev) { | ||
1041 | put_device(dev); | ||
1042 | dev = NULL; | ||
1043 | } | ||
1044 | } | ||
1045 | up_read(&drv->bus->subsys.rwsem); | ||
1046 | put_driver(drv); | 1048 | put_driver(drv); |
1047 | 1049 | ||
1048 | return dev ? to_ccwdev(dev) : 0; | 1050 | return dev ? to_ccwdev(dev) : 0; |