diff options
-rw-r--r-- | drivers/scsi/hpsa.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 2764cb605693..6b40221a7220 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -675,6 +675,24 @@ lun_assigned: | |||
675 | return 0; | 675 | return 0; |
676 | } | 676 | } |
677 | 677 | ||
678 | /* Replace an entry from h->dev[] array. */ | ||
679 | static void hpsa_scsi_replace_entry(struct ctlr_info *h, int hostno, | ||
680 | int entry, struct hpsa_scsi_dev_t *new_entry, | ||
681 | struct hpsa_scsi_dev_t *added[], int *nadded, | ||
682 | struct hpsa_scsi_dev_t *removed[], int *nremoved) | ||
683 | { | ||
684 | /* assumes h->devlock is held */ | ||
685 | BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA); | ||
686 | removed[*nremoved] = h->dev[entry]; | ||
687 | (*nremoved)++; | ||
688 | h->dev[entry] = new_entry; | ||
689 | added[*nadded] = new_entry; | ||
690 | (*nadded)++; | ||
691 | dev_info(&h->pdev->dev, "%s device c%db%dt%dl%d changed.\n", | ||
692 | scsi_device_type(new_entry->devtype), hostno, new_entry->bus, | ||
693 | new_entry->target, new_entry->lun); | ||
694 | } | ||
695 | |||
678 | /* Remove an entry from h->dev[] array. */ | 696 | /* Remove an entry from h->dev[] array. */ |
679 | static void hpsa_scsi_remove_entry(struct ctlr_info *h, int hostno, int entry, | 697 | static void hpsa_scsi_remove_entry(struct ctlr_info *h, int hostno, int entry, |
680 | struct hpsa_scsi_dev_t *removed[], int *nremoved) | 698 | struct hpsa_scsi_dev_t *removed[], int *nremoved) |
@@ -835,12 +853,8 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno, | |||
835 | continue; /* remove ^^^, hence i not incremented */ | 853 | continue; /* remove ^^^, hence i not incremented */ |
836 | } else if (device_change == DEVICE_CHANGED) { | 854 | } else if (device_change == DEVICE_CHANGED) { |
837 | changes++; | 855 | changes++; |
838 | hpsa_scsi_remove_entry(h, hostno, i, | 856 | hpsa_scsi_replace_entry(h, hostno, i, sd[entry], |
839 | removed, &nremoved); | 857 | added, &nadded, removed, &nremoved); |
840 | (void) hpsa_scsi_add_entry(h, hostno, sd[entry], | ||
841 | added, &nadded); | ||
842 | /* add can't fail, we just removed one. */ | ||
843 | |||
844 | /* Set it to NULL to prevent it from being freed | 858 | /* Set it to NULL to prevent it from being freed |
845 | * at the bottom of hpsa_update_scsi_devices() | 859 | * at the bottom of hpsa_update_scsi_devices() |
846 | */ | 860 | */ |