aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_nv.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-06-25 09:02:59 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-08-01 19:46:48 -0400
commit752e386c247664152f2cce37915d1f50631d7f42 (patch)
tree790193f1320094acbf2584d5a890703ce8c6fb7e /drivers/ata/sata_nv.c
parentaf4d6e257dc36646bb62adececdd10ad83323788 (diff)
sata_fsl,mv,nv: prepare for NCQ command completion update
Make the following changes to prepare for NCQ command completion update. Changes made by this patch don't cause any functional difference. * sata_fsl_host_intr(): rename the local variable qc_active to done_mask as that's what it is. * mv_process_crpb_response(): restructure if clause for easier update. * nv_adma_interrupt(): drop unnecessary error variable. * nv_swncq_sdbfis(): drop unnecessary nr_done and return 0 on success. Typo fix. * nv_swncq_dmafis(): drop unused return value and return void. * nv_swncq_host_interrupt(): drop unnecessary return value handling. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ashish Kalra <ashish.kalra@freescale.com> Cc: Saeed Bishara <saeed@marvell.com> Cc: Mark Lord <liml@rtr.ca> Cc: Robert Hancock <hancockr@shaw.ca> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r--drivers/ata/sata_nv.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 21161136cad0..cb89ef8d99d9 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1018,7 +1018,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
1018 NV_ADMA_STAT_CPBERR | 1018 NV_ADMA_STAT_CPBERR |
1019 NV_ADMA_STAT_CMD_COMPLETE)) { 1019 NV_ADMA_STAT_CMD_COMPLETE)) {
1020 u32 check_commands = notifier_clears[i]; 1020 u32 check_commands = notifier_clears[i];
1021 int pos, error = 0; 1021 int pos, rc;
1022 1022
1023 if (status & NV_ADMA_STAT_CPBERR) { 1023 if (status & NV_ADMA_STAT_CPBERR) {
1024 /* check all active commands */ 1024 /* check all active commands */
@@ -1030,10 +1030,12 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
1030 } 1030 }
1031 1031
1032 /* check CPBs for completed commands */ 1032 /* check CPBs for completed commands */
1033 while ((pos = ffs(check_commands)) && !error) { 1033 while ((pos = ffs(check_commands))) {
1034 pos--; 1034 pos--;
1035 error = nv_adma_check_cpb(ap, pos, 1035 rc = nv_adma_check_cpb(ap, pos,
1036 notifier_error & (1 << pos)); 1036 notifier_error & (1 << pos));
1037 if (unlikely(rc))
1038 check_commands = 0;
1037 check_commands &= ~(1 << pos); 1039 check_commands &= ~(1 << pos);
1038 } 1040 }
1039 } 1041 }
@@ -2129,7 +2131,6 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
2129 struct nv_swncq_port_priv *pp = ap->private_data; 2131 struct nv_swncq_port_priv *pp = ap->private_data;
2130 struct ata_eh_info *ehi = &ap->link.eh_info; 2132 struct ata_eh_info *ehi = &ap->link.eh_info;
2131 u32 sactive; 2133 u32 sactive;
2132 int nr_done = 0;
2133 u32 done_mask; 2134 u32 done_mask;
2134 int i; 2135 int i;
2135 u8 host_stat; 2136 u8 host_stat;
@@ -2170,22 +2171,21 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
2170 pp->dhfis_bits &= ~(1 << i); 2171 pp->dhfis_bits &= ~(1 << i);
2171 pp->dmafis_bits &= ~(1 << i); 2172 pp->dmafis_bits &= ~(1 << i);
2172 pp->sdbfis_bits |= (1 << i); 2173 pp->sdbfis_bits |= (1 << i);
2173 nr_done++;
2174 } 2174 }
2175 } 2175 }
2176 2176
2177 if (!ap->qc_active) { 2177 if (!ap->qc_active) {
2178 DPRINTK("over\n"); 2178 DPRINTK("over\n");
2179 nv_swncq_pp_reinit(ap); 2179 nv_swncq_pp_reinit(ap);
2180 return nr_done; 2180 return 0;
2181 } 2181 }
2182 2182
2183 if (pp->qc_active & pp->dhfis_bits) 2183 if (pp->qc_active & pp->dhfis_bits)
2184 return nr_done; 2184 return 0;
2185 2185
2186 if ((pp->ncq_flags & ncq_saw_backout) || 2186 if ((pp->ncq_flags & ncq_saw_backout) ||
2187 (pp->qc_active ^ pp->dhfis_bits)) 2187 (pp->qc_active ^ pp->dhfis_bits))
2188 /* if the controller cann't get a device to host register FIS, 2188 /* if the controller can't get a device to host register FIS,
2189 * The driver needs to reissue the new command. 2189 * The driver needs to reissue the new command.
2190 */ 2190 */
2191 lack_dhfis = 1; 2191 lack_dhfis = 1;
@@ -2202,7 +2202,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
2202 if (lack_dhfis) { 2202 if (lack_dhfis) {
2203 qc = ata_qc_from_tag(ap, pp->last_issue_tag); 2203 qc = ata_qc_from_tag(ap, pp->last_issue_tag);
2204 nv_swncq_issue_atacmd(ap, qc); 2204 nv_swncq_issue_atacmd(ap, qc);
2205 return nr_done; 2205 return 0;
2206 } 2206 }
2207 2207
2208 if (pp->defer_queue.defer_bits) { 2208 if (pp->defer_queue.defer_bits) {
@@ -2212,7 +2212,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
2212 nv_swncq_issue_atacmd(ap, qc); 2212 nv_swncq_issue_atacmd(ap, qc);
2213 } 2213 }
2214 2214
2215 return nr_done; 2215 return 0;
2216} 2216}
2217 2217
2218static inline u32 nv_swncq_tag(struct ata_port *ap) 2218static inline u32 nv_swncq_tag(struct ata_port *ap)
@@ -2224,7 +2224,7 @@ static inline u32 nv_swncq_tag(struct ata_port *ap)
2224 return (tag & 0x1f); 2224 return (tag & 0x1f);
2225} 2225}
2226 2226
2227static int nv_swncq_dmafis(struct ata_port *ap) 2227static void nv_swncq_dmafis(struct ata_port *ap)
2228{ 2228{
2229 struct ata_queued_cmd *qc; 2229 struct ata_queued_cmd *qc;
2230 unsigned int rw; 2230 unsigned int rw;
@@ -2239,7 +2239,7 @@ static int nv_swncq_dmafis(struct ata_port *ap)
2239 qc = ata_qc_from_tag(ap, tag); 2239 qc = ata_qc_from_tag(ap, tag);
2240 2240
2241 if (unlikely(!qc)) 2241 if (unlikely(!qc))
2242 return 0; 2242 return;
2243 2243
2244 rw = qc->tf.flags & ATA_TFLAG_WRITE; 2244 rw = qc->tf.flags & ATA_TFLAG_WRITE;
2245 2245
@@ -2254,8 +2254,6 @@ static int nv_swncq_dmafis(struct ata_port *ap)
2254 dmactl |= ATA_DMA_WR; 2254 dmactl |= ATA_DMA_WR;
2255 2255
2256 iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 2256 iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
2257
2258 return 1;
2259} 2257}
2260 2258
2261static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis) 2259static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
@@ -2265,7 +2263,6 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
2265 struct ata_eh_info *ehi = &ap->link.eh_info; 2263 struct ata_eh_info *ehi = &ap->link.eh_info;
2266 u32 serror; 2264 u32 serror;
2267 u8 ata_stat; 2265 u8 ata_stat;
2268 int rc = 0;
2269 2266
2270 ata_stat = ap->ops->sff_check_status(ap); 2267 ata_stat = ap->ops->sff_check_status(ap);
2271 nv_swncq_irq_clear(ap, fis); 2268 nv_swncq_irq_clear(ap, fis);
@@ -2310,8 +2307,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
2310 "dhfis 0x%X dmafis 0x%X sactive 0x%X\n", 2307 "dhfis 0x%X dmafis 0x%X sactive 0x%X\n",
2311 ap->print_id, pp->qc_active, pp->dhfis_bits, 2308 ap->print_id, pp->qc_active, pp->dhfis_bits,
2312 pp->dmafis_bits, readl(pp->sactive_block)); 2309 pp->dmafis_bits, readl(pp->sactive_block));
2313 rc = nv_swncq_sdbfis(ap); 2310 if (nv_swncq_sdbfis(ap) < 0)
2314 if (rc < 0)
2315 goto irq_error; 2311 goto irq_error;
2316 } 2312 }
2317 2313
@@ -2348,7 +2344,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
2348 */ 2344 */
2349 pp->dmafis_bits |= (0x1 << nv_swncq_tag(ap)); 2345 pp->dmafis_bits |= (0x1 << nv_swncq_tag(ap));
2350 pp->ncq_flags |= ncq_saw_dmas; 2346 pp->ncq_flags |= ncq_saw_dmas;
2351 rc = nv_swncq_dmafis(ap); 2347 nv_swncq_dmafis(ap);
2352 } 2348 }
2353 2349
2354irq_exit: 2350irq_exit: