diff options
Diffstat (limited to 'drivers/scsi/pcmcia/aha152x_stub.c')
-rw-r--r-- | drivers/scsi/pcmcia/aha152x_stub.c | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 3128ba8c57a9..0c9edb7051f4 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -95,27 +95,21 @@ typedef struct scsi_info_t { | |||
95 | } scsi_info_t; | 95 | } scsi_info_t; |
96 | 96 | ||
97 | static void aha152x_release_cs(dev_link_t *link); | 97 | static void aha152x_release_cs(dev_link_t *link); |
98 | static int aha152x_event(event_t event, int priority, | ||
99 | event_callback_args_t *args); | ||
100 | |||
101 | static dev_link_t *aha152x_attach(void); | ||
102 | static void aha152x_detach(struct pcmcia_device *p_dev); | 98 | static void aha152x_detach(struct pcmcia_device *p_dev); |
99 | static void aha152x_config_cs(dev_link_t *link); | ||
103 | 100 | ||
104 | static dev_link_t *dev_list; | 101 | static dev_link_t *dev_list; |
105 | static dev_info_t dev_info = "aha152x_cs"; | ||
106 | 102 | ||
107 | static dev_link_t *aha152x_attach(void) | 103 | static int aha152x_attach(struct pcmcia_device *p_dev) |
108 | { | 104 | { |
109 | scsi_info_t *info; | 105 | scsi_info_t *info; |
110 | client_reg_t client_reg; | ||
111 | dev_link_t *link; | 106 | dev_link_t *link; |
112 | int ret; | ||
113 | 107 | ||
114 | DEBUG(0, "aha152x_attach()\n"); | 108 | DEBUG(0, "aha152x_attach()\n"); |
115 | 109 | ||
116 | /* Create new SCSI device */ | 110 | /* Create new SCSI device */ |
117 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 111 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
118 | if (!info) return NULL; | 112 | if (!info) return -ENOMEM; |
119 | memset(info, 0, sizeof(*info)); | 113 | memset(info, 0, sizeof(*info)); |
120 | link = &info->link; link->priv = info; | 114 | link = &info->link; link->priv = info; |
121 | 115 | ||
@@ -129,20 +123,13 @@ static dev_link_t *aha152x_attach(void) | |||
129 | link->conf.IntType = INT_MEMORY_AND_IO; | 123 | link->conf.IntType = INT_MEMORY_AND_IO; |
130 | link->conf.Present = PRESENT_OPTION; | 124 | link->conf.Present = PRESENT_OPTION; |
131 | 125 | ||
132 | /* Register with Card Services */ | 126 | link->handle = p_dev; |
133 | link->next = dev_list; | 127 | p_dev->instance = link; |
134 | dev_list = link; | 128 | |
135 | client_reg.dev_info = &dev_info; | 129 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
136 | client_reg.Version = 0x0210; | 130 | aha152x_config_cs(link); |
137 | client_reg.event_callback_args.client_data = link; | 131 | |
138 | ret = pcmcia_register_client(&link->handle, &client_reg); | 132 | return 0; |
139 | if (ret != 0) { | ||
140 | cs_error(link->handle, RegisterClient, ret); | ||
141 | aha152x_detach(link->handle); | ||
142 | return NULL; | ||
143 | } | ||
144 | |||
145 | return link; | ||
146 | } /* aha152x_attach */ | 133 | } /* aha152x_attach */ |
147 | 134 | ||
148 | /*====================================================================*/ | 135 | /*====================================================================*/ |
@@ -297,22 +284,6 @@ static int aha152x_resume(struct pcmcia_device *dev) | |||
297 | return 0; | 284 | return 0; |
298 | } | 285 | } |
299 | 286 | ||
300 | static int aha152x_event(event_t event, int priority, | ||
301 | event_callback_args_t *args) | ||
302 | { | ||
303 | dev_link_t *link = args->client_data; | ||
304 | |||
305 | DEBUG(0, "aha152x_event(0x%06x)\n", event); | ||
306 | |||
307 | switch (event) { | ||
308 | case CS_EVENT_CARD_INSERTION: | ||
309 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
310 | aha152x_config_cs(link); | ||
311 | break; | ||
312 | } | ||
313 | return 0; | ||
314 | } | ||
315 | |||
316 | static struct pcmcia_device_id aha152x_ids[] = { | 287 | static struct pcmcia_device_id aha152x_ids[] = { |
317 | PCMCIA_DEVICE_PROD_ID123("New Media", "SCSI", "Bus Toaster", 0xcdf7e4cc, 0x35f26476, 0xa8851d6e), | 288 | PCMCIA_DEVICE_PROD_ID123("New Media", "SCSI", "Bus Toaster", 0xcdf7e4cc, 0x35f26476, 0xa8851d6e), |
318 | PCMCIA_DEVICE_PROD_ID123("NOTEWORTHY", "SCSI", "Bus Toaster", 0xad89c6e8, 0x35f26476, 0xa8851d6e), | 289 | PCMCIA_DEVICE_PROD_ID123("NOTEWORTHY", "SCSI", "Bus Toaster", 0xad89c6e8, 0x35f26476, 0xa8851d6e), |
@@ -328,8 +299,7 @@ static struct pcmcia_driver aha152x_cs_driver = { | |||
328 | .drv = { | 299 | .drv = { |
329 | .name = "aha152x_cs", | 300 | .name = "aha152x_cs", |
330 | }, | 301 | }, |
331 | .attach = aha152x_attach, | 302 | .probe = aha152x_attach, |
332 | .event = aha152x_event, | ||
333 | .remove = aha152x_detach, | 303 | .remove = aha152x_detach, |
334 | .id_table = aha152x_ids, | 304 | .id_table = aha152x_ids, |
335 | .suspend = aha152x_suspend, | 305 | .suspend = aha152x_suspend, |