diff options
Diffstat (limited to 'drivers/scsi/device_handler/scsi_dh_emc.c')
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_emc.c | 58 |
1 files changed, 17 insertions, 41 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index 800deb75a111..6ed1caadbc6a 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c | |||
@@ -650,35 +650,14 @@ static bool clariion_match(struct scsi_device *sdev) | |||
650 | return false; | 650 | return false; |
651 | } | 651 | } |
652 | 652 | ||
653 | static int clariion_bus_attach(struct scsi_device *sdev); | 653 | static struct scsi_dh_data *clariion_bus_attach(struct scsi_device *sdev) |
654 | static void clariion_bus_detach(struct scsi_device *sdev); | ||
655 | |||
656 | static struct scsi_device_handler clariion_dh = { | ||
657 | .name = CLARIION_NAME, | ||
658 | .module = THIS_MODULE, | ||
659 | .attach = clariion_bus_attach, | ||
660 | .detach = clariion_bus_detach, | ||
661 | .check_sense = clariion_check_sense, | ||
662 | .activate = clariion_activate, | ||
663 | .prep_fn = clariion_prep_fn, | ||
664 | .set_params = clariion_set_params, | ||
665 | .match = clariion_match, | ||
666 | }; | ||
667 | |||
668 | static int clariion_bus_attach(struct scsi_device *sdev) | ||
669 | { | 654 | { |
670 | struct clariion_dh_data *h; | 655 | struct clariion_dh_data *h; |
671 | unsigned long flags; | ||
672 | int err; | 656 | int err; |
673 | 657 | ||
674 | h = kzalloc(sizeof(*h) , GFP_KERNEL); | 658 | h = kzalloc(sizeof(*h) , GFP_KERNEL); |
675 | if (!h) { | 659 | if (!h) |
676 | sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n", | 660 | return ERR_PTR(-ENOMEM); |
677 | CLARIION_NAME); | ||
678 | return -ENOMEM; | ||
679 | } | ||
680 | |||
681 | h->dh_data.scsi_dh = &clariion_dh; | ||
682 | h->lun_state = CLARIION_LUN_UNINITIALIZED; | 661 | h->lun_state = CLARIION_LUN_UNINITIALIZED; |
683 | h->default_sp = CLARIION_UNBOUND_LU; | 662 | h->default_sp = CLARIION_UNBOUND_LU; |
684 | h->current_sp = CLARIION_UNBOUND_LU; | 663 | h->current_sp = CLARIION_UNBOUND_LU; |
@@ -691,40 +670,37 @@ static int clariion_bus_attach(struct scsi_device *sdev) | |||
691 | if (err != SCSI_DH_OK) | 670 | if (err != SCSI_DH_OK) |
692 | goto failed; | 671 | goto failed; |
693 | 672 | ||
694 | spin_lock_irqsave(sdev->request_queue->queue_lock, flags); | ||
695 | sdev->scsi_dh_data = &h->dh_data; | ||
696 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); | ||
697 | |||
698 | sdev_printk(KERN_INFO, sdev, | 673 | sdev_printk(KERN_INFO, sdev, |
699 | "%s: connected to SP %c Port %d (%s, default SP %c)\n", | 674 | "%s: connected to SP %c Port %d (%s, default SP %c)\n", |
700 | CLARIION_NAME, h->current_sp + 'A', | 675 | CLARIION_NAME, h->current_sp + 'A', |
701 | h->port, lun_state[h->lun_state], | 676 | h->port, lun_state[h->lun_state], |
702 | h->default_sp + 'A'); | 677 | h->default_sp + 'A'); |
703 | 678 | return &h->dh_data; | |
704 | return 0; | ||
705 | 679 | ||
706 | failed: | 680 | failed: |
707 | kfree(h); | 681 | kfree(h); |
708 | sdev_printk(KERN_ERR, sdev, "%s: not attached\n", | 682 | return ERR_PTR(-EINVAL); |
709 | CLARIION_NAME); | ||
710 | return -EINVAL; | ||
711 | } | 683 | } |
712 | 684 | ||
713 | static void clariion_bus_detach(struct scsi_device *sdev) | 685 | static void clariion_bus_detach(struct scsi_device *sdev) |
714 | { | 686 | { |
715 | struct clariion_dh_data *h = get_clariion_data(sdev); | 687 | struct clariion_dh_data *h = get_clariion_data(sdev); |
716 | unsigned long flags; | ||
717 | |||
718 | spin_lock_irqsave(sdev->request_queue->queue_lock, flags); | ||
719 | sdev->scsi_dh_data = NULL; | ||
720 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); | ||
721 | |||
722 | sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", | ||
723 | CLARIION_NAME); | ||
724 | 688 | ||
725 | kfree(h); | 689 | kfree(h); |
726 | } | 690 | } |
727 | 691 | ||
692 | static struct scsi_device_handler clariion_dh = { | ||
693 | .name = CLARIION_NAME, | ||
694 | .module = THIS_MODULE, | ||
695 | .attach = clariion_bus_attach, | ||
696 | .detach = clariion_bus_detach, | ||
697 | .check_sense = clariion_check_sense, | ||
698 | .activate = clariion_activate, | ||
699 | .prep_fn = clariion_prep_fn, | ||
700 | .set_params = clariion_set_params, | ||
701 | .match = clariion_match, | ||
702 | }; | ||
703 | |||
728 | static int __init clariion_init(void) | 704 | static int __init clariion_init(void) |
729 | { | 705 | { |
730 | int r; | 706 | int r; |