aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_sas.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_transport_sas.c')
-rw-r--r--drivers/scsi/scsi_transport_sas.c157
1 files changed, 88 insertions, 69 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 43a964d635b4..27ec625ab771 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -53,8 +53,8 @@ struct sas_host_attrs {
53/* 53/*
54 * Hack to allow attributes of the same name in different objects. 54 * Hack to allow attributes of the same name in different objects.
55 */ 55 */
56#define SAS_CLASS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ 56#define SAS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \
57 struct class_device_attribute class_device_attr_##_prefix##_##_name = \ 57 struct device_attribute dev_attr_##_prefix##_##_name = \
58 __ATTR(_name,_mode,_show,_store) 58 __ATTR(_name,_mode,_show,_store)
59 59
60 60
@@ -261,7 +261,7 @@ static void sas_bsg_remove(struct Scsi_Host *shost, struct sas_rphy *rphy)
261 */ 261 */
262 262
263static int sas_host_setup(struct transport_container *tc, struct device *dev, 263static int sas_host_setup(struct transport_container *tc, struct device *dev,
264 struct class_device *cdev) 264 struct device *cdev)
265{ 265{
266 struct Scsi_Host *shost = dev_to_shost(dev); 266 struct Scsi_Host *shost = dev_to_shost(dev);
267 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); 267 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
@@ -280,7 +280,7 @@ static int sas_host_setup(struct transport_container *tc, struct device *dev,
280} 280}
281 281
282static int sas_host_remove(struct transport_container *tc, struct device *dev, 282static int sas_host_remove(struct transport_container *tc, struct device *dev,
283 struct class_device *cdev) 283 struct device *cdev)
284{ 284{
285 struct Scsi_Host *shost = dev_to_shost(dev); 285 struct Scsi_Host *shost = dev_to_shost(dev);
286 286
@@ -356,22 +356,24 @@ EXPORT_SYMBOL(sas_remove_host);
356 356
357#define sas_phy_show_simple(field, name, format_string, cast) \ 357#define sas_phy_show_simple(field, name, format_string, cast) \
358static ssize_t \ 358static ssize_t \
359show_sas_phy_##name(struct class_device *cdev, char *buf) \ 359show_sas_phy_##name(struct device *dev, \
360 struct device_attribute *attr, char *buf) \
360{ \ 361{ \
361 struct sas_phy *phy = transport_class_to_phy(cdev); \ 362 struct sas_phy *phy = transport_class_to_phy(dev); \
362 \ 363 \
363 return snprintf(buf, 20, format_string, cast phy->field); \ 364 return snprintf(buf, 20, format_string, cast phy->field); \
364} 365}
365 366
366#define sas_phy_simple_attr(field, name, format_string, type) \ 367#define sas_phy_simple_attr(field, name, format_string, type) \
367 sas_phy_show_simple(field, name, format_string, (type)) \ 368 sas_phy_show_simple(field, name, format_string, (type)) \
368static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) 369static DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL)
369 370
370#define sas_phy_show_protocol(field, name) \ 371#define sas_phy_show_protocol(field, name) \
371static ssize_t \ 372static ssize_t \
372show_sas_phy_##name(struct class_device *cdev, char *buf) \ 373show_sas_phy_##name(struct device *dev, \
374 struct device_attribute *attr, char *buf) \
373{ \ 375{ \
374 struct sas_phy *phy = transport_class_to_phy(cdev); \ 376 struct sas_phy *phy = transport_class_to_phy(dev); \
375 \ 377 \
376 if (!phy->field) \ 378 if (!phy->field) \
377 return snprintf(buf, 20, "none\n"); \ 379 return snprintf(buf, 20, "none\n"); \
@@ -380,13 +382,14 @@ show_sas_phy_##name(struct class_device *cdev, char *buf) \
380 382
381#define sas_phy_protocol_attr(field, name) \ 383#define sas_phy_protocol_attr(field, name) \
382 sas_phy_show_protocol(field, name) \ 384 sas_phy_show_protocol(field, name) \
383static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) 385static DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL)
384 386
385#define sas_phy_show_linkspeed(field) \ 387#define sas_phy_show_linkspeed(field) \
386static ssize_t \ 388static ssize_t \
387show_sas_phy_##field(struct class_device *cdev, char *buf) \ 389show_sas_phy_##field(struct device *dev, \
390 struct device_attribute *attr, char *buf) \
388{ \ 391{ \
389 struct sas_phy *phy = transport_class_to_phy(cdev); \ 392 struct sas_phy *phy = transport_class_to_phy(dev); \
390 \ 393 \
391 return get_sas_linkspeed_names(phy->field, buf); \ 394 return get_sas_linkspeed_names(phy->field, buf); \
392} 395}
@@ -394,10 +397,11 @@ show_sas_phy_##field(struct class_device *cdev, char *buf) \
394/* Fudge to tell if we're minimum or maximum */ 397/* Fudge to tell if we're minimum or maximum */
395#define sas_phy_store_linkspeed(field) \ 398#define sas_phy_store_linkspeed(field) \
396static ssize_t \ 399static ssize_t \
397store_sas_phy_##field(struct class_device *cdev, const char *buf, \ 400store_sas_phy_##field(struct device *dev, \
398 size_t count) \ 401 struct device_attribute *attr, \
402 const char *buf, size_t count) \
399{ \ 403{ \
400 struct sas_phy *phy = transport_class_to_phy(cdev); \ 404 struct sas_phy *phy = transport_class_to_phy(dev); \
401 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ 405 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \
402 struct sas_internal *i = to_sas_internal(shost->transportt); \ 406 struct sas_internal *i = to_sas_internal(shost->transportt); \
403 u32 value; \ 407 u32 value; \
@@ -416,19 +420,20 @@ store_sas_phy_##field(struct class_device *cdev, const char *buf, \
416#define sas_phy_linkspeed_rw_attr(field) \ 420#define sas_phy_linkspeed_rw_attr(field) \
417 sas_phy_show_linkspeed(field) \ 421 sas_phy_show_linkspeed(field) \
418 sas_phy_store_linkspeed(field) \ 422 sas_phy_store_linkspeed(field) \
419static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, \ 423static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, \
420 store_sas_phy_##field) 424 store_sas_phy_##field)
421 425
422#define sas_phy_linkspeed_attr(field) \ 426#define sas_phy_linkspeed_attr(field) \
423 sas_phy_show_linkspeed(field) \ 427 sas_phy_show_linkspeed(field) \
424static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) 428static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL)
425 429
426 430
427#define sas_phy_show_linkerror(field) \ 431#define sas_phy_show_linkerror(field) \
428static ssize_t \ 432static ssize_t \
429show_sas_phy_##field(struct class_device *cdev, char *buf) \ 433show_sas_phy_##field(struct device *dev, \
434 struct device_attribute *attr, char *buf) \
430{ \ 435{ \
431 struct sas_phy *phy = transport_class_to_phy(cdev); \ 436 struct sas_phy *phy = transport_class_to_phy(dev); \
432 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ 437 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \
433 struct sas_internal *i = to_sas_internal(shost->transportt); \ 438 struct sas_internal *i = to_sas_internal(shost->transportt); \
434 int error; \ 439 int error; \
@@ -441,24 +446,25 @@ show_sas_phy_##field(struct class_device *cdev, char *buf) \
441 446
442#define sas_phy_linkerror_attr(field) \ 447#define sas_phy_linkerror_attr(field) \
443 sas_phy_show_linkerror(field) \ 448 sas_phy_show_linkerror(field) \
444static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) 449static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL)
445 450
446 451
447static ssize_t 452static ssize_t
448show_sas_device_type(struct class_device *cdev, char *buf) 453show_sas_device_type(struct device *dev,
454 struct device_attribute *attr, char *buf)
449{ 455{
450 struct sas_phy *phy = transport_class_to_phy(cdev); 456 struct sas_phy *phy = transport_class_to_phy(dev);
451 457
452 if (!phy->identify.device_type) 458 if (!phy->identify.device_type)
453 return snprintf(buf, 20, "none\n"); 459 return snprintf(buf, 20, "none\n");
454 return get_sas_device_type_names(phy->identify.device_type, buf); 460 return get_sas_device_type_names(phy->identify.device_type, buf);
455} 461}
456static CLASS_DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL); 462static DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL);
457 463
458static ssize_t do_sas_phy_enable(struct class_device *cdev, 464static ssize_t do_sas_phy_enable(struct device *dev,
459 size_t count, int enable) 465 size_t count, int enable)
460{ 466{
461 struct sas_phy *phy = transport_class_to_phy(cdev); 467 struct sas_phy *phy = transport_class_to_phy(dev);
462 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 468 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
463 struct sas_internal *i = to_sas_internal(shost->transportt); 469 struct sas_internal *i = to_sas_internal(shost->transportt);
464 int error; 470 int error;
@@ -470,18 +476,19 @@ static ssize_t do_sas_phy_enable(struct class_device *cdev,
470 return count; 476 return count;
471}; 477};
472 478
473static ssize_t store_sas_phy_enable(struct class_device *cdev, 479static ssize_t
474 const char *buf, size_t count) 480store_sas_phy_enable(struct device *dev, struct device_attribute *attr,
481 const char *buf, size_t count)
475{ 482{
476 if (count < 1) 483 if (count < 1)
477 return -EINVAL; 484 return -EINVAL;
478 485
479 switch (buf[0]) { 486 switch (buf[0]) {
480 case '0': 487 case '0':
481 do_sas_phy_enable(cdev, count, 0); 488 do_sas_phy_enable(dev, count, 0);
482 break; 489 break;
483 case '1': 490 case '1':
484 do_sas_phy_enable(cdev, count, 1); 491 do_sas_phy_enable(dev, count, 1);
485 break; 492 break;
486 default: 493 default:
487 return -EINVAL; 494 return -EINVAL;
@@ -490,20 +497,22 @@ static ssize_t store_sas_phy_enable(struct class_device *cdev,
490 return count; 497 return count;
491} 498}
492 499
493static ssize_t show_sas_phy_enable(struct class_device *cdev, char *buf) 500static ssize_t
501show_sas_phy_enable(struct device *dev, struct device_attribute *attr,
502 char *buf)
494{ 503{
495 struct sas_phy *phy = transport_class_to_phy(cdev); 504 struct sas_phy *phy = transport_class_to_phy(dev);
496 505
497 return snprintf(buf, 20, "%d", phy->enabled); 506 return snprintf(buf, 20, "%d", phy->enabled);
498} 507}
499 508
500static CLASS_DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable, 509static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable,
501 store_sas_phy_enable); 510 store_sas_phy_enable);
502 511
503static ssize_t do_sas_phy_reset(struct class_device *cdev, 512static ssize_t
504 size_t count, int hard_reset) 513do_sas_phy_reset(struct device *dev, size_t count, int hard_reset)
505{ 514{
506 struct sas_phy *phy = transport_class_to_phy(cdev); 515 struct sas_phy *phy = transport_class_to_phy(dev);
507 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 516 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
508 struct sas_internal *i = to_sas_internal(shost->transportt); 517 struct sas_internal *i = to_sas_internal(shost->transportt);
509 int error; 518 int error;
@@ -514,19 +523,21 @@ static ssize_t do_sas_phy_reset(struct class_device *cdev,
514 return count; 523 return count;
515}; 524};
516 525
517static ssize_t store_sas_link_reset(struct class_device *cdev, 526static ssize_t
518 const char *buf, size_t count) 527store_sas_link_reset(struct device *dev, struct device_attribute *attr,
528 const char *buf, size_t count)
519{ 529{
520 return do_sas_phy_reset(cdev, count, 0); 530 return do_sas_phy_reset(dev, count, 0);
521} 531}
522static CLASS_DEVICE_ATTR(link_reset, S_IWUSR, NULL, store_sas_link_reset); 532static DEVICE_ATTR(link_reset, S_IWUSR, NULL, store_sas_link_reset);
523 533
524static ssize_t store_sas_hard_reset(struct class_device *cdev, 534static ssize_t
525 const char *buf, size_t count) 535store_sas_hard_reset(struct device *dev, struct device_attribute *attr,
536 const char *buf, size_t count)
526{ 537{
527 return do_sas_phy_reset(cdev, count, 1); 538 return do_sas_phy_reset(dev, count, 1);
528} 539}
529static CLASS_DEVICE_ATTR(hard_reset, S_IWUSR, NULL, store_sas_hard_reset); 540static DEVICE_ATTR(hard_reset, S_IWUSR, NULL, store_sas_hard_reset);
530 541
531sas_phy_protocol_attr(identify.initiator_port_protocols, 542sas_phy_protocol_attr(identify.initiator_port_protocols,
532 initiator_port_protocols); 543 initiator_port_protocols);
@@ -695,16 +706,17 @@ EXPORT_SYMBOL(scsi_is_sas_phy);
695 */ 706 */
696#define sas_port_show_simple(field, name, format_string, cast) \ 707#define sas_port_show_simple(field, name, format_string, cast) \
697static ssize_t \ 708static ssize_t \
698show_sas_port_##name(struct class_device *cdev, char *buf) \ 709show_sas_port_##name(struct device *dev, \
710 struct device_attribute *attr, char *buf) \
699{ \ 711{ \
700 struct sas_port *port = transport_class_to_sas_port(cdev); \ 712 struct sas_port *port = transport_class_to_sas_port(dev); \
701 \ 713 \
702 return snprintf(buf, 20, format_string, cast port->field); \ 714 return snprintf(buf, 20, format_string, cast port->field); \
703} 715}
704 716
705#define sas_port_simple_attr(field, name, format_string, type) \ 717#define sas_port_simple_attr(field, name, format_string, type) \
706 sas_port_show_simple(field, name, format_string, (type)) \ 718 sas_port_show_simple(field, name, format_string, (type)) \
707static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_port_##name, NULL) 719static DEVICE_ATTR(name, S_IRUGO, show_sas_port_##name, NULL)
708 720
709sas_port_simple_attr(num_phys, num_phys, "%d\n", int); 721sas_port_simple_attr(num_phys, num_phys, "%d\n", int);
710 722
@@ -1017,23 +1029,25 @@ EXPORT_SYMBOL(sas_port_mark_backlink);
1017 1029
1018#define sas_rphy_show_simple(field, name, format_string, cast) \ 1030#define sas_rphy_show_simple(field, name, format_string, cast) \
1019static ssize_t \ 1031static ssize_t \
1020show_sas_rphy_##name(struct class_device *cdev, char *buf) \ 1032show_sas_rphy_##name(struct device *dev, \
1033 struct device_attribute *attr, char *buf) \
1021{ \ 1034{ \
1022 struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1035 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1023 \ 1036 \
1024 return snprintf(buf, 20, format_string, cast rphy->field); \ 1037 return snprintf(buf, 20, format_string, cast rphy->field); \
1025} 1038}
1026 1039
1027#define sas_rphy_simple_attr(field, name, format_string, type) \ 1040#define sas_rphy_simple_attr(field, name, format_string, type) \
1028 sas_rphy_show_simple(field, name, format_string, (type)) \ 1041 sas_rphy_show_simple(field, name, format_string, (type)) \
1029static SAS_CLASS_DEVICE_ATTR(rphy, name, S_IRUGO, \ 1042static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1030 show_sas_rphy_##name, NULL) 1043 show_sas_rphy_##name, NULL)
1031 1044
1032#define sas_rphy_show_protocol(field, name) \ 1045#define sas_rphy_show_protocol(field, name) \
1033static ssize_t \ 1046static ssize_t \
1034show_sas_rphy_##name(struct class_device *cdev, char *buf) \ 1047show_sas_rphy_##name(struct device *dev, \
1048 struct device_attribute *attr, char *buf) \
1035{ \ 1049{ \
1036 struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1050 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1037 \ 1051 \
1038 if (!rphy->field) \ 1052 if (!rphy->field) \
1039 return snprintf(buf, 20, "none\n"); \ 1053 return snprintf(buf, 20, "none\n"); \
@@ -1042,13 +1056,14 @@ show_sas_rphy_##name(struct class_device *cdev, char *buf) \
1042 1056
1043#define sas_rphy_protocol_attr(field, name) \ 1057#define sas_rphy_protocol_attr(field, name) \
1044 sas_rphy_show_protocol(field, name) \ 1058 sas_rphy_show_protocol(field, name) \
1045static SAS_CLASS_DEVICE_ATTR(rphy, name, S_IRUGO, \ 1059static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1046 show_sas_rphy_##name, NULL) 1060 show_sas_rphy_##name, NULL)
1047 1061
1048static ssize_t 1062static ssize_t
1049show_sas_rphy_device_type(struct class_device *cdev, char *buf) 1063show_sas_rphy_device_type(struct device *dev,
1064 struct device_attribute *attr, char *buf)
1050{ 1065{
1051 struct sas_rphy *rphy = transport_class_to_rphy(cdev); 1066 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1052 1067
1053 if (!rphy->identify.device_type) 1068 if (!rphy->identify.device_type)
1054 return snprintf(buf, 20, "none\n"); 1069 return snprintf(buf, 20, "none\n");
@@ -1056,13 +1071,14 @@ show_sas_rphy_device_type(struct class_device *cdev, char *buf)
1056 rphy->identify.device_type, buf); 1071 rphy->identify.device_type, buf);
1057} 1072}
1058 1073
1059static SAS_CLASS_DEVICE_ATTR(rphy, device_type, S_IRUGO, 1074static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
1060 show_sas_rphy_device_type, NULL); 1075 show_sas_rphy_device_type, NULL);
1061 1076
1062static ssize_t 1077static ssize_t
1063show_sas_rphy_enclosure_identifier(struct class_device *cdev, char *buf) 1078show_sas_rphy_enclosure_identifier(struct device *dev,
1079 struct device_attribute *attr, char *buf)
1064{ 1080{
1065 struct sas_rphy *rphy = transport_class_to_rphy(cdev); 1081 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1066 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); 1082 struct sas_phy *phy = dev_to_phy(rphy->dev.parent);
1067 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 1083 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
1068 struct sas_internal *i = to_sas_internal(shost->transportt); 1084 struct sas_internal *i = to_sas_internal(shost->transportt);
@@ -1082,13 +1098,14 @@ show_sas_rphy_enclosure_identifier(struct class_device *cdev, char *buf)
1082 return sprintf(buf, "0x%llx\n", (unsigned long long)identifier); 1098 return sprintf(buf, "0x%llx\n", (unsigned long long)identifier);
1083} 1099}
1084 1100
1085static SAS_CLASS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO, 1101static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1086 show_sas_rphy_enclosure_identifier, NULL); 1102 show_sas_rphy_enclosure_identifier, NULL);
1087 1103
1088static ssize_t 1104static ssize_t
1089show_sas_rphy_bay_identifier(struct class_device *cdev, char *buf) 1105show_sas_rphy_bay_identifier(struct device *dev,
1106 struct device_attribute *attr, char *buf)
1090{ 1107{
1091 struct sas_rphy *rphy = transport_class_to_rphy(cdev); 1108 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1092 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); 1109 struct sas_phy *phy = dev_to_phy(rphy->dev.parent);
1093 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 1110 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
1094 struct sas_internal *i = to_sas_internal(shost->transportt); 1111 struct sas_internal *i = to_sas_internal(shost->transportt);
@@ -1103,7 +1120,7 @@ show_sas_rphy_bay_identifier(struct class_device *cdev, char *buf)
1103 return sprintf(buf, "%d\n", val); 1120 return sprintf(buf, "%d\n", val);
1104} 1121}
1105 1122
1106static SAS_CLASS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO, 1123static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
1107 show_sas_rphy_bay_identifier, NULL); 1124 show_sas_rphy_bay_identifier, NULL);
1108 1125
1109sas_rphy_protocol_attr(identify.initiator_port_protocols, 1126sas_rphy_protocol_attr(identify.initiator_port_protocols,
@@ -1161,9 +1178,10 @@ static DECLARE_TRANSPORT_CLASS(sas_end_dev_class,
1161 1178
1162#define sas_end_dev_show_simple(field, name, format_string, cast) \ 1179#define sas_end_dev_show_simple(field, name, format_string, cast) \
1163static ssize_t \ 1180static ssize_t \
1164show_sas_end_dev_##name(struct class_device *cdev, char *buf) \ 1181show_sas_end_dev_##name(struct device *dev, \
1182 struct device_attribute *attr, char *buf) \
1165{ \ 1183{ \
1166 struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1184 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1167 struct sas_end_device *rdev = rphy_to_end_device(rphy); \ 1185 struct sas_end_device *rdev = rphy_to_end_device(rphy); \
1168 \ 1186 \
1169 return snprintf(buf, 20, format_string, cast rdev->field); \ 1187 return snprintf(buf, 20, format_string, cast rdev->field); \
@@ -1171,7 +1189,7 @@ show_sas_end_dev_##name(struct class_device *cdev, char *buf) \
1171 1189
1172#define sas_end_dev_simple_attr(field, name, format_string, type) \ 1190#define sas_end_dev_simple_attr(field, name, format_string, type) \
1173 sas_end_dev_show_simple(field, name, format_string, (type)) \ 1191 sas_end_dev_show_simple(field, name, format_string, (type)) \
1174static SAS_CLASS_DEVICE_ATTR(end_dev, name, S_IRUGO, \ 1192static SAS_DEVICE_ATTR(end_dev, name, S_IRUGO, \
1175 show_sas_end_dev_##name, NULL) 1193 show_sas_end_dev_##name, NULL)
1176 1194
1177sas_end_dev_simple_attr(ready_led_meaning, ready_led_meaning, "%d\n", int); 1195sas_end_dev_simple_attr(ready_led_meaning, ready_led_meaning, "%d\n", int);
@@ -1185,9 +1203,10 @@ static DECLARE_TRANSPORT_CLASS(sas_expander_class,
1185 1203
1186#define sas_expander_show_simple(field, name, format_string, cast) \ 1204#define sas_expander_show_simple(field, name, format_string, cast) \
1187static ssize_t \ 1205static ssize_t \
1188show_sas_expander_##name(struct class_device *cdev, char *buf) \ 1206show_sas_expander_##name(struct device *dev, \
1207 struct device_attribute *attr, char *buf) \
1189{ \ 1208{ \
1190 struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1209 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1191 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \ 1210 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \
1192 \ 1211 \
1193 return snprintf(buf, 20, format_string, cast edev->field); \ 1212 return snprintf(buf, 20, format_string, cast edev->field); \
@@ -1195,7 +1214,7 @@ show_sas_expander_##name(struct class_device *cdev, char *buf) \
1195 1214
1196#define sas_expander_simple_attr(field, name, format_string, type) \ 1215#define sas_expander_simple_attr(field, name, format_string, type) \
1197 sas_expander_show_simple(field, name, format_string, (type)) \ 1216 sas_expander_show_simple(field, name, format_string, (type)) \
1198static SAS_CLASS_DEVICE_ATTR(expander, name, S_IRUGO, \ 1217static SAS_DEVICE_ATTR(expander, name, S_IRUGO, \
1199 show_sas_expander_##name, NULL) 1218 show_sas_expander_##name, NULL)
1200 1219
1201sas_expander_simple_attr(vendor_id, vendor_id, "%s\n", char *); 1220sas_expander_simple_attr(vendor_id, vendor_id, "%s\n", char *);
@@ -1554,14 +1573,14 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
1554 */ 1573 */
1555 1574
1556#define SETUP_TEMPLATE(attrb, field, perm, test) \ 1575#define SETUP_TEMPLATE(attrb, field, perm, test) \
1557 i->private_##attrb[count] = class_device_attr_##field; \ 1576 i->private_##attrb[count] = dev_attr_##field; \
1558 i->private_##attrb[count].attr.mode = perm; \ 1577 i->private_##attrb[count].attr.mode = perm; \
1559 i->attrb[count] = &i->private_##attrb[count]; \ 1578 i->attrb[count] = &i->private_##attrb[count]; \
1560 if (test) \ 1579 if (test) \
1561 count++ 1580 count++
1562 1581
1563#define SETUP_TEMPLATE_RW(attrb, field, perm, test, ro_test, ro_perm) \ 1582#define SETUP_TEMPLATE_RW(attrb, field, perm, test, ro_test, ro_perm) \
1564 i->private_##attrb[count] = class_device_attr_##field; \ 1583 i->private_##attrb[count] = dev_attr_##field; \
1565 i->private_##attrb[count].attr.mode = perm; \ 1584 i->private_##attrb[count].attr.mode = perm; \
1566 if (ro_test) { \ 1585 if (ro_test) { \
1567 i->private_##attrb[count].attr.mode = ro_perm; \ 1586 i->private_##attrb[count].attr.mode = ro_perm; \