diff options
author | Stefan Haberland <stefan.haberland@de.ibm.com> | 2010-05-17 04:00:11 -0400 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2010-05-17 04:00:16 -0400 |
commit | 2dedf0d9eadf39660f2e1686b5d36e4a7515803f (patch) | |
tree | 39fefcb959ee6e7c9c15b07b58eb9ef6a9e6304d /drivers/s390/block/dasd_devmap.c | |
parent | 501183f2ed74434e30a1b039b2f3af30f1f3f461 (diff) |
[S390] dasd: remove uid from devmap
Remove the duplicate of the DASD uid from the devmap structure.
Use the uid from the device private structure instead.
This also removes a lockdep warning complaining about a possible
SOFTIRQ-safe -> SOFTIRQ-unsafe lock order.
Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 174 |
1 files changed, 68 insertions, 106 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index eff9c812c5c2..34d51dd4c539 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -49,7 +49,6 @@ struct dasd_devmap { | |||
49 | unsigned int devindex; | 49 | unsigned int devindex; |
50 | unsigned short features; | 50 | unsigned short features; |
51 | struct dasd_device *device; | 51 | struct dasd_device *device; |
52 | struct dasd_uid uid; | ||
53 | }; | 52 | }; |
54 | 53 | ||
55 | /* | 54 | /* |
@@ -936,42 +935,46 @@ dasd_device_status_show(struct device *dev, struct device_attribute *attr, | |||
936 | 935 | ||
937 | static DEVICE_ATTR(status, 0444, dasd_device_status_show, NULL); | 936 | static DEVICE_ATTR(status, 0444, dasd_device_status_show, NULL); |
938 | 937 | ||
939 | static ssize_t | 938 | static ssize_t dasd_alias_show(struct device *dev, |
940 | dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf) | 939 | struct device_attribute *attr, char *buf) |
941 | { | 940 | { |
942 | struct dasd_devmap *devmap; | 941 | struct dasd_device *device; |
943 | int alias; | 942 | struct dasd_uid uid; |
944 | 943 | ||
945 | devmap = dasd_find_busid(dev_name(dev)); | 944 | device = dasd_device_from_cdev(to_ccwdev(dev)); |
946 | spin_lock(&dasd_devmap_lock); | 945 | if (IS_ERR(device)) |
947 | if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) { | ||
948 | spin_unlock(&dasd_devmap_lock); | ||
949 | return sprintf(buf, "0\n"); | 946 | return sprintf(buf, "0\n"); |
947 | |||
948 | if (device->discipline && device->discipline->get_uid && | ||
949 | !device->discipline->get_uid(device, &uid)) { | ||
950 | if (uid.type == UA_BASE_PAV_ALIAS || | ||
951 | uid.type == UA_HYPER_PAV_ALIAS) | ||
952 | return sprintf(buf, "1\n"); | ||
950 | } | 953 | } |
951 | if (devmap->uid.type == UA_BASE_PAV_ALIAS || | 954 | dasd_put_device(device); |
952 | devmap->uid.type == UA_HYPER_PAV_ALIAS) | 955 | |
953 | alias = 1; | 956 | return sprintf(buf, "0\n"); |
954 | else | ||
955 | alias = 0; | ||
956 | spin_unlock(&dasd_devmap_lock); | ||
957 | return sprintf(buf, alias ? "1\n" : "0\n"); | ||
958 | } | 957 | } |
959 | 958 | ||
960 | static DEVICE_ATTR(alias, 0444, dasd_alias_show, NULL); | 959 | static DEVICE_ATTR(alias, 0444, dasd_alias_show, NULL); |
961 | 960 | ||
962 | static ssize_t | 961 | static ssize_t dasd_vendor_show(struct device *dev, |
963 | dasd_vendor_show(struct device *dev, struct device_attribute *attr, char *buf) | 962 | struct device_attribute *attr, char *buf) |
964 | { | 963 | { |
965 | struct dasd_devmap *devmap; | 964 | struct dasd_device *device; |
965 | struct dasd_uid uid; | ||
966 | char *vendor; | 966 | char *vendor; |
967 | 967 | ||
968 | devmap = dasd_find_busid(dev_name(dev)); | 968 | device = dasd_device_from_cdev(to_ccwdev(dev)); |
969 | spin_lock(&dasd_devmap_lock); | 969 | vendor = ""; |
970 | if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0) | 970 | if (IS_ERR(device)) |
971 | vendor = devmap->uid.vendor; | 971 | return snprintf(buf, PAGE_SIZE, "%s\n", vendor); |
972 | else | 972 | |
973 | vendor = ""; | 973 | if (device->discipline && device->discipline->get_uid && |
974 | spin_unlock(&dasd_devmap_lock); | 974 | !device->discipline->get_uid(device, &uid)) |
975 | vendor = uid.vendor; | ||
976 | |||
977 | dasd_put_device(device); | ||
975 | 978 | ||
976 | return snprintf(buf, PAGE_SIZE, "%s\n", vendor); | 979 | return snprintf(buf, PAGE_SIZE, "%s\n", vendor); |
977 | } | 980 | } |
@@ -985,48 +988,51 @@ static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL); | |||
985 | static ssize_t | 988 | static ssize_t |
986 | dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) | 989 | dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) |
987 | { | 990 | { |
988 | struct dasd_devmap *devmap; | 991 | struct dasd_device *device; |
992 | struct dasd_uid uid; | ||
989 | char uid_string[UID_STRLEN]; | 993 | char uid_string[UID_STRLEN]; |
990 | char ua_string[3]; | 994 | char ua_string[3]; |
991 | struct dasd_uid *uid; | ||
992 | 995 | ||
993 | devmap = dasd_find_busid(dev_name(dev)); | 996 | device = dasd_device_from_cdev(to_ccwdev(dev)); |
994 | spin_lock(&dasd_devmap_lock); | 997 | uid_string[0] = 0; |
995 | if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) { | 998 | if (IS_ERR(device)) |
996 | spin_unlock(&dasd_devmap_lock); | 999 | return snprintf(buf, PAGE_SIZE, "%s\n", uid_string); |
997 | return sprintf(buf, "\n"); | 1000 | |
998 | } | 1001 | if (device->discipline && device->discipline->get_uid && |
999 | uid = &devmap->uid; | 1002 | !device->discipline->get_uid(device, &uid)) { |
1000 | switch (uid->type) { | 1003 | switch (uid.type) { |
1001 | case UA_BASE_DEVICE: | 1004 | case UA_BASE_DEVICE: |
1002 | sprintf(ua_string, "%02x", uid->real_unit_addr); | 1005 | snprintf(ua_string, sizeof(ua_string), "%02x", |
1003 | break; | 1006 | uid.real_unit_addr); |
1004 | case UA_BASE_PAV_ALIAS: | 1007 | break; |
1005 | sprintf(ua_string, "%02x", uid->base_unit_addr); | 1008 | case UA_BASE_PAV_ALIAS: |
1006 | break; | 1009 | snprintf(ua_string, sizeof(ua_string), "%02x", |
1007 | case UA_HYPER_PAV_ALIAS: | 1010 | uid.base_unit_addr); |
1008 | sprintf(ua_string, "xx"); | 1011 | break; |
1009 | break; | 1012 | case UA_HYPER_PAV_ALIAS: |
1010 | default: | 1013 | snprintf(ua_string, sizeof(ua_string), "xx"); |
1011 | /* should not happen, treat like base device */ | 1014 | break; |
1012 | sprintf(ua_string, "%02x", uid->real_unit_addr); | 1015 | default: |
1013 | break; | 1016 | /* should not happen, treat like base device */ |
1017 | snprintf(ua_string, sizeof(ua_string), "%02x", | ||
1018 | uid.real_unit_addr); | ||
1019 | break; | ||
1020 | } | ||
1021 | |||
1022 | if (strlen(uid.vduit) > 0) | ||
1023 | snprintf(uid_string, sizeof(uid_string), | ||
1024 | "%s.%s.%04x.%s.%s", | ||
1025 | uid.vendor, uid.serial, uid.ssid, ua_string, | ||
1026 | uid.vduit); | ||
1027 | else | ||
1028 | snprintf(uid_string, sizeof(uid_string), | ||
1029 | "%s.%s.%04x.%s", | ||
1030 | uid.vendor, uid.serial, uid.ssid, ua_string); | ||
1014 | } | 1031 | } |
1015 | if (strlen(uid->vduit) > 0) | 1032 | dasd_put_device(device); |
1016 | snprintf(uid_string, sizeof(uid_string), | 1033 | |
1017 | "%s.%s.%04x.%s.%s", | ||
1018 | uid->vendor, uid->serial, | ||
1019 | uid->ssid, ua_string, | ||
1020 | uid->vduit); | ||
1021 | else | ||
1022 | snprintf(uid_string, sizeof(uid_string), | ||
1023 | "%s.%s.%04x.%s", | ||
1024 | uid->vendor, uid->serial, | ||
1025 | uid->ssid, ua_string); | ||
1026 | spin_unlock(&dasd_devmap_lock); | ||
1027 | return snprintf(buf, PAGE_SIZE, "%s\n", uid_string); | 1034 | return snprintf(buf, PAGE_SIZE, "%s\n", uid_string); |
1028 | } | 1035 | } |
1029 | |||
1030 | static DEVICE_ATTR(uid, 0444, dasd_uid_show, NULL); | 1036 | static DEVICE_ATTR(uid, 0444, dasd_uid_show, NULL); |
1031 | 1037 | ||
1032 | /* | 1038 | /* |
@@ -1094,50 +1100,6 @@ static struct attribute_group dasd_attr_group = { | |||
1094 | }; | 1100 | }; |
1095 | 1101 | ||
1096 | /* | 1102 | /* |
1097 | * Return copy of the device unique identifier. | ||
1098 | */ | ||
1099 | int | ||
1100 | dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid) | ||
1101 | { | ||
1102 | struct dasd_devmap *devmap; | ||
1103 | |||
1104 | devmap = dasd_find_busid(dev_name(&cdev->dev)); | ||
1105 | if (IS_ERR(devmap)) | ||
1106 | return PTR_ERR(devmap); | ||
1107 | spin_lock(&dasd_devmap_lock); | ||
1108 | *uid = devmap->uid; | ||
1109 | spin_unlock(&dasd_devmap_lock); | ||
1110 | return 0; | ||
1111 | } | ||
1112 | EXPORT_SYMBOL_GPL(dasd_get_uid); | ||
1113 | |||
1114 | /* | ||
1115 | * Register the given device unique identifier into devmap struct. | ||
1116 | * In addition check if the related storage server subsystem ID is already | ||
1117 | * contained in the dasd_server_ssid_list. If subsystem ID is not contained, | ||
1118 | * create new entry. | ||
1119 | * Return 0 if server was already in serverlist, | ||
1120 | * 1 if the server was added successful | ||
1121 | * <0 in case of error. | ||
1122 | */ | ||
1123 | int | ||
1124 | dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid) | ||
1125 | { | ||
1126 | struct dasd_devmap *devmap; | ||
1127 | |||
1128 | devmap = dasd_find_busid(dev_name(&cdev->dev)); | ||
1129 | if (IS_ERR(devmap)) | ||
1130 | return PTR_ERR(devmap); | ||
1131 | |||
1132 | spin_lock(&dasd_devmap_lock); | ||
1133 | devmap->uid = *uid; | ||
1134 | spin_unlock(&dasd_devmap_lock); | ||
1135 | |||
1136 | return 0; | ||
1137 | } | ||
1138 | EXPORT_SYMBOL_GPL(dasd_set_uid); | ||
1139 | |||
1140 | /* | ||
1141 | * Return value of the specified feature. | 1103 | * Return value of the specified feature. |
1142 | */ | 1104 | */ |
1143 | int | 1105 | int |