aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/fdomain_stub.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:06 -0500
commit15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch)
treecfb8897487beba502aac2b28bc35066a87e34299 /drivers/scsi/pcmcia/fdomain_stub.c
parentfba395eee7d3f342ca739c20f5b3ee635d0420a0 (diff)
[PATCH] pcmcia: add return value to _config() functions
Most of the driver initialization isn't done in the .probe function, but in the internal _config() functions. Make them return a value, so that .probe can properly report whether the probing of the device succeeded or not. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia/fdomain_stub.c')
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c73
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
82static void fdomain_release(struct pcmcia_device *link); 82static void fdomain_release(struct pcmcia_device *link);
83static void fdomain_detach(struct pcmcia_device *p_dev); 83static void fdomain_detach(struct pcmcia_device *p_dev);
84static void fdomain_config(struct pcmcia_device *link); 84static int fdomain_config(struct pcmcia_device *link);
85 85
86static int fdomain_attach(struct pcmcia_device *link) 86static 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) \
128do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 127do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
129 128
130static void fdomain_config(struct pcmcia_device *link) 129static 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
194cs_failed: 194cs_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,