diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/fcoe/fcoe_sysfs.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c index 5e751689a089..e6fce2862a33 100644 --- a/drivers/scsi/fcoe/fcoe_sysfs.c +++ b/drivers/scsi/fcoe/fcoe_sysfs.c | |||
@@ -210,25 +210,23 @@ static ssize_t show_fcoe_fcf_device_##field(struct device *dev, \ | |||
210 | #define fcoe_enum_name_search(title, table_type, table) \ | 210 | #define fcoe_enum_name_search(title, table_type, table) \ |
211 | static const char *get_fcoe_##title##_name(enum table_type table_key) \ | 211 | static const char *get_fcoe_##title##_name(enum table_type table_key) \ |
212 | { \ | 212 | { \ |
213 | int i; \ | 213 | if (table_key < 0 || table_key >= ARRAY_SIZE(table)) \ |
214 | char *name = NULL; \ | 214 | return NULL; \ |
215 | \ | 215 | return table[table_key]; \ |
216 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ | ||
217 | if (table[i].value == table_key) { \ | ||
218 | name = table[i].name; \ | ||
219 | break; \ | ||
220 | } \ | ||
221 | } \ | ||
222 | return name; \ | ||
223 | } | 216 | } |
224 | 217 | ||
225 | static struct { | 218 | static char *fip_conn_type_names[] = { |
226 | enum fcf_state value; | 219 | [ FIP_CONN_TYPE_UNKNOWN ] = "Unknown", |
227 | char *name; | 220 | [ FIP_CONN_TYPE_FABRIC ] = "Fabric", |
228 | } fcf_state_names[] = { | 221 | [ FIP_CONN_TYPE_VN2VN ] = "VN2VN", |
229 | { FCOE_FCF_STATE_UNKNOWN, "Unknown" }, | 222 | }; |
230 | { FCOE_FCF_STATE_DISCONNECTED, "Disconnected" }, | 223 | fcoe_enum_name_search(ctlr_mode, fip_conn_type, fip_conn_type_names) |
231 | { FCOE_FCF_STATE_CONNECTED, "Connected" }, | 224 | #define FCOE_CTLR_MODE_MAX_NAMELEN 50 |
225 | |||
226 | static char *fcf_state_names[] = { | ||
227 | [ FCOE_FCF_STATE_UNKNOWN ] = "Unknown", | ||
228 | [ FCOE_FCF_STATE_DISCONNECTED ] = "Disconnected", | ||
229 | [ FCOE_FCF_STATE_CONNECTED ] = "Connected", | ||
232 | }; | 230 | }; |
233 | fcoe_enum_name_search(fcf_state, fcf_state, fcf_state_names) | 231 | fcoe_enum_name_search(fcf_state, fcf_state, fcf_state_names) |
234 | #define FCOE_FCF_STATE_MAX_NAMELEN 50 | 232 | #define FCOE_FCF_STATE_MAX_NAMELEN 50 |
@@ -246,17 +244,7 @@ static ssize_t show_fcf_state(struct device *dev, | |||
246 | } | 244 | } |
247 | static FCOE_DEVICE_ATTR(fcf, state, S_IRUGO, show_fcf_state, NULL); | 245 | static FCOE_DEVICE_ATTR(fcf, state, S_IRUGO, show_fcf_state, NULL); |
248 | 246 | ||
249 | static struct { | 247 | #define FCOE_MAX_MODENAME_LEN 20 |
250 | enum fip_conn_type value; | ||
251 | char *name; | ||
252 | } fip_conn_type_names[] = { | ||
253 | { FIP_CONN_TYPE_UNKNOWN, "Unknown" }, | ||
254 | { FIP_CONN_TYPE_FABRIC, "Fabric" }, | ||
255 | { FIP_CONN_TYPE_VN2VN, "VN2VN" }, | ||
256 | }; | ||
257 | fcoe_enum_name_search(ctlr_mode, fip_conn_type, fip_conn_type_names) | ||
258 | #define FCOE_CTLR_MODE_MAX_NAMELEN 50 | ||
259 | |||
260 | static ssize_t show_ctlr_mode(struct device *dev, | 248 | static ssize_t show_ctlr_mode(struct device *dev, |
261 | struct device_attribute *attr, | 249 | struct device_attribute *attr, |
262 | char *buf) | 250 | char *buf) |