diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2008-01-31 15:33:44 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-02-07 19:02:38 -0500 |
commit | 948882f6b72a95dd76c6c567a45dfe91b7d04c15 (patch) | |
tree | 4b959ae191d6a94a99169d446f3f4a392b3b23df /drivers/scsi/qla2xxx | |
parent | 4c851879312702456c7fbd594f19a7a9d991c252 (diff) |
[SCSI] qla2xxx: Correct resource_size_t usages.
Hmm, it looks like the conversion to resource_size_t usage
(3776541d8a46347a4924353a192c6ce4a3d04e2e) 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: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_sup.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index b68fb73613ed..26822c8807ee 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
@@ -893,6 +893,8 @@ qla2x00_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags) | |||
893 | } | 893 | } |
894 | } | 894 | } |
895 | 895 | ||
896 | #define PIO_REG(h, r) ((h)->pio_address + offsetof(struct device_reg_2xxx, r)) | ||
897 | |||
896 | void | 898 | void |
897 | qla2x00_beacon_blink(struct scsi_qla_host *ha) | 899 | qla2x00_beacon_blink(struct scsi_qla_host *ha) |
898 | { | 900 | { |
@@ -902,15 +904,12 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha) | |||
902 | unsigned long flags; | 904 | unsigned long flags; |
903 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 905 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
904 | 906 | ||
905 | if (ha->pio_address) | ||
906 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | ||
907 | |||
908 | spin_lock_irqsave(&ha->hardware_lock, flags); | 907 | spin_lock_irqsave(&ha->hardware_lock, flags); |
909 | 908 | ||
910 | /* Save the Original GPIOE. */ | 909 | /* Save the Original GPIOE. */ |
911 | if (ha->pio_address) { | 910 | if (ha->pio_address) { |
912 | gpio_enable = RD_REG_WORD_PIO(®->gpioe); | 911 | gpio_enable = RD_REG_WORD_PIO(PIO_REG(ha, gpioe)); |
913 | gpio_data = RD_REG_WORD_PIO(®->gpiod); | 912 | gpio_data = RD_REG_WORD_PIO(PIO_REG(ha, gpiod)); |
914 | } else { | 913 | } else { |
915 | gpio_enable = RD_REG_WORD(®->gpioe); | 914 | gpio_enable = RD_REG_WORD(®->gpioe); |
916 | gpio_data = RD_REG_WORD(®->gpiod); | 915 | gpio_data = RD_REG_WORD(®->gpiod); |
@@ -920,7 +919,7 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha) | |||
920 | gpio_enable |= GPIO_LED_MASK; | 919 | gpio_enable |= GPIO_LED_MASK; |
921 | 920 | ||
922 | if (ha->pio_address) { | 921 | if (ha->pio_address) { |
923 | WRT_REG_WORD_PIO(®->gpioe, gpio_enable); | 922 | WRT_REG_WORD_PIO(PIO_REG(ha, gpioe), gpio_enable); |
924 | } else { | 923 | } else { |
925 | WRT_REG_WORD(®->gpioe, gpio_enable); | 924 | WRT_REG_WORD(®->gpioe, gpio_enable); |
926 | RD_REG_WORD(®->gpioe); | 925 | RD_REG_WORD(®->gpioe); |
@@ -936,7 +935,7 @@ qla2x00_beacon_blink(struct scsi_qla_host *ha) | |||
936 | 935 | ||
937 | /* Set the modified gpio_data values */ | 936 | /* Set the modified gpio_data values */ |
938 | if (ha->pio_address) { | 937 | if (ha->pio_address) { |
939 | WRT_REG_WORD_PIO(®->gpiod, gpio_data); | 938 | WRT_REG_WORD_PIO(PIO_REG(ha, gpiod), gpio_data); |
940 | } else { | 939 | } else { |
941 | WRT_REG_WORD(®->gpiod, gpio_data); | 940 | WRT_REG_WORD(®->gpiod, gpio_data); |
942 | RD_REG_WORD(®->gpiod); | 941 | RD_REG_WORD(®->gpiod); |
@@ -962,14 +961,11 @@ qla2x00_beacon_on(struct scsi_qla_host *ha) | |||
962 | return QLA_FUNCTION_FAILED; | 961 | return QLA_FUNCTION_FAILED; |
963 | } | 962 | } |
964 | 963 | ||
965 | if (ha->pio_address) | ||
966 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | ||
967 | |||
968 | /* Turn off LEDs. */ | 964 | /* Turn off LEDs. */ |
969 | spin_lock_irqsave(&ha->hardware_lock, flags); | 965 | spin_lock_irqsave(&ha->hardware_lock, flags); |
970 | if (ha->pio_address) { | 966 | if (ha->pio_address) { |
971 | gpio_enable = RD_REG_WORD_PIO(®->gpioe); | 967 | gpio_enable = RD_REG_WORD_PIO(PIO_REG(ha, gpioe)); |
972 | gpio_data = RD_REG_WORD_PIO(®->gpiod); | 968 | gpio_data = RD_REG_WORD_PIO(PIO_REG(ha, gpiod)); |
973 | } else { | 969 | } else { |
974 | gpio_enable = RD_REG_WORD(®->gpioe); | 970 | gpio_enable = RD_REG_WORD(®->gpioe); |
975 | gpio_data = RD_REG_WORD(®->gpiod); | 971 | gpio_data = RD_REG_WORD(®->gpiod); |
@@ -978,7 +974,7 @@ qla2x00_beacon_on(struct scsi_qla_host *ha) | |||
978 | 974 | ||
979 | /* Set the modified gpio_enable values. */ | 975 | /* Set the modified gpio_enable values. */ |
980 | if (ha->pio_address) { | 976 | if (ha->pio_address) { |
981 | WRT_REG_WORD_PIO(®->gpioe, gpio_enable); | 977 | WRT_REG_WORD_PIO(PIO_REG(ha, gpioe), gpio_enable); |
982 | } else { | 978 | } else { |
983 | WRT_REG_WORD(®->gpioe, gpio_enable); | 979 | WRT_REG_WORD(®->gpioe, gpio_enable); |
984 | RD_REG_WORD(®->gpioe); | 980 | RD_REG_WORD(®->gpioe); |
@@ -987,7 +983,7 @@ qla2x00_beacon_on(struct scsi_qla_host *ha) | |||
987 | /* Clear out previously set LED colour. */ | 983 | /* Clear out previously set LED colour. */ |
988 | gpio_data &= ~GPIO_LED_MASK; | 984 | gpio_data &= ~GPIO_LED_MASK; |
989 | if (ha->pio_address) { | 985 | if (ha->pio_address) { |
990 | WRT_REG_WORD_PIO(®->gpiod, gpio_data); | 986 | WRT_REG_WORD_PIO(PIO_REG(ha, gpiod), gpio_data); |
991 | } else { | 987 | } else { |
992 | WRT_REG_WORD(®->gpiod, gpio_data); | 988 | WRT_REG_WORD(®->gpiod, gpio_data); |
993 | RD_REG_WORD(®->gpiod); | 989 | RD_REG_WORD(®->gpiod); |
@@ -1244,13 +1240,12 @@ qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr) | |||
1244 | if (ha->pio_address) { | 1240 | if (ha->pio_address) { |
1245 | uint16_t data2; | 1241 | uint16_t data2; |
1246 | 1242 | ||
1247 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | 1243 | WRT_REG_WORD_PIO(PIO_REG(ha, flash_address), (uint16_t)addr); |
1248 | WRT_REG_WORD_PIO(®->flash_address, (uint16_t)addr); | ||
1249 | do { | 1244 | do { |
1250 | data = RD_REG_WORD_PIO(®->flash_data); | 1245 | data = RD_REG_WORD_PIO(PIO_REG(ha, flash_data)); |
1251 | barrier(); | 1246 | barrier(); |
1252 | cpu_relax(); | 1247 | cpu_relax(); |
1253 | data2 = RD_REG_WORD_PIO(®->flash_data); | 1248 | data2 = RD_REG_WORD_PIO(PIO_REG(ha, flash_data)); |
1254 | } while (data != data2); | 1249 | } while (data != data2); |
1255 | } else { | 1250 | } else { |
1256 | WRT_REG_WORD(®->flash_address, (uint16_t)addr); | 1251 | WRT_REG_WORD(®->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 | 1299 | ||
1305 | /* Always perform IO mapped accesses to the FLASH registers. */ | 1300 | /* Always perform IO mapped accesses to the FLASH registers. */ |
1306 | if (ha->pio_address) { | 1301 | if (ha->pio_address) { |
1307 | reg = (struct device_reg_2xxx __iomem *)ha->pio_address; | 1302 | WRT_REG_WORD_PIO(PIO_REG(ha, flash_address), (uint16_t)addr); |
1308 | WRT_REG_WORD_PIO(®->flash_address, (uint16_t)addr); | 1303 | WRT_REG_WORD_PIO(PIO_REG(ha, flash_data), (uint16_t)data); |
1309 | WRT_REG_WORD_PIO(®->flash_data, (uint16_t)data); | ||
1310 | } else { | 1304 | } else { |
1311 | WRT_REG_WORD(®->flash_address, (uint16_t)addr); | 1305 | WRT_REG_WORD(®->flash_address, (uint16_t)addr); |
1312 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ | 1306 | RD_REG_WORD(®->ctrl_status); /* PCI Posting. */ |