diff options
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r-- | drivers/scsi/libsas/sas_discover.c | 45 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 8 |
2 files changed, 20 insertions, 33 deletions
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index b6ba0e053d1a..a65598b1e536 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c | |||
@@ -577,8 +577,6 @@ int sas_discover_sata(struct domain_device *dev) | |||
577 | out_err: | 577 | out_err: |
578 | sas_notify_lldd_dev_gone(dev); | 578 | sas_notify_lldd_dev_gone(dev); |
579 | out_err2: | 579 | out_err2: |
580 | sas_rphy_free(dev->rphy); | ||
581 | dev->rphy = NULL; | ||
582 | return res; | 580 | return res; |
583 | } | 581 | } |
584 | 582 | ||
@@ -600,24 +598,11 @@ int sas_discover_end_dev(struct domain_device *dev) | |||
600 | if (res) | 598 | if (res) |
601 | goto out_err; | 599 | goto out_err; |
602 | 600 | ||
603 | /* do this to get the end device port attributes which will have | ||
604 | * been scanned in sas_rphy_add */ | ||
605 | sas_notify_lldd_dev_gone(dev); | ||
606 | res = sas_notify_lldd_dev_found(dev); | ||
607 | if (res) | ||
608 | goto out_err3; | ||
609 | |||
610 | return 0; | 601 | return 0; |
611 | 602 | ||
612 | out_err: | 603 | out_err: |
613 | sas_notify_lldd_dev_gone(dev); | 604 | sas_notify_lldd_dev_gone(dev); |
614 | out_err2: | 605 | out_err2: |
615 | sas_rphy_free(dev->rphy); | ||
616 | dev->rphy = NULL; | ||
617 | return res; | ||
618 | out_err3: | ||
619 | sas_rphy_delete(dev->rphy); | ||
620 | dev->rphy = NULL; | ||
621 | return res; | 606 | return res; |
622 | } | 607 | } |
623 | 608 | ||
@@ -672,6 +657,7 @@ void sas_unregister_domain_devices(struct asd_sas_port *port) | |||
672 | */ | 657 | */ |
673 | static void sas_discover_domain(struct work_struct *work) | 658 | static void sas_discover_domain(struct work_struct *work) |
674 | { | 659 | { |
660 | struct domain_device *dev; | ||
675 | int error = 0; | 661 | int error = 0; |
676 | struct sas_discovery_event *ev = | 662 | struct sas_discovery_event *ev = |
677 | container_of(work, struct sas_discovery_event, work); | 663 | container_of(work, struct sas_discovery_event, work); |
@@ -681,39 +667,42 @@ static void sas_discover_domain(struct work_struct *work) | |||
681 | &port->disc.pending); | 667 | &port->disc.pending); |
682 | 668 | ||
683 | if (port->port_dev) | 669 | if (port->port_dev) |
684 | return ; | 670 | return; |
685 | else { | 671 | |
686 | error = sas_get_port_device(port); | 672 | error = sas_get_port_device(port); |
687 | if (error) | 673 | if (error) |
688 | return; | 674 | return; |
689 | } | 675 | dev = port->port_dev; |
690 | 676 | ||
691 | SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, | 677 | SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, |
692 | current->pid); | 678 | current->pid); |
693 | 679 | ||
694 | switch (port->port_dev->dev_type) { | 680 | switch (dev->dev_type) { |
695 | case SAS_END_DEV: | 681 | case SAS_END_DEV: |
696 | error = sas_discover_end_dev(port->port_dev); | 682 | error = sas_discover_end_dev(dev); |
697 | break; | 683 | break; |
698 | case EDGE_DEV: | 684 | case EDGE_DEV: |
699 | case FANOUT_DEV: | 685 | case FANOUT_DEV: |
700 | error = sas_discover_root_expander(port->port_dev); | 686 | error = sas_discover_root_expander(dev); |
701 | break; | 687 | break; |
702 | case SATA_DEV: | 688 | case SATA_DEV: |
703 | case SATA_PM: | 689 | case SATA_PM: |
704 | error = sas_discover_sata(port->port_dev); | 690 | error = sas_discover_sata(dev); |
705 | break; | 691 | break; |
706 | default: | 692 | default: |
707 | SAS_DPRINTK("unhandled device %d\n", port->port_dev->dev_type); | 693 | SAS_DPRINTK("unhandled device %d\n", dev->dev_type); |
708 | break; | 694 | break; |
709 | } | 695 | } |
710 | 696 | ||
711 | if (error) { | 697 | if (error) { |
698 | sas_rphy_free(dev->rphy); | ||
699 | dev->rphy = NULL; | ||
700 | |||
712 | spin_lock(&port->dev_list_lock); | 701 | spin_lock(&port->dev_list_lock); |
713 | list_del_init(&port->port_dev->dev_list_node); | 702 | list_del_init(&dev->dev_list_node); |
714 | spin_unlock(&port->dev_list_lock); | 703 | spin_unlock(&port->dev_list_lock); |
715 | 704 | ||
716 | kfree(port->port_dev); /* not kobject_register-ed yet */ | 705 | kfree(dev); /* not kobject_register-ed yet */ |
717 | port->port_dev = NULL; | 706 | port->port_dev = NULL; |
718 | } | 707 | } |
719 | 708 | ||
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 0dfd97e7e96c..d9b9a008d36d 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -667,6 +667,8 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
667 | return child; | 667 | return child; |
668 | 668 | ||
669 | out_list_del: | 669 | out_list_del: |
670 | sas_rphy_free(child->rphy); | ||
671 | child->rphy = NULL; | ||
670 | list_del(&child->dev_list_node); | 672 | list_del(&child->dev_list_node); |
671 | out_free: | 673 | out_free: |
672 | sas_port_delete(phy->port); | 674 | sas_port_delete(phy->port); |
@@ -1444,12 +1446,8 @@ int sas_discover_root_expander(struct domain_device *dev) | |||
1444 | return res; | 1446 | return res; |
1445 | 1447 | ||
1446 | out_err2: | 1448 | out_err2: |
1447 | sas_rphy_delete(dev->rphy); | 1449 | sas_rphy_remove(dev->rphy); |
1448 | dev->rphy = NULL; | ||
1449 | return res; | ||
1450 | out_err: | 1450 | out_err: |
1451 | sas_rphy_free(dev->rphy); | ||
1452 | dev->rphy = NULL; | ||
1453 | return res; | 1451 | return res; |
1454 | } | 1452 | } |
1455 | 1453 | ||