Commit dc5bc0ca authored by Cornelia Huck's avatar Cornelia Huck Committed by Jeff Garzik

s390: Use ccw_device_get_id() in qeth/claw drivers

Use ccw_device_get_id() to get a device number
instead of parsing the ccw device's bus id.
Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarFrank Pavlic <fpavlic@de.ibm.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent cd3e76eb
...@@ -3912,6 +3912,7 @@ static int ...@@ -3912,6 +3912,7 @@ static int
add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr)
{ {
struct chbk *p_ch; struct chbk *p_ch;
struct ccw_dev_id dev_id;
#ifdef FUNCTRACE #ifdef FUNCTRACE
printk(KERN_INFO "%s:%s Enter\n",cdev->dev.bus_id,__FUNCTION__); printk(KERN_INFO "%s:%s Enter\n",cdev->dev.bus_id,__FUNCTION__);
...@@ -3921,7 +3922,8 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) ...@@ -3921,7 +3922,8 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr)
p_ch = &privptr->channel[i]; p_ch = &privptr->channel[i];
p_ch->cdev = cdev; p_ch->cdev = cdev;
snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id); snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id);
sscanf(cdev->dev.bus_id+4,"%x",&p_ch->devno); ccw_device_get_id(cdev, &dev_id);
p_ch->devno = dev_id.devno;
if ((p_ch->irb = kmalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { if ((p_ch->irb = kmalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) {
printk(KERN_WARNING "%s Out of memory in %s for irb\n", printk(KERN_WARNING "%s Out of memory in %s for irb\n",
p_ch->id,__FUNCTION__); p_ch->id,__FUNCTION__);
...@@ -3955,6 +3957,7 @@ claw_new_device(struct ccwgroup_device *cgdev) ...@@ -3955,6 +3957,7 @@ claw_new_device(struct ccwgroup_device *cgdev)
struct claw_env *p_env; struct claw_env *p_env;
struct net_device *dev; struct net_device *dev;
int ret; int ret;
struct ccw_dev_id dev_id;
pr_debug("%s() called\n", __FUNCTION__); pr_debug("%s() called\n", __FUNCTION__);
printk(KERN_INFO "claw: add for %s\n",cgdev->cdev[READ]->dev.bus_id); printk(KERN_INFO "claw: add for %s\n",cgdev->cdev[READ]->dev.bus_id);
...@@ -3965,10 +3968,10 @@ claw_new_device(struct ccwgroup_device *cgdev) ...@@ -3965,10 +3968,10 @@ claw_new_device(struct ccwgroup_device *cgdev)
if (!privptr) if (!privptr)
return -ENODEV; return -ENODEV;
p_env = privptr->p_env; p_env = privptr->p_env;
sscanf(cgdev->cdev[READ]->dev.bus_id+4,"%x", ccw_device_get_id(cgdev->cdev[READ], &dev_id);
&p_env->devno[READ]); p_env->devno[READ] = dev_id.devno;
sscanf(cgdev->cdev[WRITE]->dev.bus_id+4,"%x", ccw_device_get_id(cgdev->cdev[WRITE], &dev_id);
&p_env->devno[WRITE]); p_env->devno[WRITE] = dev_id.devno;
ret = add_channel(cgdev->cdev[0],0,privptr); ret = add_channel(cgdev->cdev[0],0,privptr);
if (ret == 0) if (ret == 0)
ret = add_channel(cgdev->cdev[1],1,privptr); ret = add_channel(cgdev->cdev[1],1,privptr);
......
...@@ -2176,13 +2176,6 @@ qeth_ulp_enable(struct qeth_card *card) ...@@ -2176,13 +2176,6 @@ qeth_ulp_enable(struct qeth_card *card)
} }
static inline __u16
__raw_devno_from_bus_id(char *id)
{
id += (strlen(id) - 4);
return (__u16) simple_strtoul(id, &id, 16);
}
static int static int
qeth_ulp_setup_cb(struct qeth_card *card, struct qeth_reply *reply, qeth_ulp_setup_cb(struct qeth_card *card, struct qeth_reply *reply,
unsigned long data) unsigned long data)
...@@ -2205,6 +2198,7 @@ qeth_ulp_setup(struct qeth_card *card) ...@@ -2205,6 +2198,7 @@ qeth_ulp_setup(struct qeth_card *card)
int rc; int rc;
__u16 temp; __u16 temp;
struct qeth_cmd_buffer *iob; struct qeth_cmd_buffer *iob;
struct ccw_dev_id dev_id;
QETH_DBF_TEXT(setup,2,"ulpsetup"); QETH_DBF_TEXT(setup,2,"ulpsetup");
...@@ -2218,8 +2212,8 @@ qeth_ulp_setup(struct qeth_card *card) ...@@ -2218,8 +2212,8 @@ qeth_ulp_setup(struct qeth_card *card)
memcpy(QETH_ULP_SETUP_FILTER_TOKEN(iob->data), memcpy(QETH_ULP_SETUP_FILTER_TOKEN(iob->data),
&card->token.ulp_filter_r, QETH_MPC_TOKEN_LENGTH); &card->token.ulp_filter_r, QETH_MPC_TOKEN_LENGTH);
temp = __raw_devno_from_bus_id(CARD_DDEV_ID(card)); ccw_device_get_id(CARD_DDEV(card), &dev_id);
memcpy(QETH_ULP_SETUP_CUA(iob->data), &temp, 2); memcpy(QETH_ULP_SETUP_CUA(iob->data), &dev_id.devno, 2);
temp = (card->info.cula << 8) + card->info.unit_addr2; temp = (card->info.cula << 8) + card->info.unit_addr2;
memcpy(QETH_ULP_SETUP_REAL_DEVADDR(iob->data), &temp, 2); memcpy(QETH_ULP_SETUP_REAL_DEVADDR(iob->data), &temp, 2);
rc = qeth_send_control_data(card, ULP_SETUP_SIZE, iob, rc = qeth_send_control_data(card, ULP_SETUP_SIZE, iob,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment