aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/device_handler/scsi_dh_alua.c6
-rw-r--r--drivers/scsi/device_handler/scsi_dh_emc.c29
-rw-r--r--drivers/scsi/device_handler/scsi_dh_hp_sw.c30
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c50
-rw-r--r--drivers/scsi/scsi_dh.c84
5 files changed, 66 insertions, 133 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 854b568b9931..ace2457747a7 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -819,11 +819,6 @@ static int alua_prep_fn(struct scsi_device *sdev, struct request *req)
819 819
820} 820}
821 821
822static bool alua_match(struct scsi_device *sdev)
823{
824 return (scsi_device_tpgs(sdev) != 0);
825}
826
827/* 822/*
828 * alua_bus_attach - Attach device handler 823 * alua_bus_attach - Attach device handler
829 * @sdev: device to be attached to 824 * @sdev: device to be attached to
@@ -877,7 +872,6 @@ static struct scsi_device_handler alua_dh = {
877 .check_sense = alua_check_sense, 872 .check_sense = alua_check_sense,
878 .activate = alua_activate, 873 .activate = alua_activate,
879 .set_params = alua_set_params, 874 .set_params = alua_set_params,
880 .match = alua_match,
881}; 875};
882 876
883static int __init alua_init(void) 877static int __init alua_init(void)
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
index 6ed1caadbc6a..fd31e67e9f50 100644
--- a/drivers/scsi/device_handler/scsi_dh_emc.c
+++ b/drivers/scsi/device_handler/scsi_dh_emc.c
@@ -622,34 +622,6 @@ done:
622 return result; 622 return result;
623} 623}
624 624
625static const struct {
626 char *vendor;
627 char *model;
628} clariion_dev_list[] = {
629 {"DGC", "RAID"},
630 {"DGC", "DISK"},
631 {"DGC", "VRAID"},
632 {NULL, NULL},
633};
634
635static bool clariion_match(struct scsi_device *sdev)
636{
637 int i;
638
639 if (scsi_device_tpgs(sdev))
640 return false;
641
642 for (i = 0; clariion_dev_list[i].vendor; i++) {
643 if (!strncmp(sdev->vendor, clariion_dev_list[i].vendor,
644 strlen(clariion_dev_list[i].vendor)) &&
645 !strncmp(sdev->model, clariion_dev_list[i].model,
646 strlen(clariion_dev_list[i].model))) {
647 return true;
648 }
649 }
650 return false;
651}
652
653static struct scsi_dh_data *clariion_bus_attach(struct scsi_device *sdev) 625static struct scsi_dh_data *clariion_bus_attach(struct scsi_device *sdev)
654{ 626{
655 struct clariion_dh_data *h; 627 struct clariion_dh_data *h;
@@ -698,7 +670,6 @@ static struct scsi_device_handler clariion_dh = {
698 .activate = clariion_activate, 670 .activate = clariion_activate,
699 .prep_fn = clariion_prep_fn, 671 .prep_fn = clariion_prep_fn,
700 .set_params = clariion_set_params, 672 .set_params = clariion_set_params,
701 .match = clariion_match,
702}; 673};
703 674
704static int __init clariion_init(void) 675static int __init clariion_init(void)
diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
index 485d99544a15..1bf10d37289a 100644
--- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
+++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
@@ -311,35 +311,6 @@ static int hp_sw_activate(struct scsi_device *sdev,
311 return 0; 311 return 0;
312} 312}
313 313
314static const struct {
315 char *vendor;
316 char *model;
317} hp_sw_dh_data_list[] = {
318 {"COMPAQ", "MSA1000 VOLUME"},
319 {"COMPAQ", "HSV110"},
320 {"HP", "HSV100"},
321 {"DEC", "HSG80"},
322 {NULL, NULL},
323};
324
325static bool hp_sw_match(struct scsi_device *sdev)
326{
327 int i;
328
329 if (scsi_device_tpgs(sdev))
330 return false;
331
332 for (i = 0; hp_sw_dh_data_list[i].vendor; i++) {
333 if (!strncmp(sdev->vendor, hp_sw_dh_data_list[i].vendor,
334 strlen(hp_sw_dh_data_list[i].vendor)) &&
335 !strncmp(sdev->model, hp_sw_dh_data_list[i].model,
336 strlen(hp_sw_dh_data_list[i].model))) {
337 return true;
338 }
339 }
340 return false;
341}
342
343static struct scsi_dh_data *hp_sw_bus_attach(struct scsi_device *sdev) 314static struct scsi_dh_data *hp_sw_bus_attach(struct scsi_device *sdev)
344{ 315{
345 struct hp_sw_dh_data *h; 316 struct hp_sw_dh_data *h;
@@ -379,7 +350,6 @@ static struct scsi_device_handler hp_sw_dh = {
379 .detach = hp_sw_bus_detach, 350 .detach = hp_sw_bus_detach,
380 .activate = hp_sw_activate, 351 .activate = hp_sw_activate,
381 .prep_fn = hp_sw_prep_fn, 352 .prep_fn = hp_sw_prep_fn,
382 .match = hp_sw_match,
383}; 353};
384 354
385static int __init hp_sw_init(void) 355static int __init hp_sw_init(void)
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index b46ace3d4bf0..d89616fe3ffa 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -778,55 +778,6 @@ static int rdac_check_sense(struct scsi_device *sdev,
778 return SCSI_RETURN_NOT_HANDLED; 778 return SCSI_RETURN_NOT_HANDLED;
779} 779}
780 780
781static const struct {
782 char *vendor;
783 char *model;
784} rdac_dev_list[] = {
785 {"IBM", "1722"},
786 {"IBM", "1724"},
787 {"IBM", "1726"},
788 {"IBM", "1742"},
789 {"IBM", "1745"},
790 {"IBM", "1746"},
791 {"IBM", "1813"},
792 {"IBM", "1814"},
793 {"IBM", "1815"},
794 {"IBM", "1818"},
795 {"IBM", "3526"},
796 {"SGI", "TP9"},
797 {"SGI", "IS"},
798 {"STK", "OPENstorage D280"},
799 {"STK", "FLEXLINE 380"},
800 {"SUN", "CSM"},
801 {"SUN", "LCSM100"},
802 {"SUN", "STK6580_6780"},
803 {"SUN", "SUN_6180"},
804 {"SUN", "ArrayStorage"},
805 {"DELL", "MD3"},
806 {"NETAPP", "INF-01-00"},
807 {"LSI", "INF-01-00"},
808 {"ENGENIO", "INF-01-00"},
809 {NULL, NULL},
810};
811
812static bool rdac_match(struct scsi_device *sdev)
813{
814 int i;
815
816 if (scsi_device_tpgs(sdev))
817 return false;
818
819 for (i = 0; rdac_dev_list[i].vendor; i++) {
820 if (!strncmp(sdev->vendor, rdac_dev_list[i].vendor,
821 strlen(rdac_dev_list[i].vendor)) &&
822 !strncmp(sdev->model, rdac_dev_list[i].model,
823 strlen(rdac_dev_list[i].model))) {
824 return true;
825 }
826 }
827 return false;
828}
829
830static struct scsi_dh_data *rdac_bus_attach(struct scsi_device *sdev) 781static struct scsi_dh_data *rdac_bus_attach(struct scsi_device *sdev)
831{ 782{
832 struct rdac_dh_data *h; 783 struct rdac_dh_data *h;
@@ -895,7 +846,6 @@ static struct scsi_device_handler rdac_dh = {
895 .attach = rdac_bus_attach, 846 .attach = rdac_bus_attach,
896 .detach = rdac_bus_detach, 847 .detach = rdac_bus_detach,
897 .activate = rdac_activate, 848 .activate = rdac_activate,
898 .match = rdac_match,
899}; 849};
900 850
901static int __init rdac_init(void) 851static int __init rdac_init(void)
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
index f0dfdccc060e..9c153309c96b 100644
--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -29,6 +29,67 @@
29static DEFINE_SPINLOCK(list_lock); 29static DEFINE_SPINLOCK(list_lock);
30static LIST_HEAD(scsi_dh_list); 30static LIST_HEAD(scsi_dh_list);
31 31
32struct scsi_dh_blist {
33 const char *vendor;
34 const char *model;
35 const char *driver;
36};
37
38static const struct scsi_dh_blist scsi_dh_blist[] = {
39 {"DGC", "RAID", "clariion" },
40 {"DGC", "DISK", "clariion" },
41 {"DGC", "VRAID", "clariion" },
42
43 {"COMPAQ", "MSA1000 VOLUME", "hp_sw" },
44 {"COMPAQ", "HSV110", "hp_sw" },
45 {"HP", "HSV100", "hp_sw"},
46 {"DEC", "HSG80", "hp_sw"},
47
48 {"IBM", "1722", "rdac", },
49 {"IBM", "1724", "rdac", },
50 {"IBM", "1726", "rdac", },
51 {"IBM", "1742", "rdac", },
52 {"IBM", "1745", "rdac", },
53 {"IBM", "1746", "rdac", },
54 {"IBM", "1813", "rdac", },
55 {"IBM", "1814", "rdac", },
56 {"IBM", "1815", "rdac", },
57 {"IBM", "1818", "rdac", },
58 {"IBM", "3526", "rdac", },
59 {"SGI", "TP9", "rdac", },
60 {"SGI", "IS", "rdac", },
61 {"STK", "OPENstorage D280", "rdac", },
62 {"STK", "FLEXLINE 380", "rdac", },
63 {"SUN", "CSM", "rdac", },
64 {"SUN", "LCSM100", "rdac", },
65 {"SUN", "STK6580_6780", "rdac", },
66 {"SUN", "SUN_6180", "rdac", },
67 {"SUN", "ArrayStorage", "rdac", },
68 {"DELL", "MD3", "rdac", },
69 {"NETAPP", "INF-01-00", "rdac", },
70 {"LSI", "INF-01-00", "rdac", },
71 {"ENGENIO", "INF-01-00", "rdac", },
72 {NULL, NULL, NULL },
73};
74
75static const char *
76scsi_dh_find_driver(struct scsi_device *sdev)
77{
78 const struct scsi_dh_blist *b;
79
80 if (scsi_device_tpgs(sdev))
81 return "alua";
82
83 for (b = scsi_dh_blist; b->vendor; b++) {
84 if (!strncmp(sdev->vendor, b->vendor, strlen(b->vendor)) &&
85 !strncmp(sdev->model, b->model, strlen(b->model))) {
86 return b->driver;
87 }
88 }
89 return NULL;
90}
91
92
32static struct scsi_device_handler *__scsi_dh_lookup(const char *name) 93static struct scsi_device_handler *__scsi_dh_lookup(const char *name)
33{ 94{
34 struct scsi_device_handler *tmp, *found = NULL; 95 struct scsi_device_handler *tmp, *found = NULL;
@@ -57,22 +118,6 @@ static struct scsi_device_handler *scsi_dh_lookup(const char *name)
57 return dh; 118 return dh;
58} 119}
59 120
60static struct scsi_device_handler *
61device_handler_match(struct scsi_device *sdev)
62{
63 struct scsi_device_handler *tmp_dh, *found_dh = NULL;
64
65 spin_lock(&list_lock);
66 list_for_each_entry(tmp_dh, &scsi_dh_list, list) {
67 if (tmp_dh->match && tmp_dh->match(sdev)) {
68 found_dh = tmp_dh;
69 break;
70 }
71 }
72 spin_unlock(&list_lock);
73 return found_dh;
74}
75
76/* 121/*
77 * scsi_dh_handler_attach - Attach a device handler to a device 122 * scsi_dh_handler_attach - Attach a device handler to a device
78 * @sdev - SCSI device the device handler should attach to 123 * @sdev - SCSI device the device handler should attach to
@@ -184,14 +229,17 @@ static struct device_attribute scsi_dh_state_attr =
184 229
185int scsi_dh_add_device(struct scsi_device *sdev) 230int scsi_dh_add_device(struct scsi_device *sdev)
186{ 231{
187 struct scsi_device_handler *devinfo; 232 struct scsi_device_handler *devinfo = NULL;
233 const char *drv;
188 int err; 234 int err;
189 235
190 err = device_create_file(&sdev->sdev_gendev, &scsi_dh_state_attr); 236 err = device_create_file(&sdev->sdev_gendev, &scsi_dh_state_attr);
191 if (err) 237 if (err)
192 return err; 238 return err;
193 239
194 devinfo = device_handler_match(sdev); 240 drv = scsi_dh_find_driver(sdev);
241 if (drv)
242 devinfo = scsi_dh_lookup(drv);
195 if (devinfo) 243 if (devinfo)
196 err = scsi_dh_handler_attach(sdev, devinfo); 244 err = scsi_dh_handler_attach(sdev, devinfo);
197 return err; 245 return err;