aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2009-11-03 08:41:35 -0500
committerGeert Uytterhoeven <geert@linux-m68k.org>2010-02-27 12:31:10 -0500
commitcff75f1fb1f28eba3facb7dbe9b40a892912578a (patch)
tree30bba06578c7ba184bb91df464bf85a3197b7b34 /drivers/scsi
parent80614e5ab1458ff3ccced4d6ba2fa386575c8d5c (diff)
mac68k: move mac_esp platform device
Move platform device code from the driver to the platform init function. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/mac_esp.c57
1 files changed, 5 insertions, 52 deletions
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
index dd808ae942a1..4a90eaf7cb63 100644
--- a/drivers/scsi/mac_esp.c
+++ b/drivers/scsi/mac_esp.c
@@ -52,7 +52,6 @@ struct mac_esp_priv {
52 void __iomem *pdma_io; 52 void __iomem *pdma_io;
53 int error; 53 int error;
54}; 54};
55static struct platform_device *internal_pdev, *external_pdev;
56static struct esp *esp_chips[2]; 55static struct esp *esp_chips[2];
57 56
58#define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \ 57#define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \
@@ -495,29 +494,12 @@ static int __devinit esp_mac_probe(struct platform_device *dev)
495 struct Scsi_Host *host; 494 struct Scsi_Host *host;
496 struct esp *esp; 495 struct esp *esp;
497 int err; 496 int err;
498 int chips_present;
499 struct mac_esp_priv *mep; 497 struct mac_esp_priv *mep;
500 498
501 if (!MACH_IS_MAC) 499 if (!MACH_IS_MAC)
502 return -ENODEV; 500 return -ENODEV;
503 501
504 switch (macintosh_config->scsi_type) { 502 if (dev->id > 1)
505 case MAC_SCSI_QUADRA:
506 case MAC_SCSI_QUADRA3:
507 chips_present = 1;
508 break;
509 case MAC_SCSI_QUADRA2:
510 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
511 (macintosh_config->ident == MAC_MODEL_Q950))
512 chips_present = 2;
513 else
514 chips_present = 1;
515 break;
516 default:
517 chips_present = 0;
518 }
519
520 if (dev->id + 1 > chips_present)
521 return -ENODEV; 503 return -ENODEV;
522 504
523 host = scsi_host_alloc(tpnt, sizeof(struct esp)); 505 host = scsi_host_alloc(tpnt, sizeof(struct esp));
@@ -642,55 +624,26 @@ static struct platform_driver esp_mac_driver = {
642 .probe = esp_mac_probe, 624 .probe = esp_mac_probe,
643 .remove = __devexit_p(esp_mac_remove), 625 .remove = __devexit_p(esp_mac_remove),
644 .driver = { 626 .driver = {
645 .name = DRV_MODULE_NAME, 627 .name = DRV_MODULE_NAME,
628 .owner = THIS_MODULE,
646 }, 629 },
647}; 630};
648 631
649static int __init mac_esp_init(void) 632static int __init mac_esp_init(void)
650{ 633{
651 int err; 634 return platform_driver_register(&esp_mac_driver);
652
653 err = platform_driver_register(&esp_mac_driver);
654 if (err)
655 return err;
656
657 internal_pdev = platform_device_alloc(DRV_MODULE_NAME, 0);
658 if (internal_pdev && platform_device_add(internal_pdev)) {
659 platform_device_put(internal_pdev);
660 internal_pdev = NULL;
661 }
662 external_pdev = platform_device_alloc(DRV_MODULE_NAME, 1);
663 if (external_pdev && platform_device_add(external_pdev)) {
664 platform_device_put(external_pdev);
665 external_pdev = NULL;
666 }
667
668 if (internal_pdev || external_pdev) {
669 return 0;
670 } else {
671 platform_driver_unregister(&esp_mac_driver);
672 return -ENOMEM;
673 }
674} 635}
675 636
676static void __exit mac_esp_exit(void) 637static void __exit mac_esp_exit(void)
677{ 638{
678 platform_driver_unregister(&esp_mac_driver); 639 platform_driver_unregister(&esp_mac_driver);
679
680 if (internal_pdev) {
681 platform_device_unregister(internal_pdev);
682 internal_pdev = NULL;
683 }
684 if (external_pdev) {
685 platform_device_unregister(external_pdev);
686 external_pdev = NULL;
687 }
688} 640}
689 641
690MODULE_DESCRIPTION("Mac ESP SCSI driver"); 642MODULE_DESCRIPTION("Mac ESP SCSI driver");
691MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); 643MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>");
692MODULE_LICENSE("GPL v2"); 644MODULE_LICENSE("GPL v2");
693MODULE_VERSION(DRV_VERSION); 645MODULE_VERSION(DRV_VERSION);
646MODULE_ALIAS("platform:" DRV_MODULE_NAME);
694 647
695module_init(mac_esp_init); 648module_init(mac_esp_init);
696module_exit(mac_esp_exit); 649module_exit(mac_esp_exit);