[SCSI] qla2xxx: Use shost_priv().
authorAndrew Vasquez <andrew.vasquez@qlogic.com>
Thu, 20 Sep 2007 21:07:45 +0000 (14:07 -0700)
committerJames Bottomley <jejb@mulgrave.localdomain>
Fri, 12 Oct 2007 18:50:22 +0000 (14:50 -0400)
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>
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_os.c

index c90dc59abe0fc23a868b99ebb3bbdf533a52f550..05fa7796a559d325a1c44f7eb04e6b3da08f5a8b 100644 (file)
@@ -18,7 +18,7 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj,
                           struct bin_attribute *bin_attr,
                           char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        char *rbuf = (char *)ha->fw_dump;
 
@@ -39,7 +39,7 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj,
                            struct bin_attribute *bin_attr,
                            char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        int reading;
 
@@ -89,7 +89,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj,
                         struct bin_attribute *bin_attr,
                         char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        int             size = ha->nvram_size;
        char            *nvram_cache = ha->nvram;
@@ -112,7 +112,7 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj,
                          struct bin_attribute *bin_attr,
                          char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        unsigned long   flags;
        uint16_t        cnt;
@@ -170,7 +170,7 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj,
                          struct bin_attribute *bin_attr,
                          char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
 
        if (ha->optrom_state != QLA_SREADING)
@@ -190,7 +190,7 @@ qla2x00_sysfs_write_optrom(struct kobject *kobj,
                           struct bin_attribute *bin_attr,
                           char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
 
        if (ha->optrom_state != QLA_SWRITING)
@@ -220,7 +220,7 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
                               struct bin_attribute *bin_attr,
                               char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        uint32_t start = 0;
        uint32_t size = ha->optrom_size;
@@ -372,7 +372,7 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj,
                       struct bin_attribute *bin_attr,
                       char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        int           size = ha->vpd_size;
        char          *vpd_cache = ha->vpd;
@@ -395,7 +395,7 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj,
                        struct bin_attribute *bin_attr,
                        char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        unsigned long flags;
 
@@ -426,7 +426,7 @@ qla2x00_sysfs_read_sfp(struct kobject *kobj,
                       struct bin_attribute *bin_attr,
                       char *buf, loff_t off, size_t count)
 {
-       struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+       struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
            struct device, kobj)));
        uint16_t iter, addr, offset;
        int rval;
@@ -531,7 +531,7 @@ qla2x00_drvr_version_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_fw_version_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        char fw_str[30];
 
        return snprintf(buf, PAGE_SIZE, "%s\n",
@@ -541,7 +541,7 @@ qla2x00_fw_version_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_serial_num_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        uint32_t sn;
 
        sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1;
@@ -552,14 +552,14 @@ qla2x00_serial_num_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_isp_name_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device);
 }
 
 static ssize_t
 qla2x00_isp_id_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n",
            ha->product_id[0], ha->product_id[1], ha->product_id[2],
            ha->product_id[3]);
@@ -568,14 +568,14 @@ qla2x00_isp_id_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_model_name_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number);
 }
 
 static ssize_t
 qla2x00_model_desc_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        return snprintf(buf, PAGE_SIZE, "%s\n",
            ha->model_desc ? ha->model_desc: "");
 }
@@ -583,7 +583,7 @@ qla2x00_model_desc_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_pci_info_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        char pci_info[30];
 
        return snprintf(buf, PAGE_SIZE, "%s\n",
@@ -593,7 +593,7 @@ qla2x00_pci_info_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_state_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        int len = 0;
 
        if (atomic_read(&ha->loop_state) == LOOP_DOWN ||
@@ -631,7 +631,7 @@ qla2x00_state_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_zio_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        int len = 0;
 
        switch (ha->zio_mode) {
@@ -648,7 +648,7 @@ qla2x00_zio_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        int val = 0;
        uint16_t zio_mode;
 
@@ -674,7 +674,7 @@ qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count)
 static ssize_t
 qla2x00_zio_timer_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
 
        return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100);
 }
@@ -683,7 +683,7 @@ static ssize_t
 qla2x00_zio_timer_store(struct class_device *cdev, const char *buf,
     size_t count)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        int val = 0;
        uint16_t zio_timer;
 
@@ -701,7 +701,7 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf,
 static ssize_t
 qla2x00_beacon_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        int len = 0;
 
        if (ha->beacon_blink_led)
@@ -715,7 +715,7 @@ static ssize_t
 qla2x00_beacon_store(struct class_device *cdev, const char *buf,
     size_t count)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
        int val = 0;
        int rval;
 
@@ -745,7 +745,7 @@ qla2x00_beacon_store(struct class_device *cdev, const char *buf,
 static ssize_t
 qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
 
        return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1],
            ha->bios_revision[0]);
@@ -754,7 +754,7 @@ qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
 
        return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1],
            ha->efi_revision[0]);
@@ -763,7 +763,7 @@ qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
 
        return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1],
            ha->fcode_revision[0]);
@@ -772,7 +772,7 @@ qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf)
 static ssize_t
 qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf)
 {
-       scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+       scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev));
 
        return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n",
            ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2],
@@ -829,7 +829,7 @@ struct class_device_attribute *qla2x00_host_attrs[] = {
 static void
 qla2x00_get_host_port_id(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
 
        fc_host_port_id(shost) = ha->d_id.b.domain << 16 |
            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)
 static void
 qla2x00_get_host_speed(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
        uint32_t speed = 0;
 
        switch (ha->link_data_rate) {
@@ -858,7 +858,7 @@ qla2x00_get_host_speed(struct Scsi_Host *shost)
 static void
 qla2x00_get_host_port_type(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
        uint32_t port_type = FC_PORTTYPE_UNKNOWN;
 
        switch (ha->current_topology) {
@@ -882,7 +882,7 @@ static void
 qla2x00_get_starget_node_name(struct scsi_target *starget)
 {
        struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
-       scsi_qla_host_t *ha = to_qla_host(host);
+       scsi_qla_host_t *ha = shost_priv(host);
        fc_port_t *fcport;
        u64 node_name = 0;
 
@@ -900,7 +900,7 @@ static void
 qla2x00_get_starget_port_name(struct scsi_target *starget)
 {
        struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
-       scsi_qla_host_t *ha = to_qla_host(host);
+       scsi_qla_host_t *ha = shost_priv(host);
        fc_port_t *fcport;
        u64 port_name = 0;
 
@@ -918,7 +918,7 @@ static void
 qla2x00_get_starget_port_id(struct scsi_target *starget)
 {
        struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
-       scsi_qla_host_t *ha = to_qla_host(host);
+       scsi_qla_host_t *ha = shost_priv(host);
        fc_port_t *fcport;
        uint32_t port_id = ~0U;
 
@@ -937,7 +937,7 @@ static void
 qla2x00_get_rport_loss_tmo(struct fc_rport *rport)
 {
        struct Scsi_Host *host = rport_to_shost(rport);
-       scsi_qla_host_t *ha = to_qla_host(host);
+       scsi_qla_host_t *ha = shost_priv(host);
 
        rport->dev_loss_tmo = ha->port_down_retry_count + 5;
 }
@@ -946,7 +946,7 @@ static void
 qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
 {
        struct Scsi_Host *host = rport_to_shost(rport);
-       scsi_qla_host_t *ha = to_qla_host(host);
+       scsi_qla_host_t *ha = shost_priv(host);
 
        if (timeout)
                ha->port_down_retry_count = timeout;
@@ -959,7 +959,7 @@ qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
 static int
 qla2x00_issue_lip(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
 
        set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags);
        return 0;
@@ -968,7 +968,7 @@ qla2x00_issue_lip(struct Scsi_Host *shost)
 static struct fc_host_statistics *
 qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
        int rval;
        uint16_t mb_stat[1];
        link_stat_t stat_buf;
@@ -1006,7 +1006,7 @@ done:
 static void
 qla2x00_get_host_symbolic_name(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
 
        qla2x00_get_sym_node_name(ha, fc_host_symbolic_name(shost));
 }
@@ -1014,7 +1014,7 @@ qla2x00_get_host_symbolic_name(struct Scsi_Host *shost)
 static void
 qla2x00_set_host_system_hostname(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
 
        set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
 }
@@ -1022,7 +1022,7 @@ qla2x00_set_host_system_hostname(struct Scsi_Host *shost)
 static void
 qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
        u64 node_name;
 
        if (ha->device_flags & SWITCH_FOUND)
@@ -1036,7 +1036,7 @@ qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
 static void
 qla2x00_get_host_port_state(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = to_qla_host(shost);
+       scsi_qla_host_t *ha = shost_priv(shost);
 
        if (!ha->flags.online)
                fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
@@ -1050,7 +1050,7 @@ static int
 qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
 {
        int     ret = 0;
-       scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata;
+       scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
        scsi_qla_host_t *vha;
 
        ret = qla24xx_vport_create_req_sanity_check(fc_vport);
@@ -1119,7 +1119,7 @@ vport_create_failed_2:
 int
 qla24xx_vport_delete(struct fc_vport *fc_vport)
 {
-       scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata;
+       scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
        scsi_qla_host_t *vha = fc_vport->dd_data;
 
        qla24xx_disable_vp(vha);
index ca7f70d6d6c0aaa99af628f88c5e9069d19f27a0..eaa04dabcdf6b4fd331f6572e46691a727fe8fd4 100644 (file)
@@ -1402,7 +1402,7 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
        struct scsi_qla_host *ha;
        srb_t *sp;
 
-       ha = (struct scsi_qla_host *)cmd->device->host->hostdata;
+       ha = shost_priv(cmd->device->host);
 
        sp = (srb_t *) cmd->SCp.ptr;
        printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
index b928e31afe8ef98eed9963d664d13b64dcf4c18b..1900fbf6cd74ddfbc7eb7a9ef7e6c233d8686012 100644 (file)
@@ -2545,8 +2545,6 @@ typedef struct scsi_qla_host {
         test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
         atomic_read(&ha->loop_state) == LOOP_DOWN)
 
-#define to_qla_host(x)         ((scsi_qla_host_t *) (x)->hostdata)
-
 #define qla_printk(level, ha, format, arg...) \
        dev_printk(level , &((ha)->pdev->dev) , format , ## arg)
 
index 54dc415d8b535850db36a155532aca4efbe84750..1a2cdcd915c04ac141fc70e7b4a5f6f9ac7e01a6 100644 (file)
@@ -363,7 +363,7 @@ qla2x00_do_dpc_all_vps(scsi_qla_host_t *ha)
 int
 qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport)
 {
-       scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata;
+       scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
        scsi_qla_host_t *vha;
        uint8_t port_name[WWN_SIZE];
 
@@ -397,7 +397,7 @@ qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport)
 scsi_qla_host_t *
 qla24xx_create_vhost(struct fc_vport *fc_vport)
 {
-       scsi_qla_host_t *ha = (scsi_qla_host_t *) fc_vport->shost->hostdata;
+       scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
        scsi_qla_host_t *vha;
        struct Scsi_Host *host;
 
@@ -409,7 +409,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
                return(NULL);
        }
 
-       vha = (scsi_qla_host_t *)host->hostdata;
+       vha = shost_priv(host);
 
        /* clone the parent hba */
        memcpy(vha, ha, sizeof (scsi_qla_host_t));
index 4314f94bd4770180f8f44c9d8a713016944e93ce..a6bb8d0ecf139fe46de567eb773abd8fead11dba 100644 (file)
@@ -379,7 +379,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *ha, fc_port_t *fcport,
 static int
 qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
 {
-       scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
+       scsi_qla_host_t *ha = shost_priv(cmd->device->host);
        fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
        struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
        srb_t *sp;
@@ -445,7 +445,7 @@ qc_fail_command:
 static int
 qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
 {
-       scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
+       scsi_qla_host_t *ha = shost_priv(cmd->device->host);
        fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
        struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
        srb_t *sp;
@@ -663,7 +663,7 @@ qla2x00_block_error_handler(struct scsi_cmnd *cmnd)
 static int
 qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 {
-       scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
+       scsi_qla_host_t *ha = shost_priv(cmd->device->host);
        srb_t *sp;
        int ret, i;
        unsigned int id, lun;
@@ -803,7 +803,7 @@ qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t)
 static int
 qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
 {
-       scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
+       scsi_qla_host_t *ha = shost_priv(cmd->device->host);
        fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
        int ret = FAILED;
        unsigned int id, lun;
@@ -932,7 +932,7 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha)
 static int
 qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
 {
-       scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
+       scsi_qla_host_t *ha = shost_priv(cmd->device->host);
        scsi_qla_host_t *pha = to_qla_parent(ha);
        fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
        int ret = FAILED;
@@ -992,7 +992,7 @@ eh_bus_reset_done:
 static int
 qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
 {
-       scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
+       scsi_qla_host_t *ha = shost_priv(cmd->device->host);
        fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
        int ret = FAILED;
        unsigned int id, lun;
@@ -1142,7 +1142,7 @@ qla2xxx_slave_alloc(struct scsi_device *sdev)
 static int
 qla2xxx_slave_configure(struct scsi_device *sdev)
 {
-       scsi_qla_host_t *ha = to_qla_host(sdev->host);
+       scsi_qla_host_t *ha = shost_priv(sdev->host);
        struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
 
        if (sdev->tagged_supported)
@@ -1543,7 +1543,7 @@ iospace_error_exit:
 static void
 qla2xxx_scan_start(struct Scsi_Host *shost)
 {
-       scsi_qla_host_t *ha = (scsi_qla_host_t *)shost->hostdata;
+       scsi_qla_host_t *ha = shost_priv(shost);
 
        set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
        set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
@@ -1553,7 +1553,7 @@ qla2xxx_scan_start(struct Scsi_Host *shost)
 static int
 qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time)
 {
-       scsi_qla_host_t *ha = (scsi_qla_host_t *)shost->hostdata;
+       scsi_qla_host_t *ha = shost_priv(shost);
 
        if (!ha->host)
                return 1;
@@ -1600,7 +1600,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        }
 
        /* Clear our data area */
-       ha = (scsi_qla_host_t *)host->hostdata;
+       ha = shost_priv(host);
        memset(ha, 0, sizeof(scsi_qla_host_t));
 
        ha->pdev = pdev;