aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2007-09-20 17:07:45 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:50:22 -0400
commitf363b9434a464e72927b468ba33cb548f482669f (patch)
treec6e21249030879401929ec66c3fbea19c56527c5 /drivers/scsi/qla2xxx
parente745759a0f662992327537be4ec01d9a43542fc4 (diff)
[SCSI] qla2xxx: Use shost_priv().
Drop usage of legacy to_qla_host() macro. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c88
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c20
5 files changed, 58 insertions, 60 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index c90dc59abe0f..05fa7796a559 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -18,7 +18,7 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj,
18 struct bin_attribute *bin_attr, 18 struct bin_attribute *bin_attr,
19 char *buf, loff_t off, size_t count) 19 char *buf, loff_t off, size_t count)
20{ 20{
21 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 21 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
22 struct device, kobj))); 22 struct device, kobj)));
23 char *rbuf = (char *)ha->fw_dump; 23 char *rbuf = (char *)ha->fw_dump;
24 24
@@ -39,7 +39,7 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj,
39 struct bin_attribute *bin_attr, 39 struct bin_attribute *bin_attr,
40 char *buf, loff_t off, size_t count) 40 char *buf, loff_t off, size_t count)
41{ 41{
42 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 42 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
43 struct device, kobj))); 43 struct device, kobj)));
44 int reading; 44 int reading;
45 45
@@ -89,7 +89,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj,
89 struct bin_attribute *bin_attr, 89 struct bin_attribute *bin_attr,
90 char *buf, loff_t off, size_t count) 90 char *buf, loff_t off, size_t count)
91{ 91{
92 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 92 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
93 struct device, kobj))); 93 struct device, kobj)));
94 int size = ha->nvram_size; 94 int size = ha->nvram_size;
95 char *nvram_cache = ha->nvram; 95 char *nvram_cache = ha->nvram;
@@ -112,7 +112,7 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj,
112 struct bin_attribute *bin_attr, 112 struct bin_attribute *bin_attr,
113 char *buf, loff_t off, size_t count) 113 char *buf, loff_t off, size_t count)
114{ 114{
115 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 115 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
116 struct device, kobj))); 116 struct device, kobj)));
117 unsigned long flags; 117 unsigned long flags;
118 uint16_t cnt; 118 uint16_t cnt;
@@ -170,7 +170,7 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj,
170 struct bin_attribute *bin_attr, 170 struct bin_attribute *bin_attr,
171 char *buf, loff_t off, size_t count) 171 char *buf, loff_t off, size_t count)
172{ 172{
173 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 173 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
174 struct device, kobj))); 174 struct device, kobj)));
175 175
176 if (ha->optrom_state != QLA_SREADING) 176 if (ha->optrom_state != QLA_SREADING)
@@ -190,7 +190,7 @@ qla2x00_sysfs_write_optrom(struct kobject *kobj,
190 struct bin_attribute *bin_attr, 190 struct bin_attribute *bin_attr,
191 char *buf, loff_t off, size_t count) 191 char *buf, loff_t off, size_t count)
192{ 192{
193 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 193 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
194 struct device, kobj))); 194 struct device, kobj)));
195 195
196 if (ha->optrom_state != QLA_SWRITING) 196 if (ha->optrom_state != QLA_SWRITING)
@@ -220,7 +220,7 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
220 struct bin_attribute *bin_attr, 220 struct bin_attribute *bin_attr,
221 char *buf, loff_t off, size_t count) 221 char *buf, loff_t off, size_t count)
222{ 222{
223 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 223 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
224 struct device, kobj))); 224 struct device, kobj)));
225 uint32_t start = 0; 225 uint32_t start = 0;
226 uint32_t size = ha->optrom_size; 226 uint32_t size = ha->optrom_size;
@@ -372,7 +372,7 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj,
372 struct bin_attribute *bin_attr, 372 struct bin_attribute *bin_attr,
373 char *buf, loff_t off, size_t count) 373 char *buf, loff_t off, size_t count)
374{ 374{
375 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 375 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
376 struct device, kobj))); 376 struct device, kobj)));
377 int size = ha->vpd_size; 377 int size = ha->vpd_size;
378 char *vpd_cache = ha->vpd; 378 char *vpd_cache = ha->vpd;
@@ -395,7 +395,7 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj,
395 struct bin_attribute *bin_attr, 395 struct bin_attribute *bin_attr,
396 char *buf, loff_t off, size_t count) 396 char *buf, loff_t off, size_t count)
397{ 397{
398 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 398 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
399 struct device, kobj))); 399 struct device, kobj)));
400 unsigned long flags; 400 unsigned long flags;
401 401
@@ -426,7 +426,7 @@ qla2x00_sysfs_read_sfp(struct kobject *kobj,
426 struct bin_attribute *bin_attr, 426 struct bin_attribute *bin_attr,
427 char *buf, loff_t off, size_t count) 427 char *buf, loff_t off, size_t count)
428{ 428{
429 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, 429 struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
430 struct device, kobj))); 430 struct device, kobj)));
431 uint16_t iter, addr, offset; 431 uint16_t iter, addr, offset;
432 int rval; 432 int rval;
@@ -531,7 +531,7 @@ qla2x00_drvr_version_show(struct class_device *cdev, char *buf)
531static ssize_t 531static ssize_t
532qla2x00_fw_version_show(struct class_device *cdev, char *buf) 532qla2x00_fw_version_show(struct class_device *cdev, char *buf)
533{ 533{
534 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 534 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
535 char fw_str[30]; 535 char fw_str[30];
536 536
537 return snprintf(buf, PAGE_SIZE, "%s\n", 537 return snprintf(buf, PAGE_SIZE, "%s\n",
@@ -541,7 +541,7 @@ qla2x00_fw_version_show(struct class_device *cdev, char *buf)
541static ssize_t 541static ssize_t
542qla2x00_serial_num_show(struct class_device *cdev, char *buf) 542qla2x00_serial_num_show(struct class_device *cdev, char *buf)
543{ 543{
544 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 544 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
545 uint32_t sn; 545 uint32_t sn;
546 546
547 sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1; 547 sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1;
@@ -552,14 +552,14 @@ qla2x00_serial_num_show(struct class_device *cdev, char *buf)
552static ssize_t 552static ssize_t
553qla2x00_isp_name_show(struct class_device *cdev, char *buf) 553qla2x00_isp_name_show(struct class_device *cdev, char *buf)
554{ 554{
555 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 555 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
556 return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device); 556 return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device);
557} 557}
558 558
559static ssize_t 559static ssize_t
560qla2x00_isp_id_show(struct class_device *cdev, char *buf) 560qla2x00_isp_id_show(struct class_device *cdev, char *buf)
561{ 561{
562 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 562 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
563 return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n", 563 return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n",
564 ha->product_id[0], ha->product_id[1], ha->product_id[2], 564 ha->product_id[0], ha->product_id[1], ha->product_id[2],
565 ha->product_id[3]); 565 ha->product_id[3]);
@@ -568,14 +568,14 @@ qla2x00_isp_id_show(struct class_device *cdev, char *buf)
568static ssize_t 568static ssize_t
569qla2x00_model_name_show(struct class_device *cdev, char *buf) 569qla2x00_model_name_show(struct class_device *cdev, char *buf)
570{ 570{
571 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 571 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
572 return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number); 572 return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number);
573} 573}
574 574
575static ssize_t 575static ssize_t
576qla2x00_model_desc_show(struct class_device *cdev, char *buf) 576qla2x00_model_desc_show(struct class_device *cdev, char *buf)
577{ 577{
578 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 578 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
579 return snprintf(buf, PAGE_SIZE, "%s\n", 579 return snprintf(buf, PAGE_SIZE, "%s\n",
580 ha->model_desc ? ha->model_desc: ""); 580 ha->model_desc ? ha->model_desc: "");
581} 581}
@@ -583,7 +583,7 @@ qla2x00_model_desc_show(struct class_device *cdev, char *buf)
583static ssize_t 583static ssize_t
584qla2x00_pci_info_show(struct class_device *cdev, char *buf) 584qla2x00_pci_info_show(struct class_device *cdev, char *buf)
585{ 585{
586 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 586 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
587 char pci_info[30]; 587 char pci_info[30];
588 588
589 return snprintf(buf, PAGE_SIZE, "%s\n", 589 return snprintf(buf, PAGE_SIZE, "%s\n",
@@ -593,7 +593,7 @@ qla2x00_pci_info_show(struct class_device *cdev, char *buf)
593static ssize_t 593static ssize_t
594qla2x00_state_show(struct class_device *cdev, char *buf) 594qla2x00_state_show(struct class_device *cdev, char *buf)
595{ 595{
596 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 596 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
597 int len = 0; 597 int len = 0;
598 598
599 if (atomic_read(&ha->loop_state) == LOOP_DOWN || 599 if (atomic_read(&ha->loop_state) == LOOP_DOWN ||
@@ -631,7 +631,7 @@ qla2x00_state_show(struct class_device *cdev, char *buf)
631static ssize_t 631static ssize_t
632qla2x00_zio_show(struct class_device *cdev, char *buf) 632qla2x00_zio_show(struct class_device *cdev, char *buf)
633{ 633{
634 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 634 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
635 int len = 0; 635 int len = 0;
636 636
637 switch (ha->zio_mode) { 637 switch (ha->zio_mode) {
@@ -648,7 +648,7 @@ qla2x00_zio_show(struct class_device *cdev, char *buf)
648static ssize_t 648static ssize_t
649qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) 649qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count)
650{ 650{
651 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 651 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
652 int val = 0; 652 int val = 0;
653 uint16_t zio_mode; 653 uint16_t zio_mode;
654 654
@@ -674,7 +674,7 @@ qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count)
674static ssize_t 674static ssize_t
675qla2x00_zio_timer_show(struct class_device *cdev, char *buf) 675qla2x00_zio_timer_show(struct class_device *cdev, char *buf)
676{ 676{
677 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 677 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
678 678
679 return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); 679 return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100);
680} 680}
@@ -683,7 +683,7 @@ static ssize_t
683qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, 683qla2x00_zio_timer_store(struct class_device *cdev, const char *buf,
684 size_t count) 684 size_t count)
685{ 685{
686 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 686 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
687 int val = 0; 687 int val = 0;
688 uint16_t zio_timer; 688 uint16_t zio_timer;
689 689
@@ -701,7 +701,7 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf,
701static ssize_t 701static ssize_t
702qla2x00_beacon_show(struct class_device *cdev, char *buf) 702qla2x00_beacon_show(struct class_device *cdev, char *buf)
703{ 703{
704 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 704 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
705 int len = 0; 705 int len = 0;
706 706
707 if (ha->beacon_blink_led) 707 if (ha->beacon_blink_led)
@@ -715,7 +715,7 @@ static ssize_t
715qla2x00_beacon_store(struct class_device *cdev, const char *buf, 715qla2x00_beacon_store(struct class_device *cdev, const char *buf,
716 size_t count) 716 size_t count)
717{ 717{
718 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 718 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
719 int val = 0; 719 int val = 0;
720 int rval; 720 int rval;
721 721
@@ -745,7 +745,7 @@ qla2x00_beacon_store(struct class_device *cdev, const char *buf,
745static ssize_t 745static ssize_t
746qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf) 746qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf)
747{ 747{
748 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 748 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
749 749
750 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], 750 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1],
751 ha->bios_revision[0]); 751 ha->bios_revision[0]);
@@ -754,7 +754,7 @@ qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf)
754static ssize_t 754static ssize_t
755qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf) 755qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf)
756{ 756{
757 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 757 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
758 758
759 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], 759 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1],
760 ha->efi_revision[0]); 760 ha->efi_revision[0]);
@@ -763,7 +763,7 @@ qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf)
763static ssize_t 763static ssize_t
764qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf) 764qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf)
765{ 765{
766 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 766 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
767 767
768 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], 768 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1],
769 ha->fcode_revision[0]); 769 ha->fcode_revision[0]);
@@ -772,7 +772,7 @@ qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf)
772static ssize_t 772static ssize_t
773qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf) 773qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf)
774{ 774{
775 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); 775 scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
776 776
777 return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", 777 return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n",
778 ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], 778 ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2],
@@ -829,7 +829,7 @@ struct class_device_attribute *qla2x00_host_attrs[] = {
829static void 829static void
830qla2x00_get_host_port_id(struct Scsi_Host *shost) 830qla2x00_get_host_port_id(struct Scsi_Host *shost)
831{ 831{
832 scsi_qla_host_t *ha = to_qla_host(shost); 832 scsi_qla_host_t *ha = shost_priv(shost);
833 833
834 fc_host_port_id(shost) = ha->d_id.b.domain << 16 | 834 fc_host_port_id(shost) = ha->d_id.b.domain << 16 |
835 ha->d_id.b.area << 8 | ha->d_id.b.al_pa; 835 ha->d_id.b.area << 8 | ha->d_id.b.al_pa;
@@ -838,7 +838,7 @@ qla2x00_get_host_port_id(struct Scsi_Host *shost)
838static void 838static void
839qla2x00_get_host_speed(struct Scsi_Host *shost) 839qla2x00_get_host_speed(struct Scsi_Host *shost)
840{ 840{
841 scsi_qla_host_t *ha = to_qla_host(shost); 841 scsi_qla_host_t *ha = shost_priv(shost);
842 uint32_t speed = 0; 842 uint32_t speed = 0;
843 843
844 switch (ha->link_data_rate) { 844 switch (ha->link_data_rate) {
@@ -858,7 +858,7 @@ qla2x00_get_host_speed(struct Scsi_Host *shost)
858static void 858static void
859qla2x00_get_host_port_type(struct Scsi_Host *shost) 859qla2x00_get_host_port_type(struct Scsi_Host *shost)
860{ 860{
861 scsi_qla_host_t *ha = to_qla_host(shost); 861 scsi_qla_host_t *ha = shost_priv(shost);
862 uint32_t port_type = FC_PORTTYPE_UNKNOWN; 862 uint32_t port_type = FC_PORTTYPE_UNKNOWN;
863 863
864 switch (ha->current_topology) { 864 switch (ha->current_topology) {
@@ -882,7 +882,7 @@ static void
882qla2x00_get_starget_node_name(struct scsi_target *starget) 882qla2x00_get_starget_node_name(struct scsi_target *starget)
883{ 883{
884 struct Scsi_Host *host = dev_to_shost(starget->dev.parent); 884 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
885 scsi_qla_host_t *ha = to_qla_host(host); 885 scsi_qla_host_t *ha = shost_priv(host);
886 fc_port_t *fcport; 886 fc_port_t *fcport;
887 u64 node_name = 0; 887 u64 node_name = 0;
888 888
@@ -900,7 +900,7 @@ static void
900qla2x00_get_starget_port_name(struct scsi_target *starget) 900qla2x00_get_starget_port_name(struct scsi_target *starget)
901{ 901{
902 struct Scsi_Host *host = dev_to_shost(starget->dev.parent); 902 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
903 scsi_qla_host_t *ha = to_qla_host(host); 903 scsi_qla_host_t *ha = shost_priv(host);
904 fc_port_t *fcport; 904 fc_port_t *fcport;
905 u64 port_name = 0; 905 u64 port_name = 0;
906 906
@@ -918,7 +918,7 @@ static void
918qla2x00_get_starget_port_id(struct scsi_target *starget) 918qla2x00_get_starget_port_id(struct scsi_target *starget)
919{ 919{
920 struct Scsi_Host *host = dev_to_shost(starget->dev.parent); 920 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
921 scsi_qla_host_t *ha = to_qla_host(host); 921 scsi_qla_host_t *ha = shost_priv(host);
922 fc_port_t *fcport; 922 fc_port_t *fcport;
923 uint32_t port_id = ~0U; 923 uint32_t port_id = ~0U;
924 924
@@ -937,7 +937,7 @@ static void
937qla2x00_get_rport_loss_tmo(struct fc_rport *rport) 937qla2x00_get_rport_loss_tmo(struct fc_rport *rport)
938{ 938{
939 struct Scsi_Host *host = rport_to_shost(rport); 939 struct Scsi_Host *host = rport_to_shost(rport);
940 scsi_qla_host_t *ha = to_qla_host(host); 940 scsi_qla_host_t *ha = shost_priv(host);
941 941
942 rport->dev_loss_tmo = ha->port_down_retry_count + 5; 942 rport->dev_loss_tmo = ha->port_down_retry_count + 5;
943} 943}
@@ -946,7 +946,7 @@ static void
946qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) 946qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
947{ 947{
948 struct Scsi_Host *host = rport_to_shost(rport); 948 struct Scsi_Host *host = rport_to_shost(rport);
949 scsi_qla_host_t *ha = to_qla_host(host); 949 scsi_qla_host_t *ha = shost_priv(host);
950 950
951 if (timeout) 951 if (timeout)
952 ha->port_down_retry_count = timeout; 952 ha->port_down_retry_count = timeout;
@@ -959,7 +959,7 @@ qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
959static int 959static int
960qla2x00_issue_lip(struct Scsi_Host *shost) 960qla2x00_issue_lip(struct Scsi_Host *shost)
961{ 961{
962 scsi_qla_host_t *ha = to_qla_host(shost); 962 scsi_qla_host_t *ha = shost_priv(shost);
963 963
964 set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags); 964 set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags);
965 return 0; 965 return 0;
@@ -968,7 +968,7 @@ qla2x00_issue_lip(struct Scsi_Host *shost)
968static struct fc_host_statistics * 968static struct fc_host_statistics *
969qla2x00_get_fc_host_stats(struct Scsi_Host *shost) 969qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
970{ 970{
971 scsi_qla_host_t *ha = to_qla_host(shost); 971 scsi_qla_host_t *ha = shost_priv(shost);
972 int rval; 972 int rval;
973 uint16_t mb_stat[1]; 973 uint16_t mb_stat[1];
974 link_stat_t stat_buf; 974 link_stat_t stat_buf;
@@ -1006,7 +1006,7 @@ done:
1006static void 1006static void
1007qla2x00_get_host_symbolic_name(struct Scsi_Host *shost) 1007qla2x00_get_host_symbolic_name(struct Scsi_Host *shost)
1008{ 1008{
1009 scsi_qla_host_t *ha = to_qla_host(shost); 1009 scsi_qla_host_t *ha = shost_priv(shost);
1010 1010
1011 qla2x00_get_sym_node_name(ha, fc_host_symbolic_name(shost)); 1011 qla2x00_get_sym_node_name(ha, fc_host_symbolic_name(shost));
1012} 1012}
@@ -1014,7 +1014,7 @@ qla2x00_get_host_symbolic_name(struct Scsi_Host *shost)
1014static void 1014static void
1015qla2x00_set_host_system_hostname(struct Scsi_Host *shost) 1015qla2x00_set_host_system_hostname(struct Scsi_Host *shost)
1016{ 1016{
1017 scsi_qla_host_t *ha = to_qla_host(shost); 1017 scsi_qla_host_t *ha = shost_priv(shost);
1018 1018
1019 set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags); 1019 set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
1020} 1020}
@@ -1022,7 +1022,7 @@ qla2x00_set_host_system_hostname(struct Scsi_Host *shost)
1022static void 1022static void
1023qla2x00_get_host_fabric_name(struct Scsi_Host *shost) 1023qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
1024{ 1024{
1025 scsi_qla_host_t *ha = to_qla_host(shost); 1025 scsi_qla_host_t *ha = shost_priv(shost);
1026 u64 node_name; 1026 u64 node_name;
1027 1027
1028 if (ha->device_flags & SWITCH_FOUND) 1028 if (ha->device_flags & SWITCH_FOUND)
@@ -1036,7 +1036,7 @@ qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
1036static void 1036static void
1037qla2x00_get_host_port_state(struct Scsi_Host *shost) 1037qla2x00_get_host_port_state(struct Scsi_Host *shost)
1038{ 1038{
1039 scsi_qla_host_t *ha = to_qla_host(shost); 1039 scsi_qla_host_t *ha = shost_priv(shost);
1040 1040
1041 if (!ha->flags.online) 1041 if (!ha->flags.online)
1042 fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; 1042 fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
@@ -1050,7 +1050,7 @@ static int
1050qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) 1050qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
1051{ 1051{
1052 int ret = 0; 1052 int ret = 0;
1053 scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata; 1053 scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
1054 scsi_qla_host_t *vha; 1054 scsi_qla_host_t *vha;
1055 1055
1056 ret = qla24xx_vport_create_req_sanity_check(fc_vport); 1056 ret = qla24xx_vport_create_req_sanity_check(fc_vport);
@@ -1119,7 +1119,7 @@ vport_create_failed_2:
1119int 1119int
1120qla24xx_vport_delete(struct fc_vport *fc_vport) 1120qla24xx_vport_delete(struct fc_vport *fc_vport)
1121{ 1121{
1122 scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata; 1122 scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
1123 scsi_qla_host_t *vha = fc_vport->dd_data; 1123 scsi_qla_host_t *vha = fc_vport->dd_data;
1124 1124
1125 qla24xx_disable_vp(vha); 1125 qla24xx_disable_vp(vha);
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index ca7f70d6d6c0..eaa04dabcdf6 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1402,7 +1402,7 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
1402 struct scsi_qla_host *ha; 1402 struct scsi_qla_host *ha;
1403 srb_t *sp; 1403 srb_t *sp;
1404 1404
1405 ha = (struct scsi_qla_host *)cmd->device->host->hostdata; 1405 ha = shost_priv(cmd->device->host);
1406 1406
1407 sp = (srb_t *) cmd->SCp.ptr; 1407 sp = (srb_t *) cmd->SCp.ptr;
1408 printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble); 1408 printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index b928e31afe8e..1900fbf6cd74 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2545,8 +2545,6 @@ typedef struct scsi_qla_host {
2545 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \ 2545 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2546 atomic_read(&ha->loop_state) == LOOP_DOWN) 2546 atomic_read(&ha->loop_state) == LOOP_DOWN)
2547 2547
2548#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata)
2549
2550#define qla_printk(level, ha, format, arg...) \ 2548#define qla_printk(level, ha, format, arg...) \
2551 dev_printk(level , &((ha)->pdev->dev) , format , ## arg) 2549 dev_printk(level , &((ha)->pdev->dev) , format , ## arg)
2552 2550
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 54dc415d8b53..1a2cdcd915c0 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -363,7 +363,7 @@ qla2x00_do_dpc_all_vps(scsi_qla_host_t *ha)
363int 363int
364qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport) 364qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport)
365{ 365{
366 scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata; 366 scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
367 scsi_qla_host_t *vha; 367 scsi_qla_host_t *vha;
368 uint8_t port_name[WWN_SIZE]; 368 uint8_t port_name[WWN_SIZE];
369 369
@@ -397,7 +397,7 @@ qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport)
397scsi_qla_host_t * 397scsi_qla_host_t *
398qla24xx_create_vhost(struct fc_vport *fc_vport) 398qla24xx_create_vhost(struct fc_vport *fc_vport)
399{ 399{
400 scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata; 400 scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
401 scsi_qla_host_t *vha; 401 scsi_qla_host_t *vha;
402 struct Scsi_Host *host; 402 struct Scsi_Host *host;
403 403
@@ -409,7 +409,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
409 return(NULL); 409 return(NULL);
410 } 410 }
411 411
412 vha = (scsi_qla_host_t *)host->hostdata; 412 vha = shost_priv(host);
413 413
414 /* clone the parent hba */ 414 /* clone the parent hba */
415 memcpy(vha, ha, sizeof (scsi_qla_host_t)); 415 memcpy(vha, ha, sizeof (scsi_qla_host_t));
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 4314f94bd477..a6bb8d0ecf13 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -379,7 +379,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *ha, fc_port_t *fcport,
379static int 379static int
380qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 380qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
381{ 381{
382 scsi_qla_host_t *ha = to_qla_host(cmd->device->host); 382 scsi_qla_host_t *ha = shost_priv(cmd->device->host);
383 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 383 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
384 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); 384 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
385 srb_t *sp; 385 srb_t *sp;
@@ -445,7 +445,7 @@ qc_fail_command:
445static int 445static int
446qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 446qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
447{ 447{
448 scsi_qla_host_t *ha = to_qla_host(cmd->device->host); 448 scsi_qla_host_t *ha = shost_priv(cmd->device->host);
449 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 449 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
450 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); 450 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
451 srb_t *sp; 451 srb_t *sp;
@@ -663,7 +663,7 @@ qla2x00_block_error_handler(struct scsi_cmnd *cmnd)
663static int 663static int
664qla2xxx_eh_abort(struct scsi_cmnd *cmd) 664qla2xxx_eh_abort(struct scsi_cmnd *cmd)
665{ 665{
666 scsi_qla_host_t *ha = to_qla_host(cmd->device->host); 666 scsi_qla_host_t *ha = shost_priv(cmd->device->host);
667 srb_t *sp; 667 srb_t *sp;
668 int ret, i; 668 int ret, i;
669 unsigned int id, lun; 669 unsigned int id, lun;
@@ -803,7 +803,7 @@ qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t)
803static int 803static int
804qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) 804qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
805{ 805{
806 scsi_qla_host_t *ha = to_qla_host(cmd->device->host); 806 scsi_qla_host_t *ha = shost_priv(cmd->device->host);
807 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 807 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
808 int ret = FAILED; 808 int ret = FAILED;
809 unsigned int id, lun; 809 unsigned int id, lun;
@@ -932,7 +932,7 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha)
932static int 932static int
933qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) 933qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
934{ 934{
935 scsi_qla_host_t *ha = to_qla_host(cmd->device->host); 935 scsi_qla_host_t *ha = shost_priv(cmd->device->host);
936 scsi_qla_host_t *pha = to_qla_parent(ha); 936 scsi_qla_host_t *pha = to_qla_parent(ha);
937 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 937 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
938 int ret = FAILED; 938 int ret = FAILED;
@@ -992,7 +992,7 @@ eh_bus_reset_done:
992static int 992static int
993qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) 993qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
994{ 994{
995 scsi_qla_host_t *ha = to_qla_host(cmd->device->host); 995 scsi_qla_host_t *ha = shost_priv(cmd->device->host);
996 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 996 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
997 int ret = FAILED; 997 int ret = FAILED;
998 unsigned int id, lun; 998 unsigned int id, lun;
@@ -1142,7 +1142,7 @@ qla2xxx_slave_alloc(struct scsi_device *sdev)
1142static int 1142static int
1143qla2xxx_slave_configure(struct scsi_device *sdev) 1143qla2xxx_slave_configure(struct scsi_device *sdev)
1144{ 1144{
1145 scsi_qla_host_t *ha = to_qla_host(sdev->host); 1145 scsi_qla_host_t *ha = shost_priv(sdev->host);
1146 struct fc_rport *rport = starget_to_rport(sdev->sdev_target); 1146 struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
1147 1147
1148 if (sdev->tagged_supported) 1148 if (sdev->tagged_supported)
@@ -1543,7 +1543,7 @@ iospace_error_exit:
1543static void 1543static void
1544qla2xxx_scan_start(struct Scsi_Host *shost) 1544qla2xxx_scan_start(struct Scsi_Host *shost)
1545{ 1545{
1546 scsi_qla_host_t *ha = (scsi_qla_host_t *)shost->hostdata; 1546 scsi_qla_host_t *ha = shost_priv(shost);
1547 1547
1548 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); 1548 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
1549 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); 1549 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
@@ -1553,7 +1553,7 @@ qla2xxx_scan_start(struct Scsi_Host *shost)
1553static int 1553static int
1554qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time) 1554qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time)
1555{ 1555{
1556 scsi_qla_host_t *ha = (scsi_qla_host_t *)shost->hostdata; 1556 scsi_qla_host_t *ha = shost_priv(shost);
1557 1557
1558 if (!ha->host) 1558 if (!ha->host)
1559 return 1; 1559 return 1;
@@ -1600,7 +1600,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1600 } 1600 }
1601 1601
1602 /* Clear our data area */ 1602 /* Clear our data area */
1603 ha = (scsi_qla_host_t *)host->hostdata; 1603 ha = shost_priv(host);
1604 memset(ha, 0, sizeof(scsi_qla_host_t)); 1604 memset(ha, 0, sizeof(scsi_qla_host_t));
1605 1605
1606 ha->pdev = pdev; 1606 ha->pdev = pdev;