aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pcmcia/vx/vxpocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pcmcia/vx/vxpocket.c')
-rw-r--r--sound/pcmcia/vx/vxpocket.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 87ec48c6af28..f6eed4259d17 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -59,9 +59,9 @@ static unsigned int card_alloc;
59 59
60/* 60/*
61 */ 61 */
62static void vxpocket_release(dev_link_t *link) 62static void vxpocket_release(struct pcmcia_device *link)
63{ 63{
64 pcmcia_disable_device(link->handle); 64 pcmcia_disable_device(link);
65} 65}
66 66
67/* 67/*
@@ -127,17 +127,14 @@ static struct snd_vx_hardware vxp440_hw = {
127 * create vxpocket instance 127 * create vxpocket instance
128 */ 128 */
129static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, 129static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
130 struct pcmcia_device *p_dev) 130 struct pcmcia_device *link)
131{ 131{
132 dev_link_t *link; /* Info for cardmgr */
133 struct vx_core *chip; 132 struct vx_core *chip;
134 struct snd_vxpocket *vxp; 133 struct snd_vxpocket *vxp;
135 static struct snd_device_ops ops = { 134 static struct snd_device_ops ops = {
136 .dev_free = snd_vxpocket_dev_free, 135 .dev_free = snd_vxpocket_dev_free,
137 }; 136 };
138 137
139 link = dev_to_instance(p_dev);
140
141 chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, 138 chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops,
142 sizeof(struct snd_vxpocket) - sizeof(struct vx_core)); 139 sizeof(struct snd_vxpocket) - sizeof(struct vx_core));
143 if (! chip) 140 if (! chip)
@@ -151,7 +148,7 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
151 148
152 vxp = (struct snd_vxpocket *)chip; 149 vxp = (struct snd_vxpocket *)chip;
153 150
154 vxp->p_dev = p_dev; 151 vxp->p_dev = link;
155 link->priv = chip; 152 link->priv = chip;
156 153
157 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 154 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -211,9 +208,8 @@ static int snd_vxpocket_assign_resources(struct vx_core *chip, int port, int irq
211#define CS_CHECK(fn, ret) \ 208#define CS_CHECK(fn, ret) \
212do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 209do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
213 210
214static void vxpocket_config(dev_link_t *link) 211static void vxpocket_config(struct pcmcia_device *link)
215{ 212{
216 client_handle_t handle = link->handle;
217 struct vx_core *chip = link->priv; 213 struct vx_core *chip = link->priv;
218 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; 214 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
219 tuple_t tuple; 215 tuple_t tuple;
@@ -232,17 +228,17 @@ static void vxpocket_config(dev_link_t *link)
232 tuple.TupleDataMax = sizeof(buf); 228 tuple.TupleDataMax = sizeof(buf);
233 tuple.TupleOffset = 0; 229 tuple.TupleOffset = 0;
234 tuple.DesiredTuple = CISTPL_CONFIG; 230 tuple.DesiredTuple = CISTPL_CONFIG;
235 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 231 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
236 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 232 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
237 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); 233 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
238 link->conf.ConfigBase = parse->config.base; 234 link->conf.ConfigBase = parse->config.base;
239 link->conf.Present = parse->config.rmask[0]; 235 link->conf.Present = parse->config.rmask[0];
240 236
241 /* redefine hardware record according to the VERSION1 string */ 237 /* redefine hardware record according to the VERSION1 string */
242 tuple.DesiredTuple = CISTPL_VERS_1; 238 tuple.DesiredTuple = CISTPL_VERS_1;
243 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 239 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
244 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 240 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
245 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); 241 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
246 if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) { 242 if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) {
247 snd_printdd("VX-pocket is detected\n"); 243 snd_printdd("VX-pocket is detected\n");
248 } else { 244 } else {
@@ -256,11 +252,11 @@ static void vxpocket_config(dev_link_t *link)
256 /* Configure card */ 252 /* Configure card */
257 link->state |= DEV_CONFIG; 253 link->state |= DEV_CONFIG;
258 254
259 CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io)); 255 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
260 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 256 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
261 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 257 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
262 258
263 chip->dev = &handle_to_dev(link->handle); 259 chip->dev = &handle_to_dev(link);
264 snd_card_set_dev(chip->card, chip->dev); 260 snd_card_set_dev(chip->card, chip->dev);
265 261
266 if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) 262 if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
@@ -272,17 +268,16 @@ static void vxpocket_config(dev_link_t *link)
272 return; 268 return;
273 269
274cs_failed: 270cs_failed:
275 cs_error(link->handle, last_fn, last_ret); 271 cs_error(link, last_fn, last_ret);
276failed: 272failed:
277 pcmcia_disable_device(link->handle); 273 pcmcia_disable_device(link);
278 kfree(parse); 274 kfree(parse);
279} 275}
280 276
281#ifdef CONFIG_PM 277#ifdef CONFIG_PM
282 278
283static int vxp_suspend(struct pcmcia_device *dev) 279static int vxp_suspend(struct pcmcia_device *link)
284{ 280{
285 dev_link_t *link = dev_to_instance(dev);
286 struct vx_core *chip = link->priv; 281 struct vx_core *chip = link->priv;
287 282
288 snd_printdd(KERN_DEBUG "SUSPEND\n"); 283 snd_printdd(KERN_DEBUG "SUSPEND\n");
@@ -294,9 +289,8 @@ static int vxp_suspend(struct pcmcia_device *dev)
294 return 0; 289 return 0;
295} 290}
296 291
297static int vxp_resume(struct pcmcia_device *dev) 292static int vxp_resume(struct pcmcia_device *link)
298{ 293{
299 dev_link_t *link = dev_to_instance(dev);
300 struct vx_core *chip = link->priv; 294 struct vx_core *chip = link->priv;
301 295
302 snd_printdd(KERN_DEBUG "RESUME\n"); 296 snd_printdd(KERN_DEBUG "RESUME\n");
@@ -360,9 +354,8 @@ static int vxpocket_attach(struct pcmcia_device *p_dev)
360 return 0; 354 return 0;
361} 355}
362 356
363static void vxpocket_detach(struct pcmcia_device *p_dev) 357static void vxpocket_detach(struct pcmcia_device *link)
364{ 358{
365 dev_link_t *link = dev_to_instance(p_dev);
366 struct snd_vxpocket *vxp; 359 struct snd_vxpocket *vxp;
367 struct vx_core *chip; 360 struct vx_core *chip;
368 361