aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/aha152x_stub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/pcmcia/aha152x_stub.c')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 0c196fbb3121..21c6b1014535 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -94,24 +94,23 @@ typedef struct scsi_info_t {
94 struct Scsi_Host *host; 94 struct Scsi_Host *host;
95} scsi_info_t; 95} scsi_info_t;
96 96
97static void aha152x_release_cs(dev_link_t *link); 97static void aha152x_release_cs(struct pcmcia_device *link);
98static void aha152x_detach(struct pcmcia_device *p_dev); 98static void aha152x_detach(struct pcmcia_device *p_dev);
99static void aha152x_config_cs(dev_link_t *link); 99static void aha152x_config_cs(struct pcmcia_device *link);
100 100
101static dev_link_t *dev_list; 101static struct pcmcia_device *dev_list;
102 102
103static int aha152x_attach(struct pcmcia_device *p_dev) 103static int aha152x_attach(struct pcmcia_device *link)
104{ 104{
105 scsi_info_t *info; 105 scsi_info_t *info;
106 dev_link_t *link = dev_to_instance(p_dev); 106
107
108 DEBUG(0, "aha152x_attach()\n"); 107 DEBUG(0, "aha152x_attach()\n");
109 108
110 /* Create new SCSI device */ 109 /* Create new SCSI device */
111 info = kmalloc(sizeof(*info), GFP_KERNEL); 110 info = kmalloc(sizeof(*info), GFP_KERNEL);
112 if (!info) return -ENOMEM; 111 if (!info) return -ENOMEM;
113 memset(info, 0, sizeof(*info)); 112 memset(info, 0, sizeof(*info));
114 info->p_dev = p_dev; 113 info->p_dev = link;
115 link->priv = info; 114 link->priv = info;
116 115
117 link->io.NumPorts1 = 0x20; 116 link->io.NumPorts1 = 0x20;
@@ -131,10 +130,8 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
131 130
132/*====================================================================*/ 131/*====================================================================*/
133 132
134static void aha152x_detach(struct pcmcia_device *p_dev) 133static void aha152x_detach(struct pcmcia_device *link)
135{ 134{
136 dev_link_t *link = dev_to_instance(p_dev);
137
138 DEBUG(0, "aha152x_detach(0x%p)\n", link); 135 DEBUG(0, "aha152x_detach(0x%p)\n", link);
139 136
140 if (link->state & DEV_CONFIG) 137 if (link->state & DEV_CONFIG)
@@ -149,9 +146,8 @@ static void aha152x_detach(struct pcmcia_device *p_dev)
149#define CS_CHECK(fn, ret) \ 146#define CS_CHECK(fn, ret) \
150do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 147do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
151 148
152static void aha152x_config_cs(dev_link_t *link) 149static void aha152x_config_cs(struct pcmcia_device *link)
153{ 150{
154 client_handle_t handle = link->handle;
155 scsi_info_t *info = link->priv; 151 scsi_info_t *info = link->priv;
156 struct aha152x_setup s; 152 struct aha152x_setup s;
157 tuple_t tuple; 153 tuple_t tuple;
@@ -166,19 +162,19 @@ static void aha152x_config_cs(dev_link_t *link)
166 tuple.TupleData = tuple_data; 162 tuple.TupleData = tuple_data;
167 tuple.TupleDataMax = 64; 163 tuple.TupleDataMax = 64;
168 tuple.TupleOffset = 0; 164 tuple.TupleOffset = 0;
169 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 165 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
170 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 166 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
171 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 167 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
172 link->conf.ConfigBase = parse.config.base; 168 link->conf.ConfigBase = parse.config.base;
173 169
174 /* Configure card */ 170 /* Configure card */
175 link->state |= DEV_CONFIG; 171 link->state |= DEV_CONFIG;
176 172
177 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 173 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
178 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 174 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
179 while (1) { 175 while (1) {
180 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 176 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
181 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 177 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
182 goto next_entry; 178 goto next_entry;
183 /* For New Media T&J, look for a SCSI window */ 179 /* For New Media T&J, look for a SCSI window */
184 if (parse.cftable_entry.io.win[0].len >= 0x20) 180 if (parse.cftable_entry.io.win[0].len >= 0x20)
@@ -189,15 +185,15 @@ static void aha152x_config_cs(dev_link_t *link)
189 if ((parse.cftable_entry.io.nwin > 0) && 185 if ((parse.cftable_entry.io.nwin > 0) &&
190 (link->io.BasePort1 < 0xffff)) { 186 (link->io.BasePort1 < 0xffff)) {
191 link->conf.ConfigIndex = parse.cftable_entry.index; 187 link->conf.ConfigIndex = parse.cftable_entry.index;
192 i = pcmcia_request_io(handle, &link->io); 188 i = pcmcia_request_io(link, &link->io);
193 if (i == CS_SUCCESS) break; 189 if (i == CS_SUCCESS) break;
194 } 190 }
195 next_entry: 191 next_entry:
196 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 192 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
197 } 193 }
198 194
199 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 195 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
200 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 196 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
201 197
202 /* Set configuration options for the aha152x driver */ 198 /* Set configuration options for the aha152x driver */
203 memset(&s, 0, sizeof(s)); 199 memset(&s, 0, sizeof(s));
@@ -226,22 +222,21 @@ static void aha152x_config_cs(dev_link_t *link)
226 return; 222 return;
227 223
228cs_failed: 224cs_failed:
229 cs_error(link->handle, last_fn, last_ret); 225 cs_error(link, last_fn, last_ret);
230 aha152x_release_cs(link); 226 aha152x_release_cs(link);
231 return; 227 return;
232} 228}
233 229
234static void aha152x_release_cs(dev_link_t *link) 230static void aha152x_release_cs(struct pcmcia_device *link)
235{ 231{
236 scsi_info_t *info = link->priv; 232 scsi_info_t *info = link->priv;
237 233
238 aha152x_release(info->host); 234 aha152x_release(info->host);
239 pcmcia_disable_device(link->handle); 235 pcmcia_disable_device(link);
240} 236}
241 237
242static int aha152x_resume(struct pcmcia_device *dev) 238static int aha152x_resume(struct pcmcia_device *link)
243{ 239{
244 dev_link_t *link = dev_to_instance(dev);
245 scsi_info_t *info = link->priv; 240 scsi_info_t *info = link->priv;
246 241
247 aha152x_host_reset_host(info->host); 242 aha152x_host_reset_host(info->host);