Skip to contentSkip to conversation

kill pcmcia driver bind_info horror

PATCH New Christoph Hellwig 1 participant 1 message Apr 26, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/scsi/pcmcia/aha152x_stub.c +4 -39
@@ -98,9 +98,8 @@
 
 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 @@
     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 @@
     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 @@
 
     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;
     

===== drivers/scsi/pcmcia/fdomain_stub.c 1.14 vs edited =====

drivers/scsi/pcmcia/fdomain_stub.c +3 -40

62 lines not on this page · raw message

===== drivers/scsi/pcmcia/nsp_cs.c 1.19 vs edited =====

drivers/scsi/pcmcia/nsp_cs.c +4 -55

89 lines not on this page · raw message

===== drivers/scsi/pcmcia/qlogic_stub.c 1.13 vs edited =====

drivers/scsi/pcmcia/qlogic_stub.c +5 -41

73 lines not on this page · raw message