aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/tifm_7xx1.c
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2007-04-12 02:59:17 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 07:04:13 -0400
commit6113ed73e61a13db9da48831e1b35788b7f837cc (patch)
treee22d9c8927ea8b987aaf887192e2759959b8527c /drivers/misc/tifm_7xx1.c
parent342c0ec4859446140c0dc5d7d903bb3b3f0577cd (diff)
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 34746798ba8e..e051f9da9c5c 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -22,6 +22,11 @@
22#define TIFM_IRQ_FIFOMASK(x) ((x) << 16) 22#define TIFM_IRQ_FIFOMASK(x) ((x) << 16)
23#define TIFM_IRQ_SETALL 0xffffffff 23#define TIFM_IRQ_SETALL 0xffffffff
24 24
25static void tifm_7xx1_dummy_eject(struct tifm_adapter *fm,
26 struct tifm_dev *sock)
27{
28}
29
25static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock) 30static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock)
26{ 31{
27 unsigned long flags; 32 unsigned long flags;
@@ -140,7 +145,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
140 socket_change_set = fm->socket_change_set; 145 socket_change_set = fm->socket_change_set;
141 fm->socket_change_set = 0; 146 fm->socket_change_set = 0;
142 147
143 dev_dbg(fm->dev, "checking media set %x\n", 148 dev_dbg(fm->cdev.dev, "checking media set %x\n",
144 socket_change_set); 149 socket_change_set);
145 150
146 if (!socket_change_set) { 151 if (!socket_change_set) {
@@ -328,20 +333,13 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
328 333
329 pci_intx(dev, 1); 334 pci_intx(dev, 1);
330 335
331 fm = tifm_alloc_adapter(); 336 fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM
337 ? 4 : 2, &dev->dev);
332 if (!fm) { 338 if (!fm) {
333 rc = -ENOMEM; 339 rc = -ENOMEM;
334 goto err_out_int; 340 goto err_out_int;
335 } 341 }
336 342
337 fm->dev = &dev->dev;
338 fm->num_sockets = (dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM)
339 ? 4 : 2;
340 fm->sockets = kzalloc(sizeof(struct tifm_dev*) * fm->num_sockets,
341 GFP_KERNEL);
342 if (!fm->sockets)
343 goto err_out_free;
344
345 INIT_WORK(&fm->media_switcher, tifm_7xx1_switch_media); 343 INIT_WORK(&fm->media_switcher, tifm_7xx1_switch_media);
346 fm->eject = tifm_7xx1_eject; 344 fm->eject = tifm_7xx1_eject;
347 pci_set_drvdata(dev, fm); 345 pci_set_drvdata(dev, fm);
@@ -351,7 +349,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
351 if (!fm->addr) 349 if (!fm->addr)
352 goto err_out_free; 350 goto err_out_free;
353 351
354 rc = request_irq(dev->irq, tifm_7xx1_isr, IRQF_SHARED, DRIVER_NAME, fm); 352 rc = request_irq(dev->irq, tifm_7xx1_isr, SA_SHIRQ, DRIVER_NAME, fm);
355 if (rc) 353 if (rc)
356 goto err_out_unmap; 354 goto err_out_unmap;
357 355
@@ -359,10 +357,8 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
359 if (rc) 357 if (rc)
360 goto err_out_irq; 358 goto err_out_irq;
361 359
362 writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
363 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), 360 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1),
364 fm->addr + FM_SET_INTERRUPT_ENABLE); 361 fm->addr + FM_SET_INTERRUPT_ENABLE);
365
366 return 0; 362 return 0;
367 363
368err_out_irq: 364err_out_irq:
@@ -384,16 +380,12 @@ err_out:
384static void tifm_7xx1_remove(struct pci_dev *dev) 380static void tifm_7xx1_remove(struct pci_dev *dev)
385{ 381{
386 struct tifm_adapter *fm = pci_get_drvdata(dev); 382 struct tifm_adapter *fm = pci_get_drvdata(dev);
387 unsigned long flags;
388 383
384 fm->eject = tifm_7xx1_dummy_eject;
389 writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); 385 writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
390 mmiowb(); 386 mmiowb();
391 free_irq(dev->irq, fm); 387 free_irq(dev->irq, fm);
392 388
393 spin_lock_irqsave(&fm->lock, flags);
394 fm->socket_change_set = (1 << fm->num_sockets) - 1;
395 spin_unlock_irqrestore(&fm->lock, flags);
396
397 tifm_remove_adapter(fm); 389 tifm_remove_adapter(fm);
398 390
399 pci_set_drvdata(dev, NULL); 391 pci_set_drvdata(dev, NULL);