aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2008-05-15 10:52:37 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-05-15 10:52:40 -0400
commitf455adcff102851629d716815f92bb7010de0c4e (patch)
treebab501970eb484a53d88b47879eb7b401a73a154 /drivers
parentf16f5843507ceaea315dae82b9fee29a65b72f24 (diff)
[S390] tape: Use ccw_dev_id to build cdev_id.
To construct the integer containing the information from the bus_id, it is easier to use the data from ccw_dev_id than to parse the bus_id. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/char/tape_core.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index 7ad8cf157641..76e44eb7c47f 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -76,32 +76,9 @@ const char *tape_op_verbose[TO_SIZE] =
76 [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC", 76 [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC",
77}; 77};
78 78
79static int 79static int devid_to_int(struct ccw_dev_id *dev_id)
80busid_to_int(char *bus_id)
81{ 80{
82 int dec; 81 return dev_id->devno + (dev_id->ssid << 16);
83 int d;
84 char * s;
85
86 for(s = bus_id, d = 0; *s != '\0' && *s != '.'; s++)
87 d = (d * 10) + (*s - '0');
88 dec = d;
89 for(s++, d = 0; *s != '\0' && *s != '.'; s++)
90 d = (d * 10) + (*s - '0');
91 dec = (dec << 8) + d;
92
93 for(s++; *s != '\0'; s++) {
94 if (*s >= '0' && *s <= '9') {
95 d = *s - '0';
96 } else if (*s >= 'a' && *s <= 'f') {
97 d = *s - 'a' + 10;
98 } else {
99 d = *s - 'A' + 10;
100 }
101 dec = (dec << 4) + d;
102 }
103
104 return dec;
105} 82}
106 83
107/* 84/*
@@ -551,6 +528,7 @@ tape_generic_probe(struct ccw_device *cdev)
551{ 528{
552 struct tape_device *device; 529 struct tape_device *device;
553 int ret; 530 int ret;
531 struct ccw_dev_id dev_id;
554 532
555 device = tape_alloc_device(); 533 device = tape_alloc_device();
556 if (IS_ERR(device)) 534 if (IS_ERR(device))
@@ -565,7 +543,8 @@ tape_generic_probe(struct ccw_device *cdev)
565 cdev->dev.driver_data = device; 543 cdev->dev.driver_data = device;
566 cdev->handler = __tape_do_irq; 544 cdev->handler = __tape_do_irq;
567 device->cdev = cdev; 545 device->cdev = cdev;
568 device->cdev_id = busid_to_int(cdev->dev.bus_id); 546 ccw_device_get_id(cdev, &dev_id);
547 device->cdev_id = devid_to_int(&dev_id);
569 PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); 548 PRINT_INFO("tape device %s found\n", cdev->dev.bus_id);
570 return ret; 549 return ret;
571} 550}