diff options
author | Joe Carnuccio <joe.carnuccio@qlogic.com> | 2011-05-10 14:30:16 -0400 |
---|---|---|
committer | James Bottomley <jbottomley@parallels.com> | 2011-05-17 03:39:25 -0400 |
commit | 6ad11eaa8a689a27e0c99905bcf800a37cd432a0 (patch) | |
tree | b52ef139f1969f0b67601e2b8e0ab72f7e958c43 /drivers/scsi/qla2xxx | |
parent | 6766df9e8ae2ab29459381ade1ca91b28688ab13 (diff) |
[SCSI] qla2xxx: Refactor call to qla2xxx_read_sfp for thermal temperature.
Eliminate duplicate code by refactoring the calls to qla2xxx_read_sfp()
in qla2x00_get_thermal_temp(). This keeps the parameter values separate
from the mailbox register mechanics. This also allows qla2xxx_read_sfp()
to be the sole "spec" for READ SFP semantics.
Signed-off_by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 53 |
1 files changed, 11 insertions, 42 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 7184b870c0d9..c26f0acdfecc 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -4142,63 +4142,32 @@ int | |||
4142 | qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp, uint16_t *frac) | 4142 | qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp, uint16_t *frac) |
4143 | { | 4143 | { |
4144 | int rval; | 4144 | int rval; |
4145 | mbx_cmd_t mc; | 4145 | uint8_t byte; |
4146 | mbx_cmd_t *mcp = &mc; | ||
4147 | struct qla_hw_data *ha = vha->hw; | 4146 | struct qla_hw_data *ha = vha->hw; |
4148 | 4147 | ||
4149 | DEBUG11(printk(KERN_INFO "%s(%ld): entered.\n", __func__, ha->host_no)); | 4148 | DEBUG11(printk(KERN_INFO "%s(%ld): entered.\n", __func__, vha->host_no)); |
4150 | 4149 | ||
4151 | /* High bits. */ | 4150 | /* Integer part */ |
4152 | mcp->mb[0] = MBC_READ_SFP; | 4151 | rval = qla2x00_read_sfp(vha, 0, &byte, 0x98, 0x01, 1, BIT_13|BIT_0); |
4153 | mcp->mb[1] = 0x98; | ||
4154 | mcp->mb[2] = 0; | ||
4155 | mcp->mb[3] = 0; | ||
4156 | mcp->mb[6] = 0; | ||
4157 | mcp->mb[7] = 0; | ||
4158 | mcp->mb[8] = 1; | ||
4159 | mcp->mb[9] = 0x01; | ||
4160 | mcp->mb[10] = BIT_13|BIT_0; | ||
4161 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | ||
4162 | mcp->in_mb = MBX_1|MBX_0; | ||
4163 | mcp->tov = MBX_TOV_SECONDS; | ||
4164 | mcp->flags = 0; | ||
4165 | rval = qla2x00_mailbox_command(vha, mcp); | ||
4166 | if (rval != QLA_SUCCESS) { | 4152 | if (rval != QLA_SUCCESS) { |
4167 | DEBUG2_3_11(printk(KERN_WARNING | 4153 | DEBUG2_3_11(printk(KERN_WARNING |
4168 | "%s(%ld): failed=%x (%x).\n", __func__, | 4154 | "%s(%ld): failed=%x.\n", __func__, vha->host_no, rval)); |
4169 | vha->host_no, rval, mcp->mb[0])); | ||
4170 | ha->flags.thermal_supported = 0; | 4155 | ha->flags.thermal_supported = 0; |
4171 | goto fail; | 4156 | goto fail; |
4172 | } | 4157 | } |
4173 | *temp = mcp->mb[1] & 0xFF; | 4158 | *temp = byte; |
4174 | 4159 | ||
4175 | /* Low bits. */ | 4160 | /* Fraction part */ |
4176 | mcp->mb[0] = MBC_READ_SFP; | 4161 | rval = qla2x00_read_sfp(vha, 0, &byte, 0x98, 0x10, 1, BIT_13|BIT_0); |
4177 | mcp->mb[1] = 0x98; | ||
4178 | mcp->mb[2] = 0; | ||
4179 | mcp->mb[3] = 0; | ||
4180 | mcp->mb[6] = 0; | ||
4181 | mcp->mb[7] = 0; | ||
4182 | mcp->mb[8] = 1; | ||
4183 | mcp->mb[9] = 0x10; | ||
4184 | mcp->mb[10] = BIT_13|BIT_0; | ||
4185 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | ||
4186 | mcp->in_mb = MBX_1|MBX_0; | ||
4187 | mcp->tov = MBX_TOV_SECONDS; | ||
4188 | mcp->flags = 0; | ||
4189 | rval = qla2x00_mailbox_command(vha, mcp); | ||
4190 | if (rval != QLA_SUCCESS) { | 4162 | if (rval != QLA_SUCCESS) { |
4191 | DEBUG2_3_11(printk(KERN_WARNING | 4163 | DEBUG2_3_11(printk(KERN_WARNING |
4192 | "%s(%ld): failed=%x (%x).\n", __func__, | 4164 | "%s(%ld): failed=%x.\n", __func__, vha->host_no, rval)); |
4193 | vha->host_no, rval, mcp->mb[0])); | ||
4194 | ha->flags.thermal_supported = 0; | 4165 | ha->flags.thermal_supported = 0; |
4195 | goto fail; | 4166 | goto fail; |
4196 | } | 4167 | } |
4197 | *frac = ((mcp->mb[1] & 0xFF) >> 6) * 25; | 4168 | *frac = (byte >> 6) * 25; |
4198 | 4169 | ||
4199 | if (rval == QLA_SUCCESS) | 4170 | DEBUG11(printk(KERN_INFO "%s(%ld): done.\n", __func__, vha->host_no)); |
4200 | DEBUG11(printk(KERN_INFO | ||
4201 | "%s(%ld): done.\n", __func__, ha->host_no)); | ||
4202 | fail: | 4171 | fail: |
4203 | return rval; | 4172 | return rval; |
4204 | } | 4173 | } |