Commit 948882f6 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[SCSI] qla2xxx: Correct resource_size_t usages.

Hmm, it looks like the conversion to resource_size_t usage
(3776541d) requires some additional
fixups to cleanup the structure-pointer castings used during IO mapped
accesses to the chip.

There's only a small number of locations, where the driver uses IO
mapped accesses to the hardware, the patch below should take care of
it without introducing to many structural changes to code flow.
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 4c851879
...@@ -893,6 +893,8 @@ qla2x00_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags) ...@@ -893,6 +893,8 @@ qla2x00_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags)
} }
} }
#define PIO_REG(h, r) ((h)->pio_address + offsetof(struct device_reg_2xxx, r))
void void
qla2x00_beacon_blink(struct scsi_qla_host *ha) qla2x00_beacon_blink(struct scsi_qla_host *ha)
{ {
...@@ -902,15 +904,12 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha) ...@@ -902,15 +904,12 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha)
unsigned long flags; unsigned long flags;
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
if (ha->pio_address)
reg = (struct device_reg_2xxx __iomem *)ha->pio_address;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
/* Save the Original GPIOE. */ /* Save the Original GPIOE. */
if (ha->pio_address) { if (ha->pio_address) {
gpio_enable = RD_REG_WORD_PIO(&reg->gpioe); gpio_enable = RD_REG_WORD_PIO(PIO_REG(ha, gpioe));
gpio_data = RD_REG_WORD_PIO(&reg->gpiod); gpio_data = RD_REG_WORD_PIO(PIO_REG(ha, gpiod));
} else { } else {
gpio_enable = RD_REG_WORD(&reg->gpioe); gpio_enable = RD_REG_WORD(&reg->gpioe);
gpio_data = RD_REG_WORD(&reg->gpiod); gpio_data = RD_REG_WORD(&reg->gpiod);
...@@ -920,7 +919,7 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha) ...@@ -920,7 +919,7 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha)
gpio_enable |= GPIO_LED_MASK; gpio_enable |= GPIO_LED_MASK;
if (ha->pio_address) { if (ha->pio_address) {
WRT_REG_WORD_PIO(&reg->gpioe, gpio_enable); WRT_REG_WORD_PIO(PIO_REG(ha, gpioe), gpio_enable);
} else { } else {
WRT_REG_WORD(&reg->gpioe, gpio_enable); WRT_REG_WORD(&reg->gpioe, gpio_enable);
RD_REG_WORD(&reg->gpioe); RD_REG_WORD(&reg->gpioe);
...@@ -936,7 +935,7 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha) ...@@ -936,7 +935,7 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha)
/* Set the modified gpio_data values */ /* Set the modified gpio_data values */
if (ha->pio_address) { if (ha->pio_address) {
WRT_REG_WORD_PIO(&reg->gpiod, gpio_data); WRT_REG_WORD_PIO(PIO_REG(ha, gpiod), gpio_data);
} else { } else {
WRT_REG_WORD(&reg->gpiod, gpio_data); WRT_REG_WORD(&reg->gpiod, gpio_data);
RD_REG_WORD(&reg->gpiod); RD_REG_WORD(&reg->gpiod);
...@@ -962,14 +961,11 @@ qla2x00_beacon_on(struct scsi_qla_host *ha) ...@@ -962,14 +961,11 @@ qla2x00_beacon_on(struct scsi_qla_host *ha)
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
} }
if (ha->pio_address)
reg = (struct device_reg_2xxx __iomem *)ha->pio_address;
/* Turn off LEDs. */ /* Turn off LEDs. */
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
if (ha->pio_address) { if (ha->pio_address) {
gpio_enable = RD_REG_WORD_PIO(&reg->gpioe); gpio_enable = RD_REG_WORD_PIO(PIO_REG(ha, gpioe));
gpio_data = RD_REG_WORD_PIO(&reg->gpiod); gpio_data = RD_REG_WORD_PIO(PIO_REG(ha, gpiod));
} else { } else {
gpio_enable = RD_REG_WORD(&reg->gpioe); gpio_enable = RD_REG_WORD(&reg->gpioe);
gpio_data = RD_REG_WORD(&reg->gpiod); gpio_data = RD_REG_WORD(&reg->gpiod);
...@@ -978,7 +974,7 @@ qla2x00_beacon_on(struct scsi_qla_host *ha) ...@@ -978,7 +974,7 @@ qla2x00_beacon_on(struct scsi_qla_host *ha)
/* Set the modified gpio_enable values. */ /* Set the modified gpio_enable values. */
if (ha->pio_address) { if (ha->pio_address) {
WRT_REG_WORD_PIO(&reg->gpioe, gpio_enable); WRT_REG_WORD_PIO(PIO_REG(ha, gpioe), gpio_enable);
} else { } else {
WRT_REG_WORD(&reg->gpioe, gpio_enable); WRT_REG_WORD(&reg->gpioe, gpio_enable);
RD_REG_WORD(&reg->gpioe); RD_REG_WORD(&reg->gpioe);
...@@ -987,7 +983,7 @@ qla2x00_beacon_on(struct scsi_qla_host *ha) ...@@ -987,7 +983,7 @@ qla2x00_beacon_on(struct scsi_qla_host *ha)
/* Clear out previously set LED colour. */ /* Clear out previously set LED colour. */
gpio_data &= ~GPIO_LED_MASK; gpio_data &= ~GPIO_LED_MASK;
if (ha->pio_address) { if (ha->pio_address) {
WRT_REG_WORD_PIO(&reg->gpiod, gpio_data); WRT_REG_WORD_PIO(PIO_REG(ha, gpiod), gpio_data);
} else { } else {
WRT_REG_WORD(&reg->gpiod, gpio_data); WRT_REG_WORD(&reg->gpiod, gpio_data);
RD_REG_WORD(&reg->gpiod); RD_REG_WORD(&reg->gpiod);
...@@ -1244,13 +1240,12 @@ qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr) ...@@ -1244,13 +1240,12 @@ qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr)
if (ha->pio_address) { if (ha->pio_address) {
uint16_t data2; uint16_t data2;
reg = (struct device_reg_2xxx __iomem *)ha->pio_address; WRT_REG_WORD_PIO(PIO_REG(ha, flash_address), (uint16_t)addr);
WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr);
do { do {
data = RD_REG_WORD_PIO(&reg->flash_data); data = RD_REG_WORD_PIO(PIO_REG(ha, flash_data));
barrier(); barrier();
cpu_relax(); cpu_relax();
data2 = RD_REG_WORD_PIO(&reg->flash_data); data2 = RD_REG_WORD_PIO(PIO_REG(ha, flash_data));
} while (data != data2); } while (data != data2);
} else { } else {
WRT_REG_WORD(&reg->flash_address, (uint16_t)addr); WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
...@@ -1304,9 +1299,8 @@ qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data) ...@@ -1304,9 +1299,8 @@ qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data)
/* Always perform IO mapped accesses to the FLASH registers. */ /* Always perform IO mapped accesses to the FLASH registers. */
if (ha->pio_address) { if (ha->pio_address) {
reg = (struct device_reg_2xxx __iomem *)ha->pio_address; WRT_REG_WORD_PIO(PIO_REG(ha, flash_address), (uint16_t)addr);
WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr); WRT_REG_WORD_PIO(PIO_REG(ha, flash_data), (uint16_t)data);
WRT_REG_WORD_PIO(&reg->flash_data, (uint16_t)data);
} else { } else {
WRT_REG_WORD(&reg->flash_address, (uint16_t)addr); WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */ RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment