aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_nx.c
diff options
context:
space:
mode:
authorChad Dupuis <chad.dupuis@qlogic.com>2011-05-10 14:30:10 -0400
committerJames Bottomley <jbottomley@parallels.com>2011-05-17 03:32:39 -0400
commitd652e0937029e1f7cf9b17d639782db1b0c23ea9 (patch)
tree9fc9f2607f9d08ee12267f2245b1af05888ac7d8 /drivers/scsi/qla2xxx/qla_nx.c
parent875efad774f05433210c8d99af405260cfda4f09 (diff)
[SCSI] qla2xxx: Add qla82xx_rom_unlock() function.
Encapsulate the unlocking of the ROM lock in a function for better code readability. Signed-off-by: Chad Dupuis <chad.dupuis@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/qla_nx.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 752b03e7622a..5d5b603acc8c 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -844,6 +844,12 @@ qla82xx_rom_lock(struct qla_hw_data *ha)
844 return 0; 844 return 0;
845} 845}
846 846
847static void
848qla82xx_rom_unlock(struct qla_hw_data *ha)
849{
850 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK));
851}
852
847static int 853static int
848qla82xx_wait_rom_busy(struct qla_hw_data *ha) 854qla82xx_wait_rom_busy(struct qla_hw_data *ha)
849{ 855{
@@ -924,7 +930,7 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
924 return -1; 930 return -1;
925 } 931 }
926 ret = qla82xx_do_rom_fast_read(ha, addr, valp); 932 ret = qla82xx_do_rom_fast_read(ha, addr, valp);
927 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 933 qla82xx_rom_unlock(ha);
928 return ret; 934 return ret;
929} 935}
930 936
@@ -1056,7 +1062,7 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr,
1056 ret = qla82xx_flash_wait_write_finish(ha); 1062 ret = qla82xx_flash_wait_write_finish(ha);
1057 1063
1058done_write: 1064done_write:
1059 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 1065 qla82xx_rom_unlock(ha);
1060 return ret; 1066 return ret;
1061} 1067}
1062 1068
@@ -1144,7 +1150,7 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
1144 qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val); 1150 qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val);
1145 msleep(20); 1151 msleep(20);
1146 1152
1147 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 1153 qla82xx_rom_unlock(ha);
1148 1154
1149 /* Read the signature value from the flash. 1155 /* Read the signature value from the flash.
1150 * Offset 0: Contain signature (0xcafecafe) 1156 * Offset 0: Contain signature (0xcafecafe)
@@ -3010,7 +3016,7 @@ qla82xx_unprotect_flash(struct qla_hw_data *ha)
3010 qla_printk(KERN_WARNING, ha, "Write disable failed\n"); 3016 qla_printk(KERN_WARNING, ha, "Write disable failed\n");
3011 3017
3012done_unprotect: 3018done_unprotect:
3013 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 3019 qla82xx_rom_unlock(ha);
3014 return ret; 3020 return ret;
3015} 3021}
3016 3022
@@ -3039,7 +3045,7 @@ qla82xx_protect_flash(struct qla_hw_data *ha)
3039 if (qla82xx_write_disable_flash(ha) != 0) 3045 if (qla82xx_write_disable_flash(ha) != 0)
3040 qla_printk(KERN_WARNING, ha, "Write disable failed\n"); 3046 qla_printk(KERN_WARNING, ha, "Write disable failed\n");
3041done_protect: 3047done_protect:
3042 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 3048 qla82xx_rom_unlock(ha);
3043 return ret; 3049 return ret;
3044} 3050}
3045 3051
@@ -3067,7 +3073,7 @@ qla82xx_erase_sector(struct qla_hw_data *ha, int addr)
3067 } 3073 }
3068 ret = qla82xx_flash_wait_write_finish(ha); 3074 ret = qla82xx_flash_wait_write_finish(ha);
3069done: 3075done:
3070 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 3076 qla82xx_rom_unlock(ha);
3071 return ret; 3077 return ret;
3072} 3078}
3073 3079
@@ -3247,7 +3253,7 @@ void qla82xx_rom_lock_recovery(struct qla_hw_data *ha)
3247 * else died while holding it. 3253 * else died while holding it.
3248 * In either case, unlock. 3254 * In either case, unlock.
3249 */ 3255 */
3250 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 3256 qla82xx_rom_unlock(ha);
3251} 3257}
3252 3258
3253/* 3259/*