From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 09/11] tape: Use ccw_dev_id to build cdev_id.
Date: Thu, 15 May 2008 16:57:14 +0200 [thread overview]
Message-ID: <20080515150009.589155198@de.ibm.com> (raw)
In-Reply-To: 20080515145705.188435204@de.ibm.com
[-- Attachment #1: 009-tape-devid.diff --]
[-- Type: text/plain, Size: 1982 bytes --]
From: Cornelia Huck <cornelia.huck@de.ibm.com>
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>
---
drivers/s390/char/tape_core.c | 31 +++++--------------------------
1 file changed, 5 insertions(+), 26 deletions(-)
Index: quilt-2.6/drivers/s390/char/tape_core.c
===================================================================
--- quilt-2.6.orig/drivers/s390/char/tape_core.c
+++ quilt-2.6/drivers/s390/char/tape_core.c
@@ -76,32 +76,9 @@ const char *tape_op_verbose[TO_SIZE] =
[TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC",
};
-static int
-busid_to_int(char *bus_id)
+static int devid_to_int(struct ccw_dev_id *dev_id)
{
- int dec;
- int d;
- char * s;
-
- for(s = bus_id, d = 0; *s != '\0' && *s != '.'; s++)
- d = (d * 10) + (*s - '0');
- dec = d;
- for(s++, d = 0; *s != '\0' && *s != '.'; s++)
- d = (d * 10) + (*s - '0');
- dec = (dec << 8) + d;
-
- for(s++; *s != '\0'; s++) {
- if (*s >= '0' && *s <= '9') {
- d = *s - '0';
- } else if (*s >= 'a' && *s <= 'f') {
- d = *s - 'a' + 10;
- } else {
- d = *s - 'A' + 10;
- }
- dec = (dec << 4) + d;
- }
-
- return dec;
+ return dev_id->devno + (dev_id->ssid << 16);
}
/*
@@ -551,6 +528,7 @@ tape_generic_probe(struct ccw_device *cd
{
struct tape_device *device;
int ret;
+ struct ccw_dev_id dev_id;
device = tape_alloc_device();
if (IS_ERR(device))
@@ -565,7 +543,8 @@ tape_generic_probe(struct ccw_device *cd
cdev->dev.driver_data = device;
cdev->handler = __tape_do_irq;
device->cdev = cdev;
- device->cdev_id = busid_to_int(cdev->dev.bus_id);
+ ccw_device_get_id(cdev, &dev_id);
+ device->cdev_id = devid_to_int(&dev_id);
PRINT_INFO("tape device %s found\n", cdev->dev.bus_id);
return ret;
}
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2008-05-15 14:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-15 14:57 [patch 00/11] s390 patches for 2.6.26-rc2 Martin Schwidefsky
2008-05-15 14:57 ` [patch 01/11] cio: Remove CCW_CMD_SUSPEND_RECONN in front of CCW_CMD_SET_PGID Martin Schwidefsky
2008-05-15 14:57 ` [patch 02/11] Remove last traces of cio_msg= Martin Schwidefsky
2008-05-15 14:57 ` [patch 03/11] sparsemem vmemmap: initialize memmap Martin Schwidefsky
2008-05-15 14:57 ` [patch 04/11] vmlogrdr: module initialization function should return negative errors Martin Schwidefsky
2008-05-15 14:57 ` [patch 05/11] blacklist.c: removed duplicated include Martin Schwidefsky
2008-05-15 14:57 ` [patch 06/11] dasd: Use const in busid functions Martin Schwidefsky
2008-05-15 14:57 ` [patch 07/11] s390dbf: Use const char * for dbf name Martin Schwidefsky
2008-05-15 14:57 ` [patch 08/11] dasd: fix timeout handling in interrupt handler Martin Schwidefsky
2008-05-15 14:57 ` Martin Schwidefsky [this message]
2008-05-15 14:57 ` [patch 10/11] smp: __smp_call_function_map vs cpu_online_map fix Martin Schwidefsky
2008-05-15 14:57 ` [patch 11/11] show_interrupts: prevent cpu hotplug when walking cpu_online_map Martin Schwidefsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080515150009.589155198@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.