Skip to content

Commit

Permalink
pcmcia: re-work pcmcia_request_irq()
Browse files Browse the repository at this point in the history
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: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed May 10, 2010
1 parent a7debe7 commit eb14120
Show file tree
Hide file tree
Showing 58 changed files with 244 additions and 593 deletions.
10 changes: 10 additions & 0 deletions Documentation/pcmcia/driver-changes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
This file details changes in 2.6 which affect PCMCIA card driver authors:
* New IRQ request rules (as of 2.6.35)
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.

* no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33)
Instead of the cs_error() callback or the CS_CHECK() macro, please use
Expand Down
6 changes: 2 additions & 4 deletions drivers/ata/pata_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
pdev->io.IOAddrLines = 3;
pdev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
pdev->conf.Attributes = CONF_ENABLE_IRQ;
pdev->conf.IntType = INT_MEMORY_AND_IO;

Expand All @@ -293,8 +292,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
}
io_base = pdev->io.BasePort1;
ctl_base = stk->ctl_base;
ret = pcmcia_request_irq(pdev, &pdev->irq);
if (ret)
if (!pdev->irq)
goto failed;

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

/* activate */
ret = ata_host_activate(host, pdev->irq.AssignedIRQ, ata_sff_interrupt,
ret = ata_host_activate(host, pdev->irq, ata_sff_interrupt,
IRQF_SHARED, &pcmcia_sht);
if (ret)
goto failed;
Expand Down
7 changes: 2 additions & 5 deletions drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,6 @@ static int bluecard_probe(struct pcmcia_device *link)

link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;

link->irq.Handler = bluecard_interrupt;

link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
Expand Down Expand Up @@ -908,9 +905,9 @@ static int bluecard_config(struct pcmcia_device *link)
if (i != 0)
goto failed;

i = pcmcia_request_irq(link, &link->irq);
i = pcmcia_request_irq(link, bluecard_interrupt);
if (i != 0)
link->irq.AssignedIRQ = 0;
goto failed;

i = pcmcia_request_configuration(link, &link->conf);
if (i != 0)
Expand Down
7 changes: 2 additions & 5 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,6 @@ static int bt3c_probe(struct pcmcia_device *link)

link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;

link->irq.Handler = bt3c_interrupt;

link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
Expand Down Expand Up @@ -743,9 +740,9 @@ static int bt3c_config(struct pcmcia_device *link)
goto failed;

found_port:
i = pcmcia_request_irq(link, &link->irq);
i = pcmcia_request_irq(link, &bt3c_interrupt);
if (i != 0)
link->irq.AssignedIRQ = 0;
goto failed;

i = pcmcia_request_configuration(link, &link->conf);
if (i != 0)
Expand Down
7 changes: 2 additions & 5 deletions drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,6 @@ static int btuart_probe(struct pcmcia_device *link)

link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;

link->irq.Handler = btuart_interrupt;

link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
Expand Down Expand Up @@ -672,9 +669,9 @@ static int btuart_config(struct pcmcia_device *link)
goto failed;

found_port:
i = pcmcia_request_irq(link, &link->irq);
i = pcmcia_request_irq(link, btuart_interrupt);
if (i != 0)
link->irq.AssignedIRQ = 0;
goto failed;

i = pcmcia_request_configuration(link, &link->conf);
if (i != 0)
Expand Down
7 changes: 2 additions & 5 deletions drivers/bluetooth/dtl1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,6 @@ static int dtl1_probe(struct pcmcia_device *link)

link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;

link->irq.Handler = dtl1_interrupt;

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

i = pcmcia_request_irq(link, &link->irq);
i = pcmcia_request_irq(link, dtl1_interrupt);
if (i != 0)
link->irq.AssignedIRQ = 0;
goto failed;

i = pcmcia_request_configuration(link, &link->conf);
if (i != 0)
Expand Down
11 changes: 2 additions & 9 deletions drivers/char/pcmcia/ipwireless/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,14 @@ static int config_ipwireless(struct ipw_dev *ipw)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;

link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.Handler = ipwireless_interrupt;

INIT_WORK(&ipw->work_reboot, signalled_reboot_work);

ipwireless_init_hardware_v1(ipw->hardware, link->io.BasePort1,
ipw->attr_memory, ipw->common_memory,
ipw->is_v2_card, signalled_reboot_callback,
ipw);

ret = pcmcia_request_irq(link, &link->irq);

ret = pcmcia_request_irq(link, ipwireless_interrupt);
if (ret != 0)
goto exit;

Expand All @@ -217,7 +213,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
(unsigned int) link->io.BasePort1,
(unsigned int) (link->io.BasePort1 +
link->io.NumPorts1 - 1),
(unsigned int) link->irq.AssignedIRQ);
(unsigned int) link->irq);
if (ipw->attr_memory && ipw->common_memory)
printk(KERN_INFO IPWIRELESS_PCCARD_NAME
": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n",
Expand Down Expand Up @@ -271,8 +267,6 @@ static int config_ipwireless(struct ipw_dev *ipw)

static void release_ipwireless(struct ipw_dev *ipw)
{
pcmcia_disable_device(ipw->link);

if (ipw->common_memory) {
release_mem_region(ipw->request_common_memory.Base,
ipw->request_common_memory.Size);
Expand All @@ -288,7 +282,6 @@ static void release_ipwireless(struct ipw_dev *ipw)
if (ipw->attr_memory)
pcmcia_release_window(ipw->link, ipw->handle_attr_memory);

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

Expand Down
12 changes: 3 additions & 9 deletions drivers/char/pcmcia/synclink_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,6 @@ static int mgslpc_probe(struct pcmcia_device *link)

/* Initialize the struct pcmcia_device structure */

/* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.Handler = NULL;

link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;

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

link->irq.Handler = mgslpc_isr;

ret = pcmcia_request_irq(link, &link->irq);
ret = pcmcia_request_irq(link, mgslpc_isr);
if (ret)
goto failed;
ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;

info->io_base = link->io.BasePort1;
info->irq_level = link->irq.AssignedIRQ;
info->irq_level = link->irq;

/* add to linked list of devices */
sprintf(info->node.dev_name, "mgslpc0");
Expand All @@ -628,7 +622,7 @@ static int mgslpc_config(struct pcmcia_device *link)
printk(KERN_INFO "%s: index 0x%02x:",
info->node.dev_name, link->conf.ConfigIndex);
if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq.AssignedIRQ);
printk(", irq %d", link->irq);
if (link->io.NumPorts1)
printk(", io 0x%04x-0x%04x", link->io.BasePort1,
link->io.BasePort1+link->io.NumPorts1-1);
Expand Down
8 changes: 3 additions & 5 deletions drivers/ide/ide-cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ static int ide_probe(struct pcmcia_device *link)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
link->io.IOAddrLines = 3;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;

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

ret = pcmcia_request_irq(link, &link->irq);
if (ret)
if (!link->irq)
goto failed;
ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
Expand All @@ -299,11 +297,11 @@ static int ide_config(struct pcmcia_device *link)
if (is_kme)
outb(0x81, ctl_base+1);

host = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
host = idecs_register(io_base, ctl_base, link->irq, link);
if (host == NULL && link->io.NumPorts1 == 0x20) {
outb(0x02, ctl_base + 0x10);
host = idecs_register(io_base + 0x10, ctl_base + 0x10,
link->irq.AssignedIRQ, link);
link->irq, link);
}

if (host == NULL)
Expand Down
17 changes: 5 additions & 12 deletions drivers/isdn/hardware/avm/avm_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
p_dev->io.NumPorts2 = 0;

/* Interrupt setup */
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;

/* General socket configuration */
p_dev->conf.Attributes = CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
Expand Down Expand Up @@ -172,7 +169,7 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev,
static int avmcs_config(struct pcmcia_device *link)
{
local_info_t *dev;
int i;
int i = -1;
char devname[128];
int cardtype;
int (*addcard)(unsigned int port, unsigned irq);
Expand All @@ -190,11 +187,7 @@ static int avmcs_config(struct pcmcia_device *link)
return -ENODEV;

do {
/*
* allocate an interrupt line
*/
i = pcmcia_request_irq(link, &link->irq);
if (i != 0) {
if (!link->irq) {
/* undo */
pcmcia_disable_device(link);
break;
Expand Down Expand Up @@ -249,9 +242,9 @@ static int avmcs_config(struct pcmcia_device *link)
default:
case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break;
}
if ((i = (*addcard)(link->io.BasePort1, link->irq.AssignedIRQ)) < 0) {
if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) {
printk(KERN_ERR "avm_cs: failed to add AVM-%s-Controller at i/o %#x, irq %d\n",
dev->node.dev_name, link->io.BasePort1, link->irq.AssignedIRQ);
dev->node.dev_name, link->io.BasePort1, link->irq);
avmcs_release(link);
return -ENODEV;
}
Expand All @@ -270,7 +263,7 @@ static int avmcs_config(struct pcmcia_device *link)

static void avmcs_release(struct pcmcia_device *link)
{
b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ);
b1pcmcia_delcard(link->io.BasePort1, link->irq);
pcmcia_disable_device(link);
} /* avmcs_release */

Expand Down
12 changes: 4 additions & 8 deletions drivers/isdn/hisax/avma1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
p_dev->io.IOAddrLines = 5;

/* Interrupt setup */
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;

/* General socket configuration */
p_dev->conf.Attributes = CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
Expand Down Expand Up @@ -177,7 +174,7 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev,
static int __devinit avma1cs_config(struct pcmcia_device *link)
{
local_info_t *dev;
int i;
int i = -1;
char devname[128];
IsdnCard_t icard;
int busy = 0;
Expand All @@ -197,8 +194,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
/*
* allocate an interrupt line
*/
i = pcmcia_request_irq(link, &link->irq);
if (i != 0) {
if (!link->irq) {
/* undo */
pcmcia_disable_device(link);
break;
Expand Down Expand Up @@ -230,9 +226,9 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
}

printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n",
link->io.BasePort1, link->irq.AssignedIRQ);
link->io.BasePort1, link->irq);

icard.para[0] = link->irq.AssignedIRQ;
icard.para[0] = link->irq;
icard.para[1] = link->io.BasePort1;
icard.protocol = isdnprot;
icard.typ = ISDN_CTYPE_A1_PCMCIA;
Expand Down
13 changes: 3 additions & 10 deletions drivers/isdn/hisax/elsa_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link)

local->cardnr = -1;

/* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.Handler = NULL;

/*
General socket configuration defaults can go here. In this
client, we assume very little, and rely on the CIS for almost
Expand Down Expand Up @@ -223,11 +219,8 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
if (i != 0)
goto failed;

i = pcmcia_request_irq(link, &link->irq);
if (i != 0) {
link->irq.AssignedIRQ = 0;
if (!link->irq)
goto failed;
}

i = pcmcia_request_configuration(link, &link->conf);
if (i != 0)
Expand All @@ -244,7 +237,7 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
printk(KERN_INFO "%s: index 0x%02x: ",
dev->node.dev_name, link->conf.ConfigIndex);
if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq.AssignedIRQ);
printk(", irq %d", link->irq);
if (link->io.NumPorts1)
printk(", io 0x%04x-0x%04x", link->io.BasePort1,
link->io.BasePort1+link->io.NumPorts1-1);
Expand All @@ -253,7 +246,7 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
link->io.BasePort2+link->io.NumPorts2-1);
printk("\n");

icard.para[0] = link->irq.AssignedIRQ;
icard.para[0] = link->irq;
icard.para[1] = link->io.BasePort1;
icard.protocol = protocol;
icard.typ = ISDN_CTYPE_ELSA_PCMCIA;
Expand Down
Loading

0 comments on commit eb14120

Please sign in to comment.