aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/qlogic_stub.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
commitfba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch)
tree5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/scsi/pcmcia/qlogic_stub.c
parentfd238232cd0ff4840ae6946bb338502154096d88 (diff)
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia/qlogic_stub.c')
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c54
1 files changed, 24 insertions, 30 deletions
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index c6b3e9587ff3..a2a1c4b318e6 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -97,12 +97,12 @@ typedef struct scsi_info_t {
97 unsigned short manf_id; 97 unsigned short manf_id;
98} scsi_info_t; 98} scsi_info_t;
99 99
100static void qlogic_release(dev_link_t *link); 100static void qlogic_release(struct pcmcia_device *link);
101static void qlogic_detach(struct pcmcia_device *p_dev); 101static void qlogic_detach(struct pcmcia_device *p_dev);
102static void qlogic_config(dev_link_t * link); 102static void qlogic_config(struct pcmcia_device * link);
103 103
104static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, 104static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host,
105 dev_link_t *link, int qbase, int qlirq) 105 struct pcmcia_device *link, int qbase, int qlirq)
106{ 106{
107 int qltyp; /* type of chip */ 107 int qltyp; /* type of chip */
108 int qinitid; 108 int qinitid;
@@ -156,10 +156,9 @@ free_scsi_host:
156err: 156err:
157 return NULL; 157 return NULL;
158} 158}
159static int qlogic_attach(struct pcmcia_device *p_dev) 159static int qlogic_attach(struct pcmcia_device *link)
160{ 160{
161 scsi_info_t *info; 161 scsi_info_t *info;
162 dev_link_t *link = dev_to_instance(p_dev);
163 162
164 DEBUG(0, "qlogic_attach()\n"); 163 DEBUG(0, "qlogic_attach()\n");
165 164
@@ -168,7 +167,7 @@ static int qlogic_attach(struct pcmcia_device *p_dev)
168 if (!info) 167 if (!info)
169 return -ENOMEM; 168 return -ENOMEM;
170 memset(info, 0, sizeof(*info)); 169 memset(info, 0, sizeof(*info));
171 info->p_dev = p_dev; 170 info->p_dev = link;
172 link->priv = info; 171 link->priv = info;
173 link->io.NumPorts1 = 16; 172 link->io.NumPorts1 = 16;
174 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 173 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -187,10 +186,8 @@ static int qlogic_attach(struct pcmcia_device *p_dev)
187 186
188/*====================================================================*/ 187/*====================================================================*/
189 188
190static void qlogic_detach(struct pcmcia_device *p_dev) 189static void qlogic_detach(struct pcmcia_device *link)
191{ 190{
192 dev_link_t *link = dev_to_instance(p_dev);
193
194 DEBUG(0, "qlogic_detach(0x%p)\n", link); 191 DEBUG(0, "qlogic_detach(0x%p)\n", link);
195 192
196 if (link->state & DEV_CONFIG) 193 if (link->state & DEV_CONFIG)
@@ -205,9 +202,8 @@ static void qlogic_detach(struct pcmcia_device *p_dev)
205#define CS_CHECK(fn, ret) \ 202#define CS_CHECK(fn, ret) \
206do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 203do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
207 204
208static void qlogic_config(dev_link_t * link) 205static void qlogic_config(struct pcmcia_device * link)
209{ 206{
210 client_handle_t handle = link->handle;
211 scsi_info_t *info = link->priv; 207 scsi_info_t *info = link->priv;
212 tuple_t tuple; 208 tuple_t tuple;
213 cisparse_t parse; 209 cisparse_t parse;
@@ -221,38 +217,38 @@ static void qlogic_config(dev_link_t * link)
221 tuple.TupleDataMax = 64; 217 tuple.TupleDataMax = 64;
222 tuple.TupleOffset = 0; 218 tuple.TupleOffset = 0;
223 tuple.DesiredTuple = CISTPL_CONFIG; 219 tuple.DesiredTuple = CISTPL_CONFIG;
224 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 220 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
225 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 221 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
226 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 222 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
227 link->conf.ConfigBase = parse.config.base; 223 link->conf.ConfigBase = parse.config.base;
228 224
229 tuple.DesiredTuple = CISTPL_MANFID; 225 tuple.DesiredTuple = CISTPL_MANFID;
230 if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) 226 if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS))
231 info->manf_id = le16_to_cpu(tuple.TupleData[0]); 227 info->manf_id = le16_to_cpu(tuple.TupleData[0]);
232 228
233 /* Configure card */ 229 /* Configure card */
234 link->state |= DEV_CONFIG; 230 link->state |= DEV_CONFIG;
235 231
236 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 232 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
237 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 233 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
238 while (1) { 234 while (1) {
239 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 235 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
240 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 236 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
241 goto next_entry; 237 goto next_entry;
242 link->conf.ConfigIndex = parse.cftable_entry.index; 238 link->conf.ConfigIndex = parse.cftable_entry.index;
243 link->io.BasePort1 = parse.cftable_entry.io.win[0].base; 239 link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
244 link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; 240 link->io.NumPorts1 = parse.cftable_entry.io.win[0].len;
245 if (link->io.BasePort1 != 0) { 241 if (link->io.BasePort1 != 0) {
246 i = pcmcia_request_io(handle, &link->io); 242 i = pcmcia_request_io(link, &link->io);
247 if (i == CS_SUCCESS) 243 if (i == CS_SUCCESS)
248 break; 244 break;
249 } 245 }
250 next_entry: 246 next_entry:
251 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 247 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
252 } 248 }
253 249
254 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 250 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
255 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 251 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
256 252
257 if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { 253 if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) {
258 /* set ATAcmd */ 254 /* set ATAcmd */
@@ -283,15 +279,15 @@ out:
283 return; 279 return;
284 280
285cs_failed: 281cs_failed:
286 cs_error(link->handle, last_fn, last_ret); 282 cs_error(link, last_fn, last_ret);
287 pcmcia_disable_device(link->handle); 283 pcmcia_disable_device(link);
288 return; 284 return;
289 285
290} /* qlogic_config */ 286} /* qlogic_config */
291 287
292/*====================================================================*/ 288/*====================================================================*/
293 289
294static void qlogic_release(dev_link_t *link) 290static void qlogic_release(struct pcmcia_device *link)
295{ 291{
296 scsi_info_t *info = link->priv; 292 scsi_info_t *info = link->priv;
297 293
@@ -300,21 +296,19 @@ static void qlogic_release(dev_link_t *link)
300 scsi_remove_host(info->host); 296 scsi_remove_host(info->host);
301 297
302 free_irq(link->irq.AssignedIRQ, info->host); 298 free_irq(link->irq.AssignedIRQ, info->host);
303 pcmcia_disable_device(link->handle); 299 pcmcia_disable_device(link);
304 300
305 scsi_host_put(info->host); 301 scsi_host_put(info->host);
306} 302}
307 303
308/*====================================================================*/ 304/*====================================================================*/
309 305
310static int qlogic_resume(struct pcmcia_device *dev) 306static int qlogic_resume(struct pcmcia_device *link)
311{ 307{
312 dev_link_t *link = dev_to_instance(dev);
313
314 if (link->state & DEV_CONFIG) { 308 if (link->state & DEV_CONFIG) {
315 scsi_info_t *info = link->priv; 309 scsi_info_t *info = link->priv;
316 310
317 pcmcia_request_configuration(link->handle, &link->conf); 311 pcmcia_request_configuration(link, &link->conf);
318 if ((info->manf_id == MANFID_MACNICA) || 312 if ((info->manf_id == MANFID_MACNICA) ||
319 (info->manf_id == MANFID_PIONEER) || 313 (info->manf_id == MANFID_PIONEER) ||
320 (info->manf_id == 0x0098)) { 314 (info->manf_id == 0x0098)) {