diff options
-rw-r--r-- | arch/m68k/mac/config.c | 27 | ||||
-rw-r--r-- | drivers/scsi/mac_esp.c | 57 |
2 files changed, 32 insertions, 52 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index c8a4c39cef56..91245ade2290 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -911,6 +911,16 @@ static struct platform_device swim_pdev = { | |||
911 | .resource = &swim_rsrc, | 911 | .resource = &swim_rsrc, |
912 | }; | 912 | }; |
913 | 913 | ||
914 | static struct platform_device esp_0_pdev = { | ||
915 | .name = "mac_esp", | ||
916 | .id = 0, | ||
917 | }; | ||
918 | |||
919 | static struct platform_device esp_1_pdev = { | ||
920 | .name = "mac_esp", | ||
921 | .id = 1, | ||
922 | }; | ||
923 | |||
914 | int __init mac_platform_init(void) | 924 | int __init mac_platform_init(void) |
915 | { | 925 | { |
916 | u8 *swim_base; | 926 | u8 *swim_base; |
@@ -944,6 +954,23 @@ int __init mac_platform_init(void) | |||
944 | platform_device_register(&swim_pdev); | 954 | platform_device_register(&swim_pdev); |
945 | } | 955 | } |
946 | 956 | ||
957 | /* | ||
958 | * SCSI device(s) | ||
959 | */ | ||
960 | |||
961 | switch (macintosh_config->scsi_type) { | ||
962 | case MAC_SCSI_QUADRA: | ||
963 | case MAC_SCSI_QUADRA3: | ||
964 | platform_device_register(&esp_0_pdev); | ||
965 | break; | ||
966 | case MAC_SCSI_QUADRA2: | ||
967 | platform_device_register(&esp_0_pdev); | ||
968 | if ((macintosh_config->ident == MAC_MODEL_Q900) || | ||
969 | (macintosh_config->ident == MAC_MODEL_Q950)) | ||
970 | platform_device_register(&esp_1_pdev); | ||
971 | break; | ||
972 | } | ||
973 | |||
947 | return 0; | 974 | return 0; |
948 | } | 975 | } |
949 | 976 | ||
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 | }; |
55 | static struct platform_device *internal_pdev, *external_pdev; | ||
56 | static struct esp *esp_chips[2]; | 55 | static 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 | ||
649 | static int __init mac_esp_init(void) | 632 | static 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 | ||
676 | static void __exit mac_esp_exit(void) | 637 | static 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 | ||
690 | MODULE_DESCRIPTION("Mac ESP SCSI driver"); | 642 | MODULE_DESCRIPTION("Mac ESP SCSI driver"); |
691 | MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); | 643 | MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); |
692 | MODULE_LICENSE("GPL v2"); | 644 | MODULE_LICENSE("GPL v2"); |
693 | MODULE_VERSION(DRV_VERSION); | 645 | MODULE_VERSION(DRV_VERSION); |
646 | MODULE_ALIAS("platform:" DRV_MODULE_NAME); | ||
694 | 647 | ||
695 | module_init(mac_esp_init); | 648 | module_init(mac_esp_init); |
696 | module_exit(mac_esp_exit); | 649 | module_exit(mac_esp_exit); |