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"); ...@@ -98,9 +98,8 @@ MODULE_LICENSE("Dual MPL/GPL");
typedef struct scsi_info_t { typedef struct scsi_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node;
struct Scsi_Host *host; struct Scsi_Host *host;
int ndev;
dev_node_t node[8];
} scsi_info_t; } scsi_info_t;
static void aha152x_release_cs(u_long arg); static void aha152x_release_cs(u_long arg);
...@@ -227,8 +226,6 @@ static void aha152x_config_cs(dev_link_t *link) ...@@ -227,8 +226,6 @@ static void aha152x_config_cs(dev_link_t *link)
cisparse_t parse; cisparse_t parse;
int i, last_ret, last_fn; int i, last_ret, last_fn;
u_char tuple_data[64]; u_char tuple_data[64];
struct scsi_device *dev;
dev_node_t *node, **tail;
struct Scsi_Host *host; struct Scsi_Host *host;
DEBUG(0, "aha152x_config(0x%p)\n", link); DEBUG(0, "aha152x_config(0x%p)\n", link);
...@@ -285,9 +282,6 @@ static void aha152x_config_cs(dev_link_t *link) ...@@ -285,9 +282,6 @@ static void aha152x_config_cs(dev_link_t *link)
if (ext_trans) if (ext_trans)
s.ext_trans = ext_trans; s.ext_trans = ext_trans;
tail = &link->dev;
info->ndev = 0;
host = aha152x_probe_one(&s); host = aha152x_probe_one(&s);
if (host == NULL) { if (host == NULL) {
printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
...@@ -296,39 +290,10 @@ static void aha152x_config_cs(dev_link_t *link) ...@@ -296,39 +290,10 @@ static void aha152x_config_cs(dev_link_t *link)
scsi_add_host(host, NULL); scsi_add_host(host, NULL);
list_for_each_entry(dev, &host->my_devices, siblings) { sprintf(info->node.dev_name, "scsi%d", host->host_no);
u_long arg[2], id; link->dev = &info->node;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg); info->host = host;
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;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
return; return;
......
...@@ -81,9 +81,8 @@ static char *version = ...@@ -81,9 +81,8 @@ static char *version =
typedef struct scsi_info_t { typedef struct scsi_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node;
struct Scsi_Host *host; struct Scsi_Host *host;
int ndev;
dev_node_t node[8];
} scsi_info_t; } scsi_info_t;
extern Scsi_Host_Template fdomain_driver_template; extern Scsi_Host_Template fdomain_driver_template;
...@@ -216,8 +215,6 @@ static void fdomain_config(dev_link_t *link) ...@@ -216,8 +215,6 @@ static void fdomain_config(dev_link_t *link)
cisparse_t parse; cisparse_t parse;
int i, last_ret, last_fn, ints[3]; int i, last_ret, last_fn, ints[3];
u_char tuple_data[64]; u_char tuple_data[64];
Scsi_Device *dev;
dev_node_t *node, **tail;
char str[16]; char str[16];
struct Scsi_Host *host; struct Scsi_Host *host;
...@@ -269,42 +266,8 @@ static void fdomain_config(dev_link_t *link) ...@@ -269,42 +266,8 @@ static void fdomain_config(dev_link_t *link)
scsi_add_host(host, NULL); scsi_add_host(host, NULL);
tail = &link->dev; sprintf(info->node.dev_name, "scsi%d", host->host_no);
info->ndev = 0; link->dev = &info->node;
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;
info->host = host; info->host = host;
link->state &= ~DEV_CONFIG_PENDING; 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 $"; ...@@ -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 { typedef struct scsi_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node;
struct Scsi_Host *host; struct Scsi_Host *host;
int ndev;
dev_node_t node[8];
int stop; int stop;
} scsi_info_t; } scsi_info_t;
...@@ -1628,8 +1627,6 @@ static void nsp_cs_config(dev_link_t *link) ...@@ -1628,8 +1627,6 @@ static void nsp_cs_config(dev_link_t *link)
memreq_t map; memreq_t map;
cistpl_cftable_entry_t dflt = { 0 }; cistpl_cftable_entry_t dflt = { 0 };
Scsi_Device *dev;
dev_node_t **tail, *node;
struct Scsi_Host *host; struct Scsi_Host *host;
nsp_hw_data *data = &nsp_data; nsp_hw_data *data = &nsp_data;
...@@ -1769,58 +1766,13 @@ static void nsp_cs_config(dev_link_t *link) ...@@ -1769,58 +1766,13 @@ static void nsp_cs_config(dev_link_t *link)
goto cs_failed; goto cs_failed;
} }
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2))
host = __nsp_detect(&nsp_driver_template); 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) if (!host)
goto cs_failed; goto cs_failed;
DEBUG(0, "GET_SCSI_INFO\n"); sprintf(info->node.dev_name, "scsi%d", host->host_no);
tail = &link->dev; link->dev = &info->node;
info->ndev = 0; info->host = host;
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");
}
/* Finally, report what we've done */ /* Finally, report what we've done */
printk(KERN_INFO "nsp_cs: index 0x%02x: Vcc %d.%d", printk(KERN_INFO "nsp_cs: index 0x%02x: Vcc %d.%d",
...@@ -1844,10 +1796,7 @@ static void nsp_cs_config(dev_link_t *link) ...@@ -1844,10 +1796,7 @@ static void nsp_cs_config(dev_link_t *link)
req.Base+req.Size-1); req.Base+req.Size-1);
printk("\n"); printk("\n");
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
scsi_add_host(host, NULL); scsi_add_host(host, NULL);
#endif
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
return; return;
......
...@@ -85,10 +85,9 @@ MODULE_PARM(irq_list, "1-4i"); ...@@ -85,10 +85,9 @@ MODULE_PARM(irq_list, "1-4i");
typedef struct scsi_info_t { typedef struct scsi_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node;
struct Scsi_Host *host; struct Scsi_Host *host;
unsigned short manf_id; unsigned short manf_id;
int ndev;
dev_node_t node[8];
} scsi_info_t; } scsi_info_t;
static void qlogic_release(u_long arg); static void qlogic_release(u_long arg);
...@@ -215,8 +214,6 @@ static void qlogic_config(dev_link_t * link) ...@@ -215,8 +214,6 @@ static void qlogic_config(dev_link_t * link)
cisparse_t parse; cisparse_t parse;
int i, last_ret, last_fn; int i, last_ret, last_fn;
unsigned short tuple_data[32]; unsigned short tuple_data[32];
Scsi_Device *dev;
dev_node_t **tail, *node;
struct Scsi_Host *host; struct Scsi_Host *host;
DEBUG(0, "qlogic_config(0x%p)\n", link); DEBUG(0, "qlogic_config(0x%p)\n", link);
...@@ -273,51 +270,18 @@ static void qlogic_config(dev_link_t * link) ...@@ -273,51 +270,18 @@ static void qlogic_config(dev_link_t * link)
else else
qlogicfas_preset(link->io.BasePort1, link->irq.AssignedIRQ); qlogicfas_preset(link->io.BasePort1, link->irq.AssignedIRQ);
tail = &link->dev;
info->ndev = 0;
host = __qlogicfas_detect(&qlogicfas_driver_template); host = __qlogicfas_detect(&qlogicfas_driver_template);
if (!host) { if (!host) {
printk(KERN_INFO "qlogic_cs: no SCSI devices found\n"); printk(KERN_INFO "qlogic_cs: no SCSI devices found\n");
goto out; goto out;
} }
scsi_add_host(host, NULL); sprintf(info->node.dev_name, "scsi%d", host->host_no);
link->dev = &info->node;
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;
info->host = host; info->host = host;
scsi_add_host(host, NULL);
out: out:
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
return; 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