Commit dca114f5 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] kill pcmcia driver bind_info horror

Currenty pcmcia drivers do a loop on their devices for issuing a
SCSI_IOCTL_GET_IDLUN ioctl from kernelspace and passing dev->type
to userspace so cardmgr can guess the the dev_t and find the
device node of it.

But it doesn't actually use it but only pass it as optional arguments
to it's poor-man's hotplug scripts.  So kill this horror of, we
have proper hotplug scripts in 2.5.  And here we go, the first big
host->my_devices abuser is gone.
parent 9b153ccb
......@@ -98,9 +98,8 @@ MODULE_LICENSE("Dual MPL/GPL");
typedef struct scsi_info_t {
dev_link_t link;
dev_node_t node;
struct Scsi_Host *host;
int ndev;
dev_node_t node[8];
} scsi_info_t;
static void aha152x_release_cs(u_long arg);
......@@ -227,8 +226,6 @@ static void aha152x_config_cs(dev_link_t *link)
cisparse_t parse;
int i, last_ret, last_fn;
u_char tuple_data[64];
struct scsi_device *dev;
dev_node_t *node, **tail;
struct Scsi_Host *host;
DEBUG(0, "aha152x_config(0x%p)\n", link);
......@@ -285,9 +282,6 @@ static void aha152x_config_cs(dev_link_t *link)
if (ext_trans)
s.ext_trans = ext_trans;
tail = &link->dev;
info->ndev = 0;
host = aha152x_probe_one(&s);
if (host == NULL) {
printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
......@@ -296,39 +290,10 @@ static void aha152x_config_cs(dev_link_t *link)
scsi_add_host(host, NULL);
list_for_each_entry(dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
((arg[0]>>8)&0xf00) + ((arg[0]>>12)&0xf000);
node = &info->node[info->ndev];
node->minor = 0;
switch (dev->type) {
case TYPE_TAPE:
node->major = SCSI_TAPE_MAJOR;
sprintf(node->dev_name, "st#%04lx", id);
break;
case TYPE_DISK:
case TYPE_MOD:
node->major = SCSI_DISK0_MAJOR;
sprintf(node->dev_name, "sd#%04lx", id);
break;
case TYPE_ROM:
case TYPE_WORM:
node->major = SCSI_CDROM_MAJOR;
sprintf(node->dev_name, "sr#%04lx", id);
break;
default:
node->major = SCSI_GENERIC_MAJOR;
sprintf(node->dev_name, "sg#%04lx", id);
break;
}
*tail = node; tail = &node->next;
info->ndev++;
info->host = dev->host;
}
sprintf(info->node.dev_name, "scsi%d", host->host_no);
link->dev = &info->node;
info->host = host;
*tail = NULL;
link->state &= ~DEV_CONFIG_PENDING;
return;
......
......@@ -81,9 +81,8 @@ static char *version =
typedef struct scsi_info_t {
dev_link_t link;
dev_node_t node;
struct Scsi_Host *host;
int ndev;
dev_node_t node[8];
} scsi_info_t;
extern Scsi_Host_Template fdomain_driver_template;
......@@ -216,8 +215,6 @@ static void fdomain_config(dev_link_t *link)
cisparse_t parse;
int i, last_ret, last_fn, ints[3];
u_char tuple_data[64];
Scsi_Device *dev;
dev_node_t *node, **tail;
char str[16];
struct Scsi_Host *host;
......@@ -269,42 +266,8 @@ static void fdomain_config(dev_link_t *link)
scsi_add_host(host, NULL);
tail = &link->dev;
info->ndev = 0;
list_for_each_entry (dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
((arg[0]>>8)&0xf00) + ((arg[0]>>12)&0xf000);
node = &info->node[info->ndev];
node->minor = 0;
switch (dev->type) {
case TYPE_TAPE:
node->major = SCSI_TAPE_MAJOR;
sprintf(node->dev_name, "st#%04lx", id);
break;
case TYPE_DISK:
case TYPE_MOD:
node->major = SCSI_DISK0_MAJOR;
sprintf(node->dev_name, "sd#%04lx", id);
break;
case TYPE_ROM:
case TYPE_WORM:
node->major = SCSI_CDROM_MAJOR;
sprintf(node->dev_name, "sr#%04lx", id);
break;
default:
node->major = SCSI_GENERIC_MAJOR;
sprintf(node->dev_name, "sg#%04lx", id);
break;
}
*tail = node; tail = &node->next;
info->ndev++;
}
*tail = NULL;
sprintf(info->node.dev_name, "scsi%d", host->host_no);
link->dev = &info->node;
info->host = host;
link->state &= ~DEV_CONFIG_PENDING;
......
......@@ -88,9 +88,8 @@ static char *version = "$Id: nsp_cs.c,v 1.5 2002/11/05 12:06:29 elca Exp $";
typedef struct scsi_info_t {
dev_link_t link;
dev_node_t node;
struct Scsi_Host *host;
int ndev;
dev_node_t node[8];
int stop;
} scsi_info_t;
......@@ -1628,8 +1627,6 @@ static void nsp_cs_config(dev_link_t *link)
memreq_t map;
cistpl_cftable_entry_t dflt = { 0 };
Scsi_Device *dev;
dev_node_t **tail, *node;
struct Scsi_Host *host;
nsp_hw_data *data = &nsp_data;
......@@ -1769,58 +1766,13 @@ static void nsp_cs_config(dev_link_t *link)
goto cs_failed;
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2))
host = __nsp_detect(&nsp_driver_template);
#else
scsi_register_module(MODULE_SCSI_HA, &nsp_driver_template);
for (host = scsi_hostlist; host != NULL; host = host->next) {
if (host->hostt == &nsp_driver_template)
break;
#endif
if (!host)
goto cs_failed;
DEBUG(0, "GET_SCSI_INFO\n");
tail = &link->dev;
info->ndev = 0;
list_for_each_entry (dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
((arg[0]>>8)&0xf00) + ((arg[0]>>12)&0xf000);
node = &info->node[info->ndev];
node->minor = 0;
switch (dev->type) {
case TYPE_TAPE:
node->major = SCSI_TAPE_MAJOR;
sprintf(node->dev_name, "st#%04lx", id);
break;
case TYPE_DISK:
case TYPE_MOD:
node->major = SCSI_DISK0_MAJOR;
sprintf(node->dev_name, "sd#%04lx", id);
break;
case TYPE_ROM:
case TYPE_WORM:
node->major = SCSI_CDROM_MAJOR;
sprintf(node->dev_name, "sr#%04lx", id);
break;
default:
node->major = SCSI_GENERIC_MAJOR;
sprintf(node->dev_name, "sg#%04lx", id);
break;
}
*tail = node; tail = &node->next;
info->ndev++;
info->host = dev->host;
}
*tail = NULL;
if (info->ndev == 0) {
printk(KERN_INFO "nsp_cs: no SCSI devices found\n");
}
sprintf(info->node.dev_name, "scsi%d", host->host_no);
link->dev = &info->node;
info->host = host;
/* Finally, report what we've done */
printk(KERN_INFO "nsp_cs: index 0x%02x: Vcc %d.%d",
......@@ -1844,10 +1796,7 @@ static void nsp_cs_config(dev_link_t *link)
req.Base+req.Size-1);
printk("\n");
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
scsi_add_host(host, NULL);
#endif
link->state &= ~DEV_CONFIG_PENDING;
return;
......
......@@ -85,10 +85,9 @@ MODULE_PARM(irq_list, "1-4i");
typedef struct scsi_info_t {
dev_link_t link;
dev_node_t node;
struct Scsi_Host *host;
unsigned short manf_id;
int ndev;
dev_node_t node[8];
} scsi_info_t;
static void qlogic_release(u_long arg);
......@@ -215,8 +214,6 @@ static void qlogic_config(dev_link_t * link)
cisparse_t parse;
int i, last_ret, last_fn;
unsigned short tuple_data[32];
Scsi_Device *dev;
dev_node_t **tail, *node;
struct Scsi_Host *host;
DEBUG(0, "qlogic_config(0x%p)\n", link);
......@@ -273,51 +270,18 @@ static void qlogic_config(dev_link_t * link)
else
qlogicfas_preset(link->io.BasePort1, link->irq.AssignedIRQ);
tail = &link->dev;
info->ndev = 0;
host = __qlogicfas_detect(&qlogicfas_driver_template);
if (!host) {
printk(KERN_INFO "qlogic_cs: no SCSI devices found\n");
goto out;
}
scsi_add_host(host, NULL);
list_for_each_entry(dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0] & 0x0f) + ((arg[0] >> 4) & 0xf0) + ((arg[0] >> 8) & 0xf00) + ((arg[0] >> 12) & 0xf000);
node = &info->node[info->ndev];
node->minor = 0;
switch (dev->type) {
case TYPE_TAPE:
node->major = SCSI_TAPE_MAJOR;
sprintf(node->dev_name, "st#%04lx", id);
break;
case TYPE_DISK:
case TYPE_MOD:
node->major = SCSI_DISK0_MAJOR;
sprintf(node->dev_name, "sd#%04lx", id);
break;
case TYPE_ROM:
case TYPE_WORM:
node->major = SCSI_CDROM_MAJOR;
sprintf(node->dev_name, "sr#%04lx", id);
break;
default:
node->major = SCSI_GENERIC_MAJOR;
sprintf(node->dev_name, "sg#%04lx", id);
break;
}
*tail = node;
tail = &node->next;
info->ndev++;
}
*tail = NULL;
sprintf(info->node.dev_name, "scsi%d", host->host_no);
link->dev = &info->node;
info->host = host;
scsi_add_host(host, NULL);
out:
link->state &= ~DEV_CONFIG_PENDING;
return;
......
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