Skip to content

Commit eb14120

Browse files
author
Dominik Brodowski
committed
pcmcia: re-work pcmcia_request_irq()
Instead of the old pcmcia_request_irq() interface, drivers may now choose between: - calling request_irq/free_irq directly. Use the IRQ from *p_dev->irq. - use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will clean up automatically on calls to pcmcia_disable_device() or device ejection. - drivers still not capable of IRQF_SHARED (or not telling us so) may use the deprecated pcmcia_request_exclusive_irq() for the time being; they might receive a shared IRQ nonetheless. CC: linux-bluetooth@vger.kernel.org CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-serial@vger.kernel.org CC: alsa-devel@alsa-project.org CC: linux-usb@vger.kernel.org CC: linux-ide@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
1 parent a7debe7 commit eb14120

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+244
-593
lines changed

Documentation/pcmcia/driver-changes.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
This file details changes in 2.6 which affect PCMCIA card driver authors:
2+
* New IRQ request rules (as of 2.6.35)
3+
Instead of the old pcmcia_request_irq() interface, drivers may now
4+
choose between:
5+
- calling request_irq/free_irq directly. Use the IRQ from *p_dev->irq.
6+
- use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
7+
clean up automatically on calls to pcmcia_disable_device() or
8+
device ejection.
9+
- drivers still not capable of IRQF_SHARED (or not telling us so) may
10+
use the deprecated pcmcia_request_exclusive_irq() for the time
11+
being; they might receive a shared IRQ nonetheless.
212

313
* no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33)
414
Instead of the cs_error() callback or the CS_CHECK() macro, please use

drivers/ata/pata_pcmcia.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
268268
pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
269269
pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
270270
pdev->io.IOAddrLines = 3;
271-
pdev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
272271
pdev->conf.Attributes = CONF_ENABLE_IRQ;
273272
pdev->conf.IntType = INT_MEMORY_AND_IO;
274273

@@ -293,8 +292,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
293292
}
294293
io_base = pdev->io.BasePort1;
295294
ctl_base = stk->ctl_base;
296-
ret = pcmcia_request_irq(pdev, &pdev->irq);
297-
if (ret)
295+
if (!pdev->irq)
298296
goto failed;
299297

300298
ret = pcmcia_request_configuration(pdev, &pdev->conf);
@@ -344,7 +342,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
344342
}
345343

346344
/* activate */
347-
ret = ata_host_activate(host, pdev->irq.AssignedIRQ, ata_sff_interrupt,
345+
ret = ata_host_activate(host, pdev->irq, ata_sff_interrupt,
348346
IRQF_SHARED, &pcmcia_sht);
349347
if (ret)
350348
goto failed;

drivers/bluetooth/bluecard_cs.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,6 @@ static int bluecard_probe(struct pcmcia_device *link)
869869

870870
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
871871
link->io.NumPorts1 = 8;
872-
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
873-
874-
link->irq.Handler = bluecard_interrupt;
875872

876873
link->conf.Attributes = CONF_ENABLE_IRQ;
877874
link->conf.IntType = INT_MEMORY_AND_IO;
@@ -908,9 +905,9 @@ static int bluecard_config(struct pcmcia_device *link)
908905
if (i != 0)
909906
goto failed;
910907

911-
i = pcmcia_request_irq(link, &link->irq);
908+
i = pcmcia_request_irq(link, bluecard_interrupt);
912909
if (i != 0)
913-
link->irq.AssignedIRQ = 0;
910+
goto failed;
914911

915912
i = pcmcia_request_configuration(link, &link->conf);
916913
if (i != 0)

drivers/bluetooth/bt3c_cs.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,6 @@ static int bt3c_probe(struct pcmcia_device *link)
661661

662662
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
663663
link->io.NumPorts1 = 8;
664-
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
665-
666-
link->irq.Handler = bt3c_interrupt;
667664

668665
link->conf.Attributes = CONF_ENABLE_IRQ;
669666
link->conf.IntType = INT_MEMORY_AND_IO;
@@ -743,9 +740,9 @@ static int bt3c_config(struct pcmcia_device *link)
743740
goto failed;
744741

745742
found_port:
746-
i = pcmcia_request_irq(link, &link->irq);
743+
i = pcmcia_request_irq(link, &bt3c_interrupt);
747744
if (i != 0)
748-
link->irq.AssignedIRQ = 0;
745+
goto failed;
749746

750747
i = pcmcia_request_configuration(link, &link->conf);
751748
if (i != 0)

drivers/bluetooth/btuart_cs.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,6 @@ static int btuart_probe(struct pcmcia_device *link)
590590

591591
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
592592
link->io.NumPorts1 = 8;
593-
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
594-
595-
link->irq.Handler = btuart_interrupt;
596593

597594
link->conf.Attributes = CONF_ENABLE_IRQ;
598595
link->conf.IntType = INT_MEMORY_AND_IO;
@@ -672,9 +669,9 @@ static int btuart_config(struct pcmcia_device *link)
672669
goto failed;
673670

674671
found_port:
675-
i = pcmcia_request_irq(link, &link->irq);
672+
i = pcmcia_request_irq(link, btuart_interrupt);
676673
if (i != 0)
677-
link->irq.AssignedIRQ = 0;
674+
goto failed;
678675

679676
i = pcmcia_request_configuration(link, &link->conf);
680677
if (i != 0)

drivers/bluetooth/dtl1_cs.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,6 @@ static int dtl1_probe(struct pcmcia_device *link)
575575

576576
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
577577
link->io.NumPorts1 = 8;
578-
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
579-
580-
link->irq.Handler = dtl1_interrupt;
581578

582579
link->conf.Attributes = CONF_ENABLE_IRQ;
583580
link->conf.IntType = INT_MEMORY_AND_IO;
@@ -621,9 +618,9 @@ static int dtl1_config(struct pcmcia_device *link)
621618
if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0)
622619
goto failed;
623620

624-
i = pcmcia_request_irq(link, &link->irq);
621+
i = pcmcia_request_irq(link, dtl1_interrupt);
625622
if (i != 0)
626-
link->irq.AssignedIRQ = 0;
623+
goto failed;
627624

628625
i = pcmcia_request_configuration(link, &link->conf);
629626
if (i != 0)

drivers/char/pcmcia/ipwireless/main.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,14 @@ static int config_ipwireless(struct ipw_dev *ipw)
195195
link->conf.Attributes = CONF_ENABLE_IRQ;
196196
link->conf.IntType = INT_MEMORY_AND_IO;
197197

198-
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
199-
link->irq.Handler = ipwireless_interrupt;
200-
201198
INIT_WORK(&ipw->work_reboot, signalled_reboot_work);
202199

203200
ipwireless_init_hardware_v1(ipw->hardware, link->io.BasePort1,
204201
ipw->attr_memory, ipw->common_memory,
205202
ipw->is_v2_card, signalled_reboot_callback,
206203
ipw);
207204

208-
ret = pcmcia_request_irq(link, &link->irq);
209-
205+
ret = pcmcia_request_irq(link, ipwireless_interrupt);
210206
if (ret != 0)
211207
goto exit;
212208

@@ -217,7 +213,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
217213
(unsigned int) link->io.BasePort1,
218214
(unsigned int) (link->io.BasePort1 +
219215
link->io.NumPorts1 - 1),
220-
(unsigned int) link->irq.AssignedIRQ);
216+
(unsigned int) link->irq);
221217
if (ipw->attr_memory && ipw->common_memory)
222218
printk(KERN_INFO IPWIRELESS_PCCARD_NAME
223219
": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n",
@@ -271,8 +267,6 @@ static int config_ipwireless(struct ipw_dev *ipw)
271267

272268
static void release_ipwireless(struct ipw_dev *ipw)
273269
{
274-
pcmcia_disable_device(ipw->link);
275-
276270
if (ipw->common_memory) {
277271
release_mem_region(ipw->request_common_memory.Base,
278272
ipw->request_common_memory.Size);
@@ -288,7 +282,6 @@ static void release_ipwireless(struct ipw_dev *ipw)
288282
if (ipw->attr_memory)
289283
pcmcia_release_window(ipw->link, ipw->handle_attr_memory);
290284

291-
/* Break the link with Card Services */
292285
pcmcia_disable_device(ipw->link);
293286
}
294287

drivers/char/pcmcia/synclink_cs.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
552552

553553
/* Initialize the struct pcmcia_device structure */
554554

555-
/* Interrupt setup */
556-
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
557-
link->irq.Handler = NULL;
558-
559555
link->conf.Attributes = 0;
560556
link->conf.IntType = INT_MEMORY_AND_IO;
561557

@@ -608,17 +604,15 @@ static int mgslpc_config(struct pcmcia_device *link)
608604
link->conf.ConfigIndex = 8;
609605
link->conf.Present = PRESENT_OPTION;
610606

611-
link->irq.Handler = mgslpc_isr;
612-
613-
ret = pcmcia_request_irq(link, &link->irq);
607+
ret = pcmcia_request_irq(link, mgslpc_isr);
614608
if (ret)
615609
goto failed;
616610
ret = pcmcia_request_configuration(link, &link->conf);
617611
if (ret)
618612
goto failed;
619613

620614
info->io_base = link->io.BasePort1;
621-
info->irq_level = link->irq.AssignedIRQ;
615+
info->irq_level = link->irq;
622616

623617
/* add to linked list of devices */
624618
sprintf(info->node.dev_name, "mgslpc0");
@@ -628,7 +622,7 @@ static int mgslpc_config(struct pcmcia_device *link)
628622
printk(KERN_INFO "%s: index 0x%02x:",
629623
info->node.dev_name, link->conf.ConfigIndex);
630624
if (link->conf.Attributes & CONF_ENABLE_IRQ)
631-
printk(", irq %d", link->irq.AssignedIRQ);
625+
printk(", irq %d", link->irq);
632626
if (link->io.NumPorts1)
633627
printk(", io 0x%04x-0x%04x", link->io.BasePort1,
634628
link->io.BasePort1+link->io.NumPorts1-1);

drivers/ide/ide-cs.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ static int ide_probe(struct pcmcia_device *link)
102102
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
103103
link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
104104
link->io.IOAddrLines = 3;
105-
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
106105
link->conf.Attributes = CONF_ENABLE_IRQ;
107106
link->conf.IntType = INT_MEMORY_AND_IO;
108107

@@ -285,8 +284,7 @@ static int ide_config(struct pcmcia_device *link)
285284
io_base = link->io.BasePort1;
286285
ctl_base = stk->ctl_base;
287286

288-
ret = pcmcia_request_irq(link, &link->irq);
289-
if (ret)
287+
if (!link->irq)
290288
goto failed;
291289
ret = pcmcia_request_configuration(link, &link->conf);
292290
if (ret)
@@ -299,11 +297,11 @@ static int ide_config(struct pcmcia_device *link)
299297
if (is_kme)
300298
outb(0x81, ctl_base+1);
301299

302-
host = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
300+
host = idecs_register(io_base, ctl_base, link->irq, link);
303301
if (host == NULL && link->io.NumPorts1 == 0x20) {
304302
outb(0x02, ctl_base + 0x10);
305303
host = idecs_register(io_base + 0x10, ctl_base + 0x10,
306-
link->irq.AssignedIRQ, link);
304+
link->irq, link);
307305
}
308306

309307
if (host == NULL)

drivers/isdn/hardware/avm/avm_cs.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
107107
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
108108
p_dev->io.NumPorts2 = 0;
109109

110-
/* Interrupt setup */
111-
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
112-
113110
/* General socket configuration */
114111
p_dev->conf.Attributes = CONF_ENABLE_IRQ;
115112
p_dev->conf.IntType = INT_MEMORY_AND_IO;
@@ -172,7 +169,7 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev,
172169
static int avmcs_config(struct pcmcia_device *link)
173170
{
174171
local_info_t *dev;
175-
int i;
172+
int i = -1;
176173
char devname[128];
177174
int cardtype;
178175
int (*addcard)(unsigned int port, unsigned irq);
@@ -190,11 +187,7 @@ static int avmcs_config(struct pcmcia_device *link)
190187
return -ENODEV;
191188

192189
do {
193-
/*
194-
* allocate an interrupt line
195-
*/
196-
i = pcmcia_request_irq(link, &link->irq);
197-
if (i != 0) {
190+
if (!link->irq) {
198191
/* undo */
199192
pcmcia_disable_device(link);
200193
break;
@@ -249,9 +242,9 @@ static int avmcs_config(struct pcmcia_device *link)
249242
default:
250243
case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break;
251244
}
252-
if ((i = (*addcard)(link->io.BasePort1, link->irq.AssignedIRQ)) < 0) {
245+
if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) {
253246
printk(KERN_ERR "avm_cs: failed to add AVM-%s-Controller at i/o %#x, irq %d\n",
254-
dev->node.dev_name, link->io.BasePort1, link->irq.AssignedIRQ);
247+
dev->node.dev_name, link->io.BasePort1, link->irq);
255248
avmcs_release(link);
256249
return -ENODEV;
257250
}
@@ -270,7 +263,7 @@ static int avmcs_config(struct pcmcia_device *link)
270263

271264
static void avmcs_release(struct pcmcia_device *link)
272265
{
273-
b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ);
266+
b1pcmcia_delcard(link->io.BasePort1, link->irq);
274267
pcmcia_disable_device(link);
275268
} /* avmcs_release */
276269

0 commit comments

Comments
 (0)