aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c484
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h4
2 files changed, 259 insertions, 229 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 74c9fc204211..a9fbb3f88659 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -66,23 +66,26 @@ lpfc_jedec_to_ascii(int incr, char hdw[])
66} 66}
67 67
68static ssize_t 68static ssize_t
69lpfc_drvr_version_show(struct class_device *cdev, char *buf) 69lpfc_drvr_version_show(struct device *dev, struct device_attribute *attr,
70 char *buf)
70{ 71{
71 return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); 72 return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n");
72} 73}
73 74
74static ssize_t 75static ssize_t
75lpfc_info_show(struct class_device *cdev, char *buf) 76lpfc_info_show(struct device *dev, struct device_attribute *attr,
77 char *buf)
76{ 78{
77 struct Scsi_Host *host = class_to_shost(cdev); 79 struct Scsi_Host *host = class_to_shost(dev);
78 80
79 return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host)); 81 return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host));
80} 82}
81 83
82static ssize_t 84static ssize_t
83lpfc_serialnum_show(struct class_device *cdev, char *buf) 85lpfc_serialnum_show(struct device *dev, struct device_attribute *attr,
86 char *buf)
84{ 87{
85 struct Scsi_Host *shost = class_to_shost(cdev); 88 struct Scsi_Host *shost = class_to_shost(dev);
86 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 89 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
87 struct lpfc_hba *phba = vport->phba; 90 struct lpfc_hba *phba = vport->phba;
88 91
@@ -90,18 +93,20 @@ lpfc_serialnum_show(struct class_device *cdev, char *buf)
90} 93}
91 94
92static ssize_t 95static ssize_t
93lpfc_temp_sensor_show(struct class_device *cdev, char *buf) 96lpfc_temp_sensor_show(struct device *dev, struct device_attribute *attr,
97 char *buf)
94{ 98{
95 struct Scsi_Host *shost = class_to_shost(cdev); 99 struct Scsi_Host *shost = class_to_shost(dev);
96 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 100 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
97 struct lpfc_hba *phba = vport->phba; 101 struct lpfc_hba *phba = vport->phba;
98 return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support); 102 return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support);
99} 103}
100 104
101static ssize_t 105static ssize_t
102lpfc_modeldesc_show(struct class_device *cdev, char *buf) 106lpfc_modeldesc_show(struct device *dev, struct device_attribute *attr,
107 char *buf)
103{ 108{
104 struct Scsi_Host *shost = class_to_shost(cdev); 109 struct Scsi_Host *shost = class_to_shost(dev);
105 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 110 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
106 struct lpfc_hba *phba = vport->phba; 111 struct lpfc_hba *phba = vport->phba;
107 112
@@ -109,9 +114,10 @@ lpfc_modeldesc_show(struct class_device *cdev, char *buf)
109} 114}
110 115
111static ssize_t 116static ssize_t
112lpfc_modelname_show(struct class_device *cdev, char *buf) 117lpfc_modelname_show(struct device *dev, struct device_attribute *attr,
118 char *buf)
113{ 119{
114 struct Scsi_Host *shost = class_to_shost(cdev); 120 struct Scsi_Host *shost = class_to_shost(dev);
115 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 121 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
116 struct lpfc_hba *phba = vport->phba; 122 struct lpfc_hba *phba = vport->phba;
117 123
@@ -119,9 +125,10 @@ lpfc_modelname_show(struct class_device *cdev, char *buf)
119} 125}
120 126
121static ssize_t 127static ssize_t
122lpfc_programtype_show(struct class_device *cdev, char *buf) 128lpfc_programtype_show(struct device *dev, struct device_attribute *attr,
129 char *buf)
123{ 130{
124 struct Scsi_Host *shost = class_to_shost(cdev); 131 struct Scsi_Host *shost = class_to_shost(dev);
125 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 132 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
126 struct lpfc_hba *phba = vport->phba; 133 struct lpfc_hba *phba = vport->phba;
127 134
@@ -129,9 +136,10 @@ lpfc_programtype_show(struct class_device *cdev, char *buf)
129} 136}
130 137
131static ssize_t 138static ssize_t
132lpfc_vportnum_show(struct class_device *cdev, char *buf) 139lpfc_vportnum_show(struct device *dev, struct device_attribute *attr,
140 char *buf)
133{ 141{
134 struct Scsi_Host *shost = class_to_shost(cdev); 142 struct Scsi_Host *shost = class_to_shost(dev);
135 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 143 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
136 struct lpfc_hba *phba = vport->phba; 144 struct lpfc_hba *phba = vport->phba;
137 145
@@ -139,9 +147,10 @@ lpfc_vportnum_show(struct class_device *cdev, char *buf)
139} 147}
140 148
141static ssize_t 149static ssize_t
142lpfc_fwrev_show(struct class_device *cdev, char *buf) 150lpfc_fwrev_show(struct device *dev, struct device_attribute *attr,
151 char *buf)
143{ 152{
144 struct Scsi_Host *shost = class_to_shost(cdev); 153 struct Scsi_Host *shost = class_to_shost(dev);
145 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 154 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
146 struct lpfc_hba *phba = vport->phba; 155 struct lpfc_hba *phba = vport->phba;
147 char fwrev[32]; 156 char fwrev[32];
@@ -151,10 +160,10 @@ lpfc_fwrev_show(struct class_device *cdev, char *buf)
151} 160}
152 161
153static ssize_t 162static ssize_t
154lpfc_hdw_show(struct class_device *cdev, char *buf) 163lpfc_hdw_show(struct device *dev, struct device_attribute *attr, char *buf)
155{ 164{
156 char hdw[9]; 165 char hdw[9];
157 struct Scsi_Host *shost = class_to_shost(cdev); 166 struct Scsi_Host *shost = class_to_shost(dev);
158 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 167 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
159 struct lpfc_hba *phba = vport->phba; 168 struct lpfc_hba *phba = vport->phba;
160 lpfc_vpd_t *vp = &phba->vpd; 169 lpfc_vpd_t *vp = &phba->vpd;
@@ -163,18 +172,20 @@ lpfc_hdw_show(struct class_device *cdev, char *buf)
163 return snprintf(buf, PAGE_SIZE, "%s\n", hdw); 172 return snprintf(buf, PAGE_SIZE, "%s\n", hdw);
164} 173}
165static ssize_t 174static ssize_t
166lpfc_option_rom_version_show(struct class_device *cdev, char *buf) 175lpfc_option_rom_version_show(struct device *dev, struct device_attribute *attr,
176 char *buf)
167{ 177{
168 struct Scsi_Host *shost = class_to_shost(cdev); 178 struct Scsi_Host *shost = class_to_shost(dev);
169 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 179 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
170 struct lpfc_hba *phba = vport->phba; 180 struct lpfc_hba *phba = vport->phba;
171 181
172 return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); 182 return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion);
173} 183}
174static ssize_t 184static ssize_t
175lpfc_state_show(struct class_device *cdev, char *buf) 185lpfc_state_show(struct device *dev, struct device_attribute *attr,
186 char *buf)
176{ 187{
177 struct Scsi_Host *shost = class_to_shost(cdev); 188 struct Scsi_Host *shost = class_to_shost(dev);
178 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 189 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
179 struct lpfc_hba *phba = vport->phba; 190 struct lpfc_hba *phba = vport->phba;
180 int len = 0; 191 int len = 0;
@@ -243,9 +254,10 @@ lpfc_state_show(struct class_device *cdev, char *buf)
243} 254}
244 255
245static ssize_t 256static ssize_t
246lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) 257lpfc_num_discovered_ports_show(struct device *dev,
258 struct device_attribute *attr, char *buf)
247{ 259{
248 struct Scsi_Host *shost = class_to_shost(cdev); 260 struct Scsi_Host *shost = class_to_shost(dev);
249 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 261 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
250 262
251 return snprintf(buf, PAGE_SIZE, "%d\n", 263 return snprintf(buf, PAGE_SIZE, "%d\n",
@@ -367,9 +379,10 @@ lpfc_selective_reset(struct lpfc_hba *phba)
367} 379}
368 380
369static ssize_t 381static ssize_t
370lpfc_issue_reset(struct class_device *cdev, const char *buf, size_t count) 382lpfc_issue_reset(struct device *dev, struct device_attribute *attr,
383 const char *buf, size_t count)
371{ 384{
372 struct Scsi_Host *shost = class_to_shost(cdev); 385 struct Scsi_Host *shost = class_to_shost(dev);
373 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 386 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
374 struct lpfc_hba *phba = vport->phba; 387 struct lpfc_hba *phba = vport->phba;
375 388
@@ -385,9 +398,10 @@ lpfc_issue_reset(struct class_device *cdev, const char *buf, size_t count)
385} 398}
386 399
387static ssize_t 400static ssize_t
388lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) 401lpfc_nport_evt_cnt_show(struct device *dev, struct device_attribute *attr,
402 char *buf)
389{ 403{
390 struct Scsi_Host *shost = class_to_shost(cdev); 404 struct Scsi_Host *shost = class_to_shost(dev);
391 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 405 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
392 struct lpfc_hba *phba = vport->phba; 406 struct lpfc_hba *phba = vport->phba;
393 407
@@ -395,9 +409,10 @@ lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf)
395} 409}
396 410
397static ssize_t 411static ssize_t
398lpfc_board_mode_show(struct class_device *cdev, char *buf) 412lpfc_board_mode_show(struct device *dev, struct device_attribute *attr,
413 char *buf)
399{ 414{
400 struct Scsi_Host *shost = class_to_shost(cdev); 415 struct Scsi_Host *shost = class_to_shost(dev);
401 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 416 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
402 struct lpfc_hba *phba = vport->phba; 417 struct lpfc_hba *phba = vport->phba;
403 char * state; 418 char * state;
@@ -415,9 +430,10 @@ lpfc_board_mode_show(struct class_device *cdev, char *buf)
415} 430}
416 431
417static ssize_t 432static ssize_t
418lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) 433lpfc_board_mode_store(struct device *dev, struct device_attribute *attr,
434 const char *buf, size_t count)
419{ 435{
420 struct Scsi_Host *shost = class_to_shost(cdev); 436 struct Scsi_Host *shost = class_to_shost(dev);
421 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 437 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
422 struct lpfc_hba *phba = vport->phba; 438 struct lpfc_hba *phba = vport->phba;
423 struct completion online_compl; 439 struct completion online_compl;
@@ -509,9 +525,10 @@ lpfc_get_hba_info(struct lpfc_hba *phba,
509} 525}
510 526
511static ssize_t 527static ssize_t
512lpfc_max_rpi_show(struct class_device *cdev, char *buf) 528lpfc_max_rpi_show(struct device *dev, struct device_attribute *attr,
529 char *buf)
513{ 530{
514 struct Scsi_Host *shost = class_to_shost(cdev); 531 struct Scsi_Host *shost = class_to_shost(dev);
515 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 532 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
516 struct lpfc_hba *phba = vport->phba; 533 struct lpfc_hba *phba = vport->phba;
517 uint32_t cnt; 534 uint32_t cnt;
@@ -522,9 +539,10 @@ lpfc_max_rpi_show(struct class_device *cdev, char *buf)
522} 539}
523 540
524static ssize_t 541static ssize_t
525lpfc_used_rpi_show(struct class_device *cdev, char *buf) 542lpfc_used_rpi_show(struct device *dev, struct device_attribute *attr,
543 char *buf)
526{ 544{
527 struct Scsi_Host *shost = class_to_shost(cdev); 545 struct Scsi_Host *shost = class_to_shost(dev);
528 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 546 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
529 struct lpfc_hba *phba = vport->phba; 547 struct lpfc_hba *phba = vport->phba;
530 uint32_t cnt, acnt; 548 uint32_t cnt, acnt;
@@ -535,9 +553,10 @@ lpfc_used_rpi_show(struct class_device *cdev, char *buf)
535} 553}
536 554
537static ssize_t 555static ssize_t
538lpfc_max_xri_show(struct class_device *cdev, char *buf) 556lpfc_max_xri_show(struct device *dev, struct device_attribute *attr,
557 char *buf)
539{ 558{
540 struct Scsi_Host *shost = class_to_shost(cdev); 559 struct Scsi_Host *shost = class_to_shost(dev);
541 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 560 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
542 struct lpfc_hba *phba = vport->phba; 561 struct lpfc_hba *phba = vport->phba;
543 uint32_t cnt; 562 uint32_t cnt;
@@ -548,9 +567,10 @@ lpfc_max_xri_show(struct class_device *cdev, char *buf)
548} 567}
549 568
550static ssize_t 569static ssize_t
551lpfc_used_xri_show(struct class_device *cdev, char *buf) 570lpfc_used_xri_show(struct device *dev, struct device_attribute *attr,
571 char *buf)
552{ 572{
553 struct Scsi_Host *shost = class_to_shost(cdev); 573 struct Scsi_Host *shost = class_to_shost(dev);
554 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 574 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
555 struct lpfc_hba *phba = vport->phba; 575 struct lpfc_hba *phba = vport->phba;
556 uint32_t cnt, acnt; 576 uint32_t cnt, acnt;
@@ -561,9 +581,10 @@ lpfc_used_xri_show(struct class_device *cdev, char *buf)
561} 581}
562 582
563static ssize_t 583static ssize_t
564lpfc_max_vpi_show(struct class_device *cdev, char *buf) 584lpfc_max_vpi_show(struct device *dev, struct device_attribute *attr,
585 char *buf)
565{ 586{
566 struct Scsi_Host *shost = class_to_shost(cdev); 587 struct Scsi_Host *shost = class_to_shost(dev);
567 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 588 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
568 struct lpfc_hba *phba = vport->phba; 589 struct lpfc_hba *phba = vport->phba;
569 uint32_t cnt; 590 uint32_t cnt;
@@ -574,9 +595,10 @@ lpfc_max_vpi_show(struct class_device *cdev, char *buf)
574} 595}
575 596
576static ssize_t 597static ssize_t
577lpfc_used_vpi_show(struct class_device *cdev, char *buf) 598lpfc_used_vpi_show(struct device *dev, struct device_attribute *attr,
599 char *buf)
578{ 600{
579 struct Scsi_Host *shost = class_to_shost(cdev); 601 struct Scsi_Host *shost = class_to_shost(dev);
580 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 602 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
581 struct lpfc_hba *phba = vport->phba; 603 struct lpfc_hba *phba = vport->phba;
582 uint32_t cnt, acnt; 604 uint32_t cnt, acnt;
@@ -587,9 +609,10 @@ lpfc_used_vpi_show(struct class_device *cdev, char *buf)
587} 609}
588 610
589static ssize_t 611static ssize_t
590lpfc_npiv_info_show(struct class_device *cdev, char *buf) 612lpfc_npiv_info_show(struct device *dev, struct device_attribute *attr,
613 char *buf)
591{ 614{
592 struct Scsi_Host *shost = class_to_shost(cdev); 615 struct Scsi_Host *shost = class_to_shost(dev);
593 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 616 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
594 struct lpfc_hba *phba = vport->phba; 617 struct lpfc_hba *phba = vport->phba;
595 618
@@ -601,9 +624,10 @@ lpfc_npiv_info_show(struct class_device *cdev, char *buf)
601} 624}
602 625
603static ssize_t 626static ssize_t
604lpfc_poll_show(struct class_device *cdev, char *buf) 627lpfc_poll_show(struct device *dev, struct device_attribute *attr,
628 char *buf)
605{ 629{
606 struct Scsi_Host *shost = class_to_shost(cdev); 630 struct Scsi_Host *shost = class_to_shost(dev);
607 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 631 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
608 struct lpfc_hba *phba = vport->phba; 632 struct lpfc_hba *phba = vport->phba;
609 633
@@ -611,10 +635,10 @@ lpfc_poll_show(struct class_device *cdev, char *buf)
611} 635}
612 636
613static ssize_t 637static ssize_t
614lpfc_poll_store(struct class_device *cdev, const char *buf, 638lpfc_poll_store(struct device *dev, struct device_attribute *attr,
615 size_t count) 639 const char *buf, size_t count)
616{ 640{
617 struct Scsi_Host *shost = class_to_shost(cdev); 641 struct Scsi_Host *shost = class_to_shost(dev);
618 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 642 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
619 struct lpfc_hba *phba = vport->phba; 643 struct lpfc_hba *phba = vport->phba;
620 uint32_t creg_val; 644 uint32_t creg_val;
@@ -670,9 +694,10 @@ lpfc_poll_store(struct class_device *cdev, const char *buf,
670 694
671#define lpfc_param_show(attr) \ 695#define lpfc_param_show(attr) \
672static ssize_t \ 696static ssize_t \
673lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 697lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
698 char *buf) \
674{ \ 699{ \
675 struct Scsi_Host *shost = class_to_shost(cdev);\ 700 struct Scsi_Host *shost = class_to_shost(dev);\
676 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 701 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
677 struct lpfc_hba *phba = vport->phba;\ 702 struct lpfc_hba *phba = vport->phba;\
678 int val = 0;\ 703 int val = 0;\
@@ -683,9 +708,10 @@ lpfc_##attr##_show(struct class_device *cdev, char *buf) \
683 708
684#define lpfc_param_hex_show(attr) \ 709#define lpfc_param_hex_show(attr) \
685static ssize_t \ 710static ssize_t \
686lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 711lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
712 char *buf) \
687{ \ 713{ \
688 struct Scsi_Host *shost = class_to_shost(cdev);\ 714 struct Scsi_Host *shost = class_to_shost(dev);\
689 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 715 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
690 struct lpfc_hba *phba = vport->phba;\ 716 struct lpfc_hba *phba = vport->phba;\
691 int val = 0;\ 717 int val = 0;\
@@ -725,9 +751,10 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \
725 751
726#define lpfc_param_store(attr) \ 752#define lpfc_param_store(attr) \
727static ssize_t \ 753static ssize_t \
728lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ 754lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
755 const char *buf, size_t count) \
729{ \ 756{ \
730 struct Scsi_Host *shost = class_to_shost(cdev);\ 757 struct Scsi_Host *shost = class_to_shost(dev);\
731 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 758 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
732 struct lpfc_hba *phba = vport->phba;\ 759 struct lpfc_hba *phba = vport->phba;\
733 int val=0;\ 760 int val=0;\
@@ -743,9 +770,10 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \
743 770
744#define lpfc_vport_param_show(attr) \ 771#define lpfc_vport_param_show(attr) \
745static ssize_t \ 772static ssize_t \
746lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 773lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
774 char *buf) \
747{ \ 775{ \
748 struct Scsi_Host *shost = class_to_shost(cdev);\ 776 struct Scsi_Host *shost = class_to_shost(dev);\
749 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 777 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
750 int val = 0;\ 778 int val = 0;\
751 val = vport->cfg_##attr;\ 779 val = vport->cfg_##attr;\
@@ -754,9 +782,10 @@ lpfc_##attr##_show(struct class_device *cdev, char *buf) \
754 782
755#define lpfc_vport_param_hex_show(attr) \ 783#define lpfc_vport_param_hex_show(attr) \
756static ssize_t \ 784static ssize_t \
757lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 785lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
786 char *buf) \
758{ \ 787{ \
759 struct Scsi_Host *shost = class_to_shost(cdev);\ 788 struct Scsi_Host *shost = class_to_shost(dev);\
760 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 789 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
761 int val = 0;\ 790 int val = 0;\
762 val = vport->cfg_##attr;\ 791 val = vport->cfg_##attr;\
@@ -794,9 +823,10 @@ lpfc_##attr##_set(struct lpfc_vport *vport, int val) \
794 823
795#define lpfc_vport_param_store(attr) \ 824#define lpfc_vport_param_store(attr) \
796static ssize_t \ 825static ssize_t \
797lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ 826lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
827 const char *buf, size_t count) \
798{ \ 828{ \
799 struct Scsi_Host *shost = class_to_shost(cdev);\ 829 struct Scsi_Host *shost = class_to_shost(dev);\
800 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 830 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
801 int val=0;\ 831 int val=0;\
802 if (!isdigit(buf[0]))\ 832 if (!isdigit(buf[0]))\
@@ -822,7 +852,7 @@ module_param(lpfc_##name, int, 0);\
822MODULE_PARM_DESC(lpfc_##name, desc);\ 852MODULE_PARM_DESC(lpfc_##name, desc);\
823lpfc_param_show(name)\ 853lpfc_param_show(name)\
824lpfc_param_init(name, defval, minval, maxval)\ 854lpfc_param_init(name, defval, minval, maxval)\
825static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 855static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
826 856
827#define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \ 857#define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \
828static int lpfc_##name = defval;\ 858static int lpfc_##name = defval;\
@@ -832,8 +862,8 @@ lpfc_param_show(name)\
832lpfc_param_init(name, defval, minval, maxval)\ 862lpfc_param_init(name, defval, minval, maxval)\
833lpfc_param_set(name, defval, minval, maxval)\ 863lpfc_param_set(name, defval, minval, maxval)\
834lpfc_param_store(name)\ 864lpfc_param_store(name)\
835static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 865static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
836 lpfc_##name##_show, lpfc_##name##_store) 866 lpfc_##name##_show, lpfc_##name##_store)
837 867
838#define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \ 868#define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \
839static int lpfc_##name = defval;\ 869static int lpfc_##name = defval;\
@@ -841,7 +871,7 @@ module_param(lpfc_##name, int, 0);\
841MODULE_PARM_DESC(lpfc_##name, desc);\ 871MODULE_PARM_DESC(lpfc_##name, desc);\
842lpfc_param_hex_show(name)\ 872lpfc_param_hex_show(name)\
843lpfc_param_init(name, defval, minval, maxval)\ 873lpfc_param_init(name, defval, minval, maxval)\
844static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 874static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
845 875
846#define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ 876#define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
847static int lpfc_##name = defval;\ 877static int lpfc_##name = defval;\
@@ -851,8 +881,8 @@ lpfc_param_hex_show(name)\
851lpfc_param_init(name, defval, minval, maxval)\ 881lpfc_param_init(name, defval, minval, maxval)\
852lpfc_param_set(name, defval, minval, maxval)\ 882lpfc_param_set(name, defval, minval, maxval)\
853lpfc_param_store(name)\ 883lpfc_param_store(name)\
854static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 884static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
855 lpfc_##name##_show, lpfc_##name##_store) 885 lpfc_##name##_show, lpfc_##name##_store)
856 886
857#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \ 887#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \
858static int lpfc_##name = defval;\ 888static int lpfc_##name = defval;\
@@ -866,7 +896,7 @@ module_param(lpfc_##name, int, 0);\
866MODULE_PARM_DESC(lpfc_##name, desc);\ 896MODULE_PARM_DESC(lpfc_##name, desc);\
867lpfc_vport_param_show(name)\ 897lpfc_vport_param_show(name)\
868lpfc_vport_param_init(name, defval, minval, maxval)\ 898lpfc_vport_param_init(name, defval, minval, maxval)\
869static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 899static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
870 900
871#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \ 901#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
872static int lpfc_##name = defval;\ 902static int lpfc_##name = defval;\
@@ -876,8 +906,8 @@ lpfc_vport_param_show(name)\
876lpfc_vport_param_init(name, defval, minval, maxval)\ 906lpfc_vport_param_init(name, defval, minval, maxval)\
877lpfc_vport_param_set(name, defval, minval, maxval)\ 907lpfc_vport_param_set(name, defval, minval, maxval)\
878lpfc_vport_param_store(name)\ 908lpfc_vport_param_store(name)\
879static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 909static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
880 lpfc_##name##_show, lpfc_##name##_store) 910 lpfc_##name##_show, lpfc_##name##_store)
881 911
882#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \ 912#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \
883static int lpfc_##name = defval;\ 913static int lpfc_##name = defval;\
@@ -885,7 +915,7 @@ module_param(lpfc_##name, int, 0);\
885MODULE_PARM_DESC(lpfc_##name, desc);\ 915MODULE_PARM_DESC(lpfc_##name, desc);\
886lpfc_vport_param_hex_show(name)\ 916lpfc_vport_param_hex_show(name)\
887lpfc_vport_param_init(name, defval, minval, maxval)\ 917lpfc_vport_param_init(name, defval, minval, maxval)\
888static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 918static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
889 919
890#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ 920#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
891static int lpfc_##name = defval;\ 921static int lpfc_##name = defval;\
@@ -895,46 +925,44 @@ lpfc_vport_param_hex_show(name)\
895lpfc_vport_param_init(name, defval, minval, maxval)\ 925lpfc_vport_param_init(name, defval, minval, maxval)\
896lpfc_vport_param_set(name, defval, minval, maxval)\ 926lpfc_vport_param_set(name, defval, minval, maxval)\
897lpfc_vport_param_store(name)\ 927lpfc_vport_param_store(name)\
898static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 928static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
899 lpfc_##name##_show, lpfc_##name##_store) 929 lpfc_##name##_show, lpfc_##name##_store)
900 930
901static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); 931static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL);
902static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 932static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL);
903static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); 933static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL);
904static CLASS_DEVICE_ATTR(modelname, S_IRUGO, lpfc_modelname_show, NULL); 934static DEVICE_ATTR(modelname, S_IRUGO, lpfc_modelname_show, NULL);
905static CLASS_DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL); 935static DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL);
906static CLASS_DEVICE_ATTR(portnum, S_IRUGO, lpfc_vportnum_show, NULL); 936static DEVICE_ATTR(portnum, S_IRUGO, lpfc_vportnum_show, NULL);
907static CLASS_DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL); 937static DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL);
908static CLASS_DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL); 938static DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL);
909static CLASS_DEVICE_ATTR(state, S_IRUGO, lpfc_state_show, NULL); 939static DEVICE_ATTR(state, S_IRUGO, lpfc_state_show, NULL);
910static CLASS_DEVICE_ATTR(option_rom_version, S_IRUGO, 940static DEVICE_ATTR(option_rom_version, S_IRUGO,
911 lpfc_option_rom_version_show, NULL); 941 lpfc_option_rom_version_show, NULL);
912static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO, 942static DEVICE_ATTR(num_discovered_ports, S_IRUGO,
913 lpfc_num_discovered_ports_show, NULL); 943 lpfc_num_discovered_ports_show, NULL);
914static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); 944static DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL);
915static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, 945static DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, NULL);
916 NULL); 946static DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR,
917static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, 947 lpfc_board_mode_show, lpfc_board_mode_store);
918 lpfc_board_mode_show, lpfc_board_mode_store); 948static DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset);
919static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); 949static DEVICE_ATTR(max_vpi, S_IRUGO, lpfc_max_vpi_show, NULL);
920static CLASS_DEVICE_ATTR(max_vpi, S_IRUGO, lpfc_max_vpi_show, NULL); 950static DEVICE_ATTR(used_vpi, S_IRUGO, lpfc_used_vpi_show, NULL);
921static CLASS_DEVICE_ATTR(used_vpi, S_IRUGO, lpfc_used_vpi_show, NULL); 951static DEVICE_ATTR(max_rpi, S_IRUGO, lpfc_max_rpi_show, NULL);
922static CLASS_DEVICE_ATTR(max_rpi, S_IRUGO, lpfc_max_rpi_show, NULL); 952static DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL);
923static CLASS_DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL); 953static DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL);
924static CLASS_DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL); 954static DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL);
925static CLASS_DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); 955static DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL);
926static CLASS_DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); 956static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL);
927static CLASS_DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show,
928 NULL);
929 957
930 958
931static char *lpfc_soft_wwn_key = "C99G71SL8032A"; 959static char *lpfc_soft_wwn_key = "C99G71SL8032A";
932 960
933static ssize_t 961static ssize_t
934lpfc_soft_wwn_enable_store(struct class_device *cdev, const char *buf, 962lpfc_soft_wwn_enable_store(struct device *dev, struct device_attribute *attr,
935 size_t count) 963 const char *buf, size_t count)
936{ 964{
937 struct Scsi_Host *shost = class_to_shost(cdev); 965 struct Scsi_Host *shost = class_to_shost(dev);
938 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 966 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
939 struct lpfc_hba *phba = vport->phba; 967 struct lpfc_hba *phba = vport->phba;
940 unsigned int cnt = count; 968 unsigned int cnt = count;
@@ -963,13 +991,14 @@ lpfc_soft_wwn_enable_store(struct class_device *cdev, const char *buf,
963 phba->soft_wwn_enable = 1; 991 phba->soft_wwn_enable = 1;
964 return count; 992 return count;
965} 993}
966static CLASS_DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL, 994static DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL,
967 lpfc_soft_wwn_enable_store); 995 lpfc_soft_wwn_enable_store);
968 996
969static ssize_t 997static ssize_t
970lpfc_soft_wwpn_show(struct class_device *cdev, char *buf) 998lpfc_soft_wwpn_show(struct device *dev, struct device_attribute *attr,
999 char *buf)
971{ 1000{
972 struct Scsi_Host *shost = class_to_shost(cdev); 1001 struct Scsi_Host *shost = class_to_shost(dev);
973 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1002 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
974 struct lpfc_hba *phba = vport->phba; 1003 struct lpfc_hba *phba = vport->phba;
975 1004
@@ -979,9 +1008,10 @@ lpfc_soft_wwpn_show(struct class_device *cdev, char *buf)
979 1008
980 1009
981static ssize_t 1010static ssize_t
982lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) 1011lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr,
1012 const char *buf, size_t count)
983{ 1013{
984 struct Scsi_Host *shost = class_to_shost(cdev); 1014 struct Scsi_Host *shost = class_to_shost(dev);
985 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1015 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
986 struct lpfc_hba *phba = vport->phba; 1016 struct lpfc_hba *phba = vport->phba;
987 struct completion online_compl; 1017 struct completion online_compl;
@@ -1047,13 +1077,14 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
1047 "reinit adapter - %d\n", stat2); 1077 "reinit adapter - %d\n", stat2);
1048 return (stat1 || stat2) ? -EIO : count; 1078 return (stat1 || stat2) ? -EIO : count;
1049} 1079}
1050static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ 1080static DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
1051 lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); 1081 lpfc_soft_wwpn_show, lpfc_soft_wwpn_store);
1052 1082
1053static ssize_t 1083static ssize_t
1054lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) 1084lpfc_soft_wwnn_show(struct device *dev, struct device_attribute *attr,
1085 char *buf)
1055{ 1086{
1056 struct Scsi_Host *shost = class_to_shost(cdev); 1087 struct Scsi_Host *shost = class_to_shost(dev);
1057 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; 1088 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
1058 return snprintf(buf, PAGE_SIZE, "0x%llx\n", 1089 return snprintf(buf, PAGE_SIZE, "0x%llx\n",
1059 (unsigned long long)phba->cfg_soft_wwnn); 1090 (unsigned long long)phba->cfg_soft_wwnn);
@@ -1061,9 +1092,10 @@ lpfc_soft_wwnn_show(struct class_device *cdev, char *buf)
1061 1092
1062 1093
1063static ssize_t 1094static ssize_t
1064lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) 1095lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr,
1096 const char *buf, size_t count)
1065{ 1097{
1066 struct Scsi_Host *shost = class_to_shost(cdev); 1098 struct Scsi_Host *shost = class_to_shost(dev);
1067 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; 1099 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
1068 unsigned int i, j, cnt=count; 1100 unsigned int i, j, cnt=count;
1069 u8 wwnn[8]; 1101 u8 wwnn[8];
@@ -1107,8 +1139,8 @@ lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count)
1107 1139
1108 return count; 1140 return count;
1109} 1141}
1110static CLASS_DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR,\ 1142static DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR,\
1111 lpfc_soft_wwnn_show, lpfc_soft_wwnn_store); 1143 lpfc_soft_wwnn_show, lpfc_soft_wwnn_store);
1112 1144
1113 1145
1114static int lpfc_poll = 0; 1146static int lpfc_poll = 0;
@@ -1118,8 +1150,8 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:"
1118 " 1 - poll with interrupts enabled" 1150 " 1 - poll with interrupts enabled"
1119 " 3 - poll and disable FCP ring interrupts"); 1151 " 3 - poll and disable FCP ring interrupts");
1120 1152
1121static CLASS_DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, 1153static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR,
1122 lpfc_poll_show, lpfc_poll_store); 1154 lpfc_poll_show, lpfc_poll_store);
1123 1155
1124int lpfc_sli_mode = 0; 1156int lpfc_sli_mode = 0;
1125module_param(lpfc_sli_mode, int, 0); 1157module_param(lpfc_sli_mode, int, 0);
@@ -1133,7 +1165,7 @@ module_param(lpfc_enable_npiv, int, 0);
1133MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality"); 1165MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality");
1134lpfc_param_show(enable_npiv); 1166lpfc_param_show(enable_npiv);
1135lpfc_param_init(enable_npiv, 0, 0, 1); 1167lpfc_param_init(enable_npiv, 0, 0, 1);
1136static CLASS_DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, 1168static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO,
1137 lpfc_enable_npiv_show, NULL); 1169 lpfc_enable_npiv_show, NULL);
1138 1170
1139/* 1171/*
@@ -1147,9 +1179,10 @@ MODULE_PARM_DESC(lpfc_nodev_tmo,
1147 "Seconds driver will hold I/O waiting " 1179 "Seconds driver will hold I/O waiting "
1148 "for a device to come back"); 1180 "for a device to come back");
1149static ssize_t 1181static ssize_t
1150lpfc_nodev_tmo_show(struct class_device *cdev, char *buf) 1182lpfc_nodev_tmo_show(struct device *dev, struct device_attribute *attr,
1183 char *buf)
1151{ 1184{
1152 struct Scsi_Host *shost = class_to_shost(cdev); 1185 struct Scsi_Host *shost = class_to_shost(dev);
1153 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1186 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1154 int val = 0; 1187 int val = 0;
1155 val = vport->cfg_devloss_tmo; 1188 val = vport->cfg_devloss_tmo;
@@ -1221,8 +1254,8 @@ lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val)
1221 1254
1222lpfc_vport_param_store(nodev_tmo) 1255lpfc_vport_param_store(nodev_tmo)
1223 1256
1224static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, 1257static DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR,
1225 lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); 1258 lpfc_nodev_tmo_show, lpfc_nodev_tmo_store);
1226 1259
1227/* 1260/*
1228# lpfc_devloss_tmo: If set, it will hold all I/O errors on devices that 1261# lpfc_devloss_tmo: If set, it will hold all I/O errors on devices that
@@ -1255,8 +1288,8 @@ lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val)
1255} 1288}
1256 1289
1257lpfc_vport_param_store(devloss_tmo) 1290lpfc_vport_param_store(devloss_tmo)
1258static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, 1291static DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
1259 lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); 1292 lpfc_devloss_tmo_show, lpfc_devloss_tmo_store);
1260 1293
1261/* 1294/*
1262# lpfc_log_verbose: Only turn this flag on if you are willing to risk being 1295# lpfc_log_verbose: Only turn this flag on if you are willing to risk being
@@ -1374,8 +1407,8 @@ lpfc_restrict_login_set(struct lpfc_vport *vport, int val)
1374 return 0; 1407 return 0;
1375} 1408}
1376lpfc_vport_param_store(restrict_login); 1409lpfc_vport_param_store(restrict_login);
1377static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, 1410static DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR,
1378 lpfc_restrict_login_show, lpfc_restrict_login_store); 1411 lpfc_restrict_login_show, lpfc_restrict_login_store);
1379 1412
1380/* 1413/*
1381# Some disk devices have a "select ID" or "select Target" capability. 1414# Some disk devices have a "select ID" or "select Target" capability.
@@ -1433,7 +1466,7 @@ MODULE_PARM_DESC(lpfc_topology, "Select Fibre Channel topology");
1433lpfc_param_show(topology) 1466lpfc_param_show(topology)
1434lpfc_param_init(topology, 0, 0, 6) 1467lpfc_param_init(topology, 0, 0, 6)
1435lpfc_param_store(topology) 1468lpfc_param_store(topology)
1436static CLASS_DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, 1469static DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR,
1437 lpfc_topology_show, lpfc_topology_store); 1470 lpfc_topology_show, lpfc_topology_store);
1438 1471
1439/* 1472/*
@@ -1497,7 +1530,7 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val)
1497} 1530}
1498 1531
1499lpfc_param_store(link_speed) 1532lpfc_param_store(link_speed)
1500static CLASS_DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, 1533static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR,
1501 lpfc_link_speed_show, lpfc_link_speed_store); 1534 lpfc_link_speed_show, lpfc_link_speed_store);
1502 1535
1503/* 1536/*
@@ -1623,82 +1656,81 @@ LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat.");
1623LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, 1656LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT,
1624 LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); 1657 LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count");
1625 1658
1626struct class_device_attribute *lpfc_hba_attrs[] = { 1659struct device_attribute *lpfc_hba_attrs[] = {
1627 &class_device_attr_info, 1660 &dev_attr_info,
1628 &class_device_attr_serialnum, 1661 &dev_attr_serialnum,
1629 &class_device_attr_modeldesc, 1662 &dev_attr_modeldesc,
1630 &class_device_attr_modelname, 1663 &dev_attr_modelname,
1631 &class_device_attr_programtype, 1664 &dev_attr_programtype,
1632 &class_device_attr_portnum, 1665 &dev_attr_portnum,
1633 &class_device_attr_fwrev, 1666 &dev_attr_fwrev,
1634 &class_device_attr_hdw, 1667 &dev_attr_hdw,
1635 &class_device_attr_option_rom_version, 1668 &dev_attr_option_rom_version,
1636 &class_device_attr_state, 1669 &dev_attr_state,
1637 &class_device_attr_num_discovered_ports, 1670 &dev_attr_num_discovered_ports,
1638 &class_device_attr_lpfc_drvr_version, 1671 &dev_attr_lpfc_drvr_version,
1639 &class_device_attr_lpfc_temp_sensor, 1672 &dev_attr_lpfc_temp_sensor,
1640 &class_device_attr_lpfc_log_verbose, 1673 &dev_attr_lpfc_log_verbose,
1641 &class_device_attr_lpfc_lun_queue_depth, 1674 &dev_attr_lpfc_lun_queue_depth,
1642 &class_device_attr_lpfc_hba_queue_depth, 1675 &dev_attr_lpfc_hba_queue_depth,
1643 &class_device_attr_lpfc_peer_port_login, 1676 &dev_attr_lpfc_peer_port_login,
1644 &class_device_attr_lpfc_nodev_tmo, 1677 &dev_attr_lpfc_nodev_tmo,
1645 &class_device_attr_lpfc_devloss_tmo, 1678 &dev_attr_lpfc_devloss_tmo,
1646 &class_device_attr_lpfc_fcp_class, 1679 &dev_attr_lpfc_fcp_class,
1647 &class_device_attr_lpfc_use_adisc, 1680 &dev_attr_lpfc_use_adisc,
1648 &class_device_attr_lpfc_ack0, 1681 &dev_attr_lpfc_ack0,
1649 &class_device_attr_lpfc_topology, 1682 &dev_attr_lpfc_topology,
1650 &class_device_attr_lpfc_scan_down, 1683 &dev_attr_lpfc_scan_down,
1651 &class_device_attr_lpfc_link_speed, 1684 &dev_attr_lpfc_link_speed,
1652 &class_device_attr_lpfc_cr_delay, 1685 &dev_attr_lpfc_cr_delay,
1653 &class_device_attr_lpfc_cr_count, 1686 &dev_attr_lpfc_cr_count,
1654 &class_device_attr_lpfc_multi_ring_support, 1687 &dev_attr_lpfc_multi_ring_support,
1655 &class_device_attr_lpfc_multi_ring_rctl, 1688 &dev_attr_lpfc_multi_ring_rctl,
1656 &class_device_attr_lpfc_multi_ring_type, 1689 &dev_attr_lpfc_multi_ring_type,
1657 &class_device_attr_lpfc_fdmi_on, 1690 &dev_attr_lpfc_fdmi_on,
1658 &class_device_attr_lpfc_max_luns, 1691 &dev_attr_lpfc_max_luns,
1659 &class_device_attr_lpfc_enable_npiv, 1692 &dev_attr_lpfc_enable_npiv,
1660 &class_device_attr_nport_evt_cnt, 1693 &dev_attr_nport_evt_cnt,
1661 &class_device_attr_board_mode, 1694 &dev_attr_board_mode,
1662 &class_device_attr_max_vpi, 1695 &dev_attr_max_vpi,
1663 &class_device_attr_used_vpi, 1696 &dev_attr_used_vpi,
1664 &class_device_attr_max_rpi, 1697 &dev_attr_max_rpi,
1665 &class_device_attr_used_rpi, 1698 &dev_attr_used_rpi,
1666 &class_device_attr_max_xri, 1699 &dev_attr_max_xri,
1667 &class_device_attr_used_xri, 1700 &dev_attr_used_xri,
1668 &class_device_attr_npiv_info, 1701 &dev_attr_npiv_info,
1669 &class_device_attr_issue_reset, 1702 &dev_attr_issue_reset,
1670 &class_device_attr_lpfc_poll, 1703 &dev_attr_lpfc_poll,
1671 &class_device_attr_lpfc_poll_tmo, 1704 &dev_attr_lpfc_poll_tmo,
1672 &class_device_attr_lpfc_use_msi, 1705 &dev_attr_lpfc_use_msi,
1673 &class_device_attr_lpfc_soft_wwnn, 1706 &dev_attr_lpfc_soft_wwnn,
1674 &class_device_attr_lpfc_soft_wwpn, 1707 &dev_attr_lpfc_soft_wwpn,
1675 &class_device_attr_lpfc_soft_wwn_enable, 1708 &dev_attr_lpfc_soft_wwn_enable,
1676 &class_device_attr_lpfc_enable_hba_reset, 1709 &dev_attr_lpfc_enable_hba_reset,
1677 &class_device_attr_lpfc_enable_hba_heartbeat, 1710 &dev_attr_lpfc_enable_hba_heartbeat,
1678 &class_device_attr_lpfc_sg_seg_cnt, 1711 &dev_attr_lpfc_sg_seg_cnt,
1679 NULL, 1712 NULL,
1680}; 1713};
1681 1714
1682struct class_device_attribute *lpfc_vport_attrs[] = { 1715struct device_attribute *lpfc_vport_attrs[] = {
1683 &class_device_attr_info, 1716 &dev_attr_info,
1684 &class_device_attr_state, 1717 &dev_attr_state,
1685 &class_device_attr_num_discovered_ports, 1718 &dev_attr_num_discovered_ports,
1686 &class_device_attr_lpfc_drvr_version, 1719 &dev_attr_lpfc_drvr_version,
1687 1720 &dev_attr_lpfc_log_verbose,
1688 &class_device_attr_lpfc_log_verbose, 1721 &dev_attr_lpfc_lun_queue_depth,
1689 &class_device_attr_lpfc_lun_queue_depth, 1722 &dev_attr_lpfc_nodev_tmo,
1690 &class_device_attr_lpfc_nodev_tmo, 1723 &dev_attr_lpfc_devloss_tmo,
1691 &class_device_attr_lpfc_devloss_tmo, 1724 &dev_attr_lpfc_hba_queue_depth,
1692 &class_device_attr_lpfc_hba_queue_depth, 1725 &dev_attr_lpfc_peer_port_login,
1693 &class_device_attr_lpfc_peer_port_login, 1726 &dev_attr_lpfc_restrict_login,
1694 &class_device_attr_lpfc_restrict_login, 1727 &dev_attr_lpfc_fcp_class,
1695 &class_device_attr_lpfc_fcp_class, 1728 &dev_attr_lpfc_use_adisc,
1696 &class_device_attr_lpfc_use_adisc, 1729 &dev_attr_lpfc_fdmi_on,
1697 &class_device_attr_lpfc_fdmi_on, 1730 &dev_attr_lpfc_max_luns,
1698 &class_device_attr_lpfc_max_luns, 1731 &dev_attr_nport_evt_cnt,
1699 &class_device_attr_nport_evt_cnt, 1732 &dev_attr_npiv_info,
1700 &class_device_attr_npiv_info, 1733 &dev_attr_lpfc_enable_da_id,
1701 &class_device_attr_lpfc_enable_da_id,
1702 NULL, 1734 NULL,
1703}; 1735};
1704 1736
@@ -1707,9 +1739,8 @@ sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr,
1707 char *buf, loff_t off, size_t count) 1739 char *buf, loff_t off, size_t count)
1708{ 1740{
1709 size_t buf_off; 1741 size_t buf_off;
1710 struct class_device *cdev = container_of(kobj, struct class_device, 1742 struct device *dev = container_of(kobj, struct device, kobj);
1711 kobj); 1743 struct Scsi_Host *shost = class_to_shost(dev);
1712 struct Scsi_Host *shost = class_to_shost(cdev);
1713 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1744 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1714 struct lpfc_hba *phba = vport->phba; 1745 struct lpfc_hba *phba = vport->phba;
1715 1746
@@ -1741,9 +1772,8 @@ sysfs_ctlreg_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1741{ 1772{
1742 size_t buf_off; 1773 size_t buf_off;
1743 uint32_t * tmp_ptr; 1774 uint32_t * tmp_ptr;
1744 struct class_device *cdev = container_of(kobj, struct class_device, 1775 struct device *dev = container_of(kobj, struct device, kobj);
1745 kobj); 1776 struct Scsi_Host *shost = class_to_shost(dev);
1746 struct Scsi_Host *shost = class_to_shost(cdev);
1747 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1777 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1748 struct lpfc_hba *phba = vport->phba; 1778 struct lpfc_hba *phba = vport->phba;
1749 1779
@@ -1798,9 +1828,8 @@ static ssize_t
1798sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, 1828sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr,
1799 char *buf, loff_t off, size_t count) 1829 char *buf, loff_t off, size_t count)
1800{ 1830{
1801 struct class_device *cdev = container_of(kobj, struct class_device, 1831 struct device *dev = container_of(kobj, struct device, kobj);
1802 kobj); 1832 struct Scsi_Host *shost = class_to_shost(dev);
1803 struct Scsi_Host *shost = class_to_shost(cdev);
1804 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1833 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1805 struct lpfc_hba *phba = vport->phba; 1834 struct lpfc_hba *phba = vport->phba;
1806 struct lpfcMboxq *mbox = NULL; 1835 struct lpfcMboxq *mbox = NULL;
@@ -1853,9 +1882,8 @@ static ssize_t
1853sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, 1882sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1854 char *buf, loff_t off, size_t count) 1883 char *buf, loff_t off, size_t count)
1855{ 1884{
1856 struct class_device *cdev = container_of(kobj, struct class_device, 1885 struct device *dev = container_of(kobj, struct device, kobj);
1857 kobj); 1886 struct Scsi_Host *shost = class_to_shost(dev);
1858 struct Scsi_Host *shost = class_to_shost(cdev);
1859 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1887 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1860 struct lpfc_hba *phba = vport->phba; 1888 struct lpfc_hba *phba = vport->phba;
1861 int rc; 1889 int rc;
@@ -2038,19 +2066,19 @@ lpfc_alloc_sysfs_attr(struct lpfc_vport *vport)
2038 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 2066 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2039 int error; 2067 int error;
2040 2068
2041 error = sysfs_create_bin_file(&shost->shost_classdev.kobj, 2069 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
2042 &sysfs_ctlreg_attr); 2070 &sysfs_ctlreg_attr);
2043 if (error) 2071 if (error)
2044 goto out; 2072 goto out;
2045 2073
2046 error = sysfs_create_bin_file(&shost->shost_classdev.kobj, 2074 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
2047 &sysfs_mbox_attr); 2075 &sysfs_mbox_attr);
2048 if (error) 2076 if (error)
2049 goto out_remove_ctlreg_attr; 2077 goto out_remove_ctlreg_attr;
2050 2078
2051 return 0; 2079 return 0;
2052out_remove_ctlreg_attr: 2080out_remove_ctlreg_attr:
2053 sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_ctlreg_attr); 2081 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr);
2054out: 2082out:
2055 return error; 2083 return error;
2056} 2084}
@@ -2060,8 +2088,8 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
2060{ 2088{
2061 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 2089 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2062 2090
2063 sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_mbox_attr); 2091 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr);
2064 sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_ctlreg_attr); 2092 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr);
2065} 2093}
2066 2094
2067 2095
@@ -2443,9 +2471,11 @@ lpfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
2443 2471
2444#define lpfc_rport_show_function(field, format_string, sz, cast) \ 2472#define lpfc_rport_show_function(field, format_string, sz, cast) \
2445static ssize_t \ 2473static ssize_t \
2446lpfc_show_rport_##field (struct class_device *cdev, char *buf) \ 2474lpfc_show_rport_##field (struct device *dev, \
2475 struct device_attribute *attr, \
2476 char *buf) \
2447{ \ 2477{ \
2448 struct fc_rport *rport = transport_class_to_rport(cdev); \ 2478 struct fc_rport *rport = transport_class_to_rport(dev); \
2449 struct lpfc_rport_data *rdata = rport->hostdata; \ 2479 struct lpfc_rport_data *rdata = rport->hostdata; \
2450 return snprintf(buf, sz, format_string, \ 2480 return snprintf(buf, sz, format_string, \
2451 (rdata->target) ? cast rdata->target->field : 0); \ 2481 (rdata->target) ? cast rdata->target->field : 0); \
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 0819f5f39de5..7c9f8317d972 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -253,8 +253,8 @@ void lpfc_get_cfgparam(struct lpfc_hba *);
253void lpfc_get_vport_cfgparam(struct lpfc_vport *); 253void lpfc_get_vport_cfgparam(struct lpfc_vport *);
254int lpfc_alloc_sysfs_attr(struct lpfc_vport *); 254int lpfc_alloc_sysfs_attr(struct lpfc_vport *);
255void lpfc_free_sysfs_attr(struct lpfc_vport *); 255void lpfc_free_sysfs_attr(struct lpfc_vport *);
256extern struct class_device_attribute *lpfc_hba_attrs[]; 256extern struct device_attribute *lpfc_hba_attrs[];
257extern struct class_device_attribute *lpfc_vport_attrs[]; 257extern struct device_attribute *lpfc_vport_attrs[];
258extern struct scsi_host_template lpfc_template; 258extern struct scsi_host_template lpfc_template;
259extern struct scsi_host_template lpfc_vport_template; 259extern struct scsi_host_template lpfc_vport_template;
260extern struct fc_function_template lpfc_transport_functions; 260extern struct fc_function_template lpfc_transport_functions;