summaryrefslogtreecommitdiffstats
path: root/drivers/misc/tifm_7xx1.c
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2007-04-12 16:59:17 +1000
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 13:04:13 +0200
commit6113ed73e61a13db9da48831e1b35788b7f837cc (patch)
treee22d9c8927ea8b987aaf887192e2759959b8527c /drivers/misc/tifm_7xx1.c
parent342c0ec4859446140c0dc5d7d903bb3b3f0577cd (diff)
downloadop-kernel-dev-6113ed73e61a13db9da48831e1b35788b7f837cc.zip
op-kernel-dev-6113ed73e61a13db9da48831e1b35788b7f837cc.tar.gz
tifm: move common adapter management tasks from tifm_7xx1 to tifm_core
Some details of the adapter management (create, add, remove) are really belong to the tifm_core, as they are not hardware specific. Signed-off-by: Alex Dubov <oakad@yahoo.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/misc/tifm_7xx1.c')
-rw-r--r--drivers/misc/tifm_7xx1.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index 3474679..e051f9d 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -22,6 +22,11 @@
#define TIFM_IRQ_FIFOMASK(x) ((x) << 16)
#define TIFM_IRQ_SETALL 0xffffffff
+static void tifm_7xx1_dummy_eject(struct tifm_adapter *fm,
+ struct tifm_dev *sock)
+{
+}
+
static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock)
{
unsigned long flags;
@@ -140,7 +145,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
socket_change_set = fm->socket_change_set;
fm->socket_change_set = 0;
- dev_dbg(fm->dev, "checking media set %x\n",
+ dev_dbg(fm->cdev.dev, "checking media set %x\n",
socket_change_set);
if (!socket_change_set) {
@@ -328,20 +333,13 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
pci_intx(dev, 1);
- fm = tifm_alloc_adapter();
+ fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM
+ ? 4 : 2, &dev->dev);
if (!fm) {
rc = -ENOMEM;
goto err_out_int;
}
- fm->dev = &dev->dev;
- fm->num_sockets = (dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM)
- ? 4 : 2;
- fm->sockets = kzalloc(sizeof(struct tifm_dev*) * fm->num_sockets,
- GFP_KERNEL);
- if (!fm->sockets)
- goto err_out_free;
-
INIT_WORK(&fm->media_switcher, tifm_7xx1_switch_media);
fm->eject = tifm_7xx1_eject;
pci_set_drvdata(dev, fm);
@@ -351,7 +349,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
if (!fm->addr)
goto err_out_free;
- rc = request_irq(dev->irq, tifm_7xx1_isr, IRQF_SHARED, DRIVER_NAME, fm);
+ rc = request_irq(dev->irq, tifm_7xx1_isr, SA_SHIRQ, DRIVER_NAME, fm);
if (rc)
goto err_out_unmap;
@@ -359,10 +357,8 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
if (rc)
goto err_out_irq;
- writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1),
fm->addr + FM_SET_INTERRUPT_ENABLE);
-
return 0;
err_out_irq:
@@ -384,16 +380,12 @@ err_out:
static void tifm_7xx1_remove(struct pci_dev *dev)
{
struct tifm_adapter *fm = pci_get_drvdata(dev);
- unsigned long flags;
+ fm->eject = tifm_7xx1_dummy_eject;
writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
mmiowb();
free_irq(dev->irq, fm);
- spin_lock_irqsave(&fm->lock, flags);
- fm->socket_change_set = (1 << fm->num_sockets) - 1;
- spin_unlock_irqrestore(&fm->lock, flags);
-
tifm_remove_adapter(fm);
pci_set_drvdata(dev, NULL);
OpenPOWER on IntegriCloud