diff options
Diffstat (limited to 'drivers/scsi/pcmcia/fdomain_stub.c')
-rw-r--r-- | drivers/scsi/pcmcia/fdomain_stub.c | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 4e6927112c05..80afd3e879cc 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -81,33 +81,32 @@ typedef struct scsi_info_t { | |||
81 | 81 | ||
82 | static void fdomain_release(struct pcmcia_device *link); | 82 | static void fdomain_release(struct pcmcia_device *link); |
83 | static void fdomain_detach(struct pcmcia_device *p_dev); | 83 | static void fdomain_detach(struct pcmcia_device *p_dev); |
84 | static void fdomain_config(struct pcmcia_device *link); | 84 | static int fdomain_config(struct pcmcia_device *link); |
85 | 85 | ||
86 | static int fdomain_attach(struct pcmcia_device *link) | 86 | static int fdomain_probe(struct pcmcia_device *link) |
87 | { | 87 | { |
88 | scsi_info_t *info; | 88 | scsi_info_t *info; |
89 | 89 | ||
90 | DEBUG(0, "fdomain_attach()\n"); | 90 | DEBUG(0, "fdomain_attach()\n"); |
91 | 91 | ||
92 | /* Create new SCSI device */ | 92 | /* Create new SCSI device */ |
93 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 93 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
94 | if (!info) return -ENOMEM; | 94 | if (!info) |
95 | memset(info, 0, sizeof(*info)); | 95 | return -ENOMEM; |
96 | info->p_dev = link; | 96 | |
97 | link->priv = info; | 97 | info->p_dev = link; |
98 | link->io.NumPorts1 = 0x10; | 98 | link->priv = info; |
99 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 99 | link->io.NumPorts1 = 0x10; |
100 | link->io.IOAddrLines = 10; | 100 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
101 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 101 | link->io.IOAddrLines = 10; |
102 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 102 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
103 | link->conf.Attributes = CONF_ENABLE_IRQ; | 103 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
104 | link->conf.IntType = INT_MEMORY_AND_IO; | 104 | link->conf.Attributes = CONF_ENABLE_IRQ; |
105 | link->conf.Present = PRESENT_OPTION; | 105 | link->conf.IntType = INT_MEMORY_AND_IO; |
106 | 106 | link->conf.Present = PRESENT_OPTION; | |
107 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 107 | |
108 | fdomain_config(link); | 108 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
109 | 109 | return fdomain_config(link); | |
110 | return 0; | ||
111 | } /* fdomain_attach */ | 110 | } /* fdomain_attach */ |
112 | 111 | ||
113 | /*====================================================================*/ | 112 | /*====================================================================*/ |
@@ -127,7 +126,7 @@ static void fdomain_detach(struct pcmcia_device *link) | |||
127 | #define CS_CHECK(fn, ret) \ | 126 | #define CS_CHECK(fn, ret) \ |
128 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 127 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
129 | 128 | ||
130 | static void fdomain_config(struct pcmcia_device *link) | 129 | static int fdomain_config(struct pcmcia_device *link) |
131 | { | 130 | { |
132 | scsi_info_t *info = link->priv; | 131 | scsi_info_t *info = link->priv; |
133 | tuple_t tuple; | 132 | tuple_t tuple; |
@@ -150,7 +149,7 @@ static void fdomain_config(struct pcmcia_device *link) | |||
150 | 149 | ||
151 | /* Configure card */ | 150 | /* Configure card */ |
152 | link->state |= DEV_CONFIG; | 151 | link->state |= DEV_CONFIG; |
153 | 152 | ||
154 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 153 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
155 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 154 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
156 | while (1) { | 155 | while (1) { |
@@ -167,35 +166,35 @@ static void fdomain_config(struct pcmcia_device *link) | |||
167 | 166 | ||
168 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 167 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
169 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 168 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
170 | 169 | ||
171 | /* A bad hack... */ | 170 | /* A bad hack... */ |
172 | release_region(link->io.BasePort1, link->io.NumPorts1); | 171 | release_region(link->io.BasePort1, link->io.NumPorts1); |
173 | 172 | ||
174 | /* Set configuration options for the fdomain driver */ | 173 | /* Set configuration options for the fdomain driver */ |
175 | sprintf(str, "%d,%d", link->io.BasePort1, link->irq.AssignedIRQ); | 174 | sprintf(str, "%d,%d", link->io.BasePort1, link->irq.AssignedIRQ); |
176 | fdomain_setup(str); | 175 | fdomain_setup(str); |
177 | 176 | ||
178 | host = __fdomain_16x0_detect(&fdomain_driver_template); | 177 | host = __fdomain_16x0_detect(&fdomain_driver_template); |
179 | if (!host) { | 178 | if (!host) { |
180 | printk(KERN_INFO "fdomain_cs: no SCSI devices found\n"); | 179 | printk(KERN_INFO "fdomain_cs: no SCSI devices found\n"); |
181 | goto cs_failed; | 180 | goto cs_failed; |
182 | } | 181 | } |
183 | 182 | ||
184 | scsi_add_host(host, NULL); /* XXX handle failure */ | 183 | if (scsi_add_host(host, NULL)) |
184 | goto cs_failed; | ||
185 | scsi_scan_host(host); | 185 | scsi_scan_host(host); |
186 | 186 | ||
187 | sprintf(info->node.dev_name, "scsi%d", host->host_no); | 187 | sprintf(info->node.dev_name, "scsi%d", host->host_no); |
188 | link->dev_node = &info->node; | 188 | link->dev_node = &info->node; |
189 | info->host = host; | 189 | info->host = host; |
190 | 190 | ||
191 | link->state &= ~DEV_CONFIG_PENDING; | 191 | link->state &= ~DEV_CONFIG_PENDING; |
192 | return; | 192 | return 0; |
193 | 193 | ||
194 | cs_failed: | 194 | cs_failed: |
195 | cs_error(link, last_fn, last_ret); | 195 | cs_error(link, last_fn, last_ret); |
196 | fdomain_release(link); | 196 | fdomain_release(link); |
197 | return; | 197 | return -ENODEV; |
198 | |||
199 | } /* fdomain_config */ | 198 | } /* fdomain_config */ |
200 | 199 | ||
201 | /*====================================================================*/ | 200 | /*====================================================================*/ |
@@ -234,7 +233,7 @@ static struct pcmcia_driver fdomain_cs_driver = { | |||
234 | .drv = { | 233 | .drv = { |
235 | .name = "fdomain_cs", | 234 | .name = "fdomain_cs", |
236 | }, | 235 | }, |
237 | .probe = fdomain_attach, | 236 | .probe = fdomain_probe, |
238 | .remove = fdomain_detach, | 237 | .remove = fdomain_detach, |
239 | .id_table = fdomain_ids, | 238 | .id_table = fdomain_ids, |
240 | .resume = fdomain_resume, | 239 | .resume = fdomain_resume, |