speedfax.c (f9cd49033b349b8be3bb1f01b39eed837853d880) | speedfax.c (ed5a84cdf593e54969518e82762786fbe1284ce4) |
---|---|
1/* 2 * speedfax.c low level stuff for Sedlbauer Speedfax+ cards 3 * based on the ISAR DSP 4 * Thanks to Sedlbauer AG for informations and HW 5 * 6 * Author Karsten Keil <keil@isdn4linux.de> 7 * 8 * Copyright 2009 by Karsten Keil <keil@isdn4linux.de> --- 268 unchanged lines hidden (view full) --- 277 break; 278 default: 279 pr_debug("%s: unknown command %x\n", sf->name, cmd); 280 return -EINVAL; 281 } 282 return err; 283} 284 | 1/* 2 * speedfax.c low level stuff for Sedlbauer Speedfax+ cards 3 * based on the ISAR DSP 4 * Thanks to Sedlbauer AG for informations and HW 5 * 6 * Author Karsten Keil <keil@isdn4linux.de> 7 * 8 * Copyright 2009 by Karsten Keil <keil@isdn4linux.de> --- 268 unchanged lines hidden (view full) --- 277 break; 278 default: 279 pr_debug("%s: unknown command %x\n", sf->name, cmd); 280 return -EINVAL; 281 } 282 return err; 283} 284 |
285static int __devinit | 285static int |
286init_card(struct sfax_hw *sf) 287{ 288 int ret, cnt = 3; 289 u_long flags; 290 291 ret = request_irq(sf->irq, speedfax_irq, IRQF_SHARED, sf->name, sf); 292 if (ret) { 293 pr_info("%s: couldn't get interrupt %d\n", sf->name, sf->irq); --- 22 unchanged lines hidden (view full) --- 316 } else 317 return 0; 318 } 319 free_irq(sf->irq, sf); 320 return -EIO; 321} 322 323 | 286init_card(struct sfax_hw *sf) 287{ 288 int ret, cnt = 3; 289 u_long flags; 290 291 ret = request_irq(sf->irq, speedfax_irq, IRQF_SHARED, sf->name, sf); 292 if (ret) { 293 pr_info("%s: couldn't get interrupt %d\n", sf->name, sf->irq); --- 22 unchanged lines hidden (view full) --- 316 } else 317 return 0; 318 } 319 free_irq(sf->irq, sf); 320 return -EIO; 321} 322 323 |
324static int __devinit | 324static int |
325setup_speedfax(struct sfax_hw *sf) 326{ 327 u_long flags; 328 329 if (!request_region(sf->cfg, 256, sf->name)) { 330 pr_info("mISDN: %s config port %x-%x already in use\n", 331 sf->name, sf->cfg, sf->cfg + 255); 332 return -EIO; --- 33 unchanged lines hidden (view full) --- 366 pci_set_drvdata(card->pdev, NULL); 367 write_lock_irqsave(&card_lock, flags); 368 list_del(&card->list); 369 write_unlock_irqrestore(&card_lock, flags); 370 kfree(card); 371 sfax_cnt--; 372} 373 | 325setup_speedfax(struct sfax_hw *sf) 326{ 327 u_long flags; 328 329 if (!request_region(sf->cfg, 256, sf->name)) { 330 pr_info("mISDN: %s config port %x-%x already in use\n", 331 sf->name, sf->cfg, sf->cfg + 255); 332 return -EIO; --- 33 unchanged lines hidden (view full) --- 366 pci_set_drvdata(card->pdev, NULL); 367 write_lock_irqsave(&card_lock, flags); 368 list_del(&card->list); 369 write_unlock_irqrestore(&card_lock, flags); 370 kfree(card); 371 sfax_cnt--; 372} 373 |
374static int __devinit | 374static int |
375setup_instance(struct sfax_hw *card) 376{ 377 const struct firmware *firmware; 378 int i, err; 379 u_long flags; 380 381 snprintf(card->name, MISDN_MAX_IDLEN - 1, "Speedfax.%d", sfax_cnt + 1); 382 write_lock_irqsave(&card_lock, flags); --- 63 unchanged lines hidden (view full) --- 446 pci_disable_device(card->pdev); 447 write_lock_irqsave(&card_lock, flags); 448 list_del(&card->list); 449 write_unlock_irqrestore(&card_lock, flags); 450 kfree(card); 451 return err; 452} 453 | 375setup_instance(struct sfax_hw *card) 376{ 377 const struct firmware *firmware; 378 int i, err; 379 u_long flags; 380 381 snprintf(card->name, MISDN_MAX_IDLEN - 1, "Speedfax.%d", sfax_cnt + 1); 382 write_lock_irqsave(&card_lock, flags); --- 63 unchanged lines hidden (view full) --- 446 pci_disable_device(card->pdev); 447 write_lock_irqsave(&card_lock, flags); 448 list_del(&card->list); 449 write_unlock_irqrestore(&card_lock, flags); 450 kfree(card); 451 return err; 452} 453 |
454static int __devinit | 454static int |
455sfaxpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 456{ 457 int err = -ENOMEM; 458 struct sfax_hw *card = kzalloc(sizeof(struct sfax_hw), GFP_KERNEL); 459 460 if (!card) { 461 pr_info("No memory for Speedfax+ PCI\n"); 462 return err; --- 12 unchanged lines hidden (view full) --- 475 card->irq = pdev->irq; 476 pci_set_drvdata(pdev, card); 477 err = setup_instance(card); 478 if (err) 479 pci_set_drvdata(pdev, NULL); 480 return err; 481} 482 | 455sfaxpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 456{ 457 int err = -ENOMEM; 458 struct sfax_hw *card = kzalloc(sizeof(struct sfax_hw), GFP_KERNEL); 459 460 if (!card) { 461 pr_info("No memory for Speedfax+ PCI\n"); 462 return err; --- 12 unchanged lines hidden (view full) --- 475 card->irq = pdev->irq; 476 pci_set_drvdata(pdev, card); 477 err = setup_instance(card); 478 if (err) 479 pci_set_drvdata(pdev, NULL); 480 return err; 481} 482 |
483static void __devexit | 483static void |
484sfax_remove_pci(struct pci_dev *pdev) 485{ 486 struct sfax_hw *card = pci_get_drvdata(pdev); 487 488 if (card) 489 release_card(card); 490 else 491 pr_debug("%s: drvdata already removed\n", __func__); 492} 493 | 484sfax_remove_pci(struct pci_dev *pdev) 485{ 486 struct sfax_hw *card = pci_get_drvdata(pdev); 487 488 if (card) 489 release_card(card); 490 else 491 pr_debug("%s: drvdata already removed\n", __func__); 492} 493 |
494static struct pci_device_id sfaxpci_ids[] __devinitdata = { | 494static struct pci_device_id sfaxpci_ids[] = { |
495 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, 496 PCI_SUBVENDOR_SPEEDFAX_PYRAMID, PCI_SUB_ID_SEDLBAUER, 497 0, 0, (unsigned long) "Pyramid Speedfax + PCI" 498 }, 499 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, 500 PCI_SUBVENDOR_SPEEDFAX_PCI, PCI_SUB_ID_SEDLBAUER, 501 0, 0, (unsigned long) "Sedlbauer Speedfax + PCI" 502 }, 503 { } 504}; 505MODULE_DEVICE_TABLE(pci, sfaxpci_ids); 506 507static struct pci_driver sfaxpci_driver = { 508 .name = "speedfax+ pci", 509 .probe = sfaxpci_probe, | 495 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, 496 PCI_SUBVENDOR_SPEEDFAX_PYRAMID, PCI_SUB_ID_SEDLBAUER, 497 0, 0, (unsigned long) "Pyramid Speedfax + PCI" 498 }, 499 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, 500 PCI_SUBVENDOR_SPEEDFAX_PCI, PCI_SUB_ID_SEDLBAUER, 501 0, 0, (unsigned long) "Sedlbauer Speedfax + PCI" 502 }, 503 { } 504}; 505MODULE_DEVICE_TABLE(pci, sfaxpci_ids); 506 507static struct pci_driver sfaxpci_driver = { 508 .name = "speedfax+ pci", 509 .probe = sfaxpci_probe, |
510 .remove = __devexit_p(sfax_remove_pci), | 510 .remove = sfax_remove_pci, |
511 .id_table = sfaxpci_ids, 512}; 513 514static int __init 515Speedfax_init(void) 516{ 517 int err; 518 --- 14 unchanged lines hidden --- | 511 .id_table = sfaxpci_ids, 512}; 513 514static int __init 515Speedfax_init(void) 516{ 517 int err; 518 --- 14 unchanged lines hidden --- |