Skip to content

Commit

Permalink
[SCSI] qla2xxx: Use shost_priv().
Browse files Browse the repository at this point in the history
Drop usage of legacy to_qla_host() macro.

Signed-off-by: Andrew Vasquez <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
  • Loading branch information
avasquez01 authored and James Bottomley committed Oct 12, 2007
1 parent e745759 commit f363b94
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 60 deletions.
88 changes: 44 additions & 44 deletions drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand All @@ -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;
Expand All @@ -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]);
Expand All @@ -568,22 +568,22 @@ 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: "");
}

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",
Expand All @@ -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 ||
Expand Down Expand Up @@ -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) {
Expand All @@ -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;

Expand All @@ -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);
}
Expand All @@ -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;

Expand All @@ -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)
Expand All @@ -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;

Expand Down Expand Up @@ -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]);
Expand All @@ -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]);
Expand All @@ -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]);
Expand All @@ -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],
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -1006,23 +1006,23 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
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));
}

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);
}

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)
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -1119,7 +1119,7 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
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);
Expand Down
Loading

0 comments on commit f363b94

Please sign in to comment.