aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2010-05-07 14:49:02 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-14 17:35:52 -0400
commite42a542ba9cca594897176020445023c54d903d6 (patch)
treeb2a136581d6fcea9a2a6c534888319b70e15c2af /drivers
parent41dec29bcb05eb8ec396f70ce791c6e3e4ce4712 (diff)
libata: make sff_irq_on() method optional
Now, with the introduction of the sff_set_devctl() method, we can use it in sff_irq_on() method too -- that way its implementations in 'pata_bf54x' and 'pata_scc' become virtually identical to ata_sff_irq_on(). The sff_irq_on() method now becomes quite superfluous, and the only reason not to remove it completely is the existence of the 'pata_octeon_cf' driver which implements it as an empty function. Just make the method optional then, with ata_sff_irq_on() becoming generic taskfile-bound function, still global for the 'pata_bf54x' driver to be able to call it from its thaw() and postreset() methods. While at it, make the sff_irq_on() method and ata_sff_irq_on() return 'void' as the result is always ignored anyway. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-sff.c26
-rw-r--r--drivers/ata/pata_bf54x.c29
-rw-r--r--drivers/ata/pata_octeon_cf.c3
-rw-r--r--drivers/ata/pata_scc.c24
4 files changed, 18 insertions, 64 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 31b495fcd969..b7f7f8557fee 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -63,7 +63,6 @@ const struct ata_port_operations ata_sff_port_ops = {
63 .sff_tf_read = ata_sff_tf_read, 63 .sff_tf_read = ata_sff_tf_read,
64 .sff_exec_command = ata_sff_exec_command, 64 .sff_exec_command = ata_sff_exec_command,
65 .sff_data_xfer = ata_sff_data_xfer, 65 .sff_data_xfer = ata_sff_data_xfer,
66 .sff_irq_on = ata_sff_irq_on,
67 .sff_irq_clear = ata_sff_irq_clear, 66 .sff_irq_clear = ata_sff_irq_clear,
68 67
69 .lost_interrupt = ata_sff_lost_interrupt, 68 .lost_interrupt = ata_sff_lost_interrupt,
@@ -538,24 +537,29 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
538 * Enable interrupts on a legacy IDE device using MMIO or PIO, 537 * Enable interrupts on a legacy IDE device using MMIO or PIO,
539 * wait for idle, clear any pending interrupts. 538 * wait for idle, clear any pending interrupts.
540 * 539 *
540 * Note: may NOT be used as the sff_irq_on() entry in
541 * ata_port_operations.
542 *
541 * LOCKING: 543 * LOCKING:
542 * Inherited from caller. 544 * Inherited from caller.
543 */ 545 */
544u8 ata_sff_irq_on(struct ata_port *ap) 546void ata_sff_irq_on(struct ata_port *ap)
545{ 547{
546 struct ata_ioports *ioaddr = &ap->ioaddr; 548 struct ata_ioports *ioaddr = &ap->ioaddr;
547 u8 tmp; 549
550 if (ap->ops->sff_irq_on) {
551 ap->ops->sff_irq_on(ap);
552 return;
553 }
548 554
549 ap->ctl &= ~ATA_NIEN; 555 ap->ctl &= ~ATA_NIEN;
550 ap->last_ctl = ap->ctl; 556 ap->last_ctl = ap->ctl;
551 557
552 if (ioaddr->ctl_addr) 558 if (ap->ops->sff_set_devctl || ioaddr->ctl_addr)
553 iowrite8(ap->ctl, ioaddr->ctl_addr); 559 ata_sff_set_devctl(ap, ap->ctl);
554 tmp = ata_wait_idle(ap); 560 ata_wait_idle(ap);
555 561
556 ap->ops->sff_irq_clear(ap); 562 ap->ops->sff_irq_clear(ap);
557
558 return tmp;
559} 563}
560EXPORT_SYMBOL_GPL(ata_sff_irq_on); 564EXPORT_SYMBOL_GPL(ata_sff_irq_on);
561 565
@@ -1186,7 +1190,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
1186 qc = ata_qc_from_tag(ap, qc->tag); 1190 qc = ata_qc_from_tag(ap, qc->tag);
1187 if (qc) { 1191 if (qc) {
1188 if (likely(!(qc->err_mask & AC_ERR_HSM))) { 1192 if (likely(!(qc->err_mask & AC_ERR_HSM))) {
1189 ap->ops->sff_irq_on(ap); 1193 ata_sff_irq_on(ap);
1190 ata_qc_complete(qc); 1194 ata_qc_complete(qc);
1191 } else 1195 } else
1192 ata_port_freeze(ap); 1196 ata_port_freeze(ap);
@@ -1202,7 +1206,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
1202 } else { 1206 } else {
1203 if (in_wq) { 1207 if (in_wq) {
1204 spin_lock_irqsave(ap->lock, flags); 1208 spin_lock_irqsave(ap->lock, flags);
1205 ap->ops->sff_irq_on(ap); 1209 ata_sff_irq_on(ap);
1206 ata_qc_complete(qc); 1210 ata_qc_complete(qc);
1207 spin_unlock_irqrestore(ap->lock, flags); 1211 spin_unlock_irqrestore(ap->lock, flags);
1208 } else 1212 } else
@@ -1946,7 +1950,7 @@ void ata_sff_thaw(struct ata_port *ap)
1946 /* clear & re-enable interrupts */ 1950 /* clear & re-enable interrupts */
1947 ap->ops->sff_check_status(ap); 1951 ap->ops->sff_check_status(ap);
1948 ap->ops->sff_irq_clear(ap); 1952 ap->ops->sff_irq_clear(ap);
1949 ap->ops->sff_irq_on(ap); 1953 ata_sff_irq_on(ap);
1950} 1954}
1951EXPORT_SYMBOL_GPL(ata_sff_thaw); 1955EXPORT_SYMBOL_GPL(ata_sff_thaw);
1952 1956
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 198307534d90..07c110470e25 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1228,30 +1228,6 @@ static void bfin_irq_clear(struct ata_port *ap)
1228} 1228}
1229 1229
1230/** 1230/**
1231 * bfin_irq_on - Enable interrupts on a port.
1232 * @ap: Port on which interrupts are enabled.
1233 *
1234 * Note: Original code is ata_sff_irq_on().
1235 */
1236
1237static unsigned char bfin_irq_on(struct ata_port *ap)
1238{
1239 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
1240 u8 tmp;
1241
1242 dev_dbg(ap->dev, "in atapi irq on\n");
1243 ap->ctl &= ~ATA_NIEN;
1244 ap->last_ctl = ap->ctl;
1245
1246 write_atapi_register(base, ATA_REG_CTRL, ap->ctl);
1247 tmp = ata_wait_idle(ap);
1248
1249 bfin_irq_clear(ap);
1250
1251 return tmp;
1252}
1253
1254/**
1255 * bfin_thaw - Thaw DMA controller port 1231 * bfin_thaw - Thaw DMA controller port
1256 * @ap: port to thaw 1232 * @ap: port to thaw
1257 * 1233 *
@@ -1262,7 +1238,7 @@ void bfin_thaw(struct ata_port *ap)
1262{ 1238{
1263 dev_dbg(ap->dev, "in atapi dma thaw\n"); 1239 dev_dbg(ap->dev, "in atapi dma thaw\n");
1264 bfin_check_status(ap); 1240 bfin_check_status(ap);
1265 bfin_irq_on(ap); 1241 ata_sff_irq_on(ap);
1266} 1242}
1267 1243
1268/** 1244/**
@@ -1279,7 +1255,7 @@ static void bfin_postreset(struct ata_link *link, unsigned int *classes)
1279 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; 1255 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
1280 1256
1281 /* re-enable interrupts */ 1257 /* re-enable interrupts */
1282 bfin_irq_on(ap); 1258 ata_sff_irq_on(ap);
1283 1259
1284 /* is double-select really necessary? */ 1260 /* is double-select really necessary? */
1285 if (classes[0] != ATA_DEV_NONE) 1261 if (classes[0] != ATA_DEV_NONE)
@@ -1477,7 +1453,6 @@ static struct ata_port_operations bfin_pata_ops = {
1477 .postreset = bfin_postreset, 1453 .postreset = bfin_postreset,
1478 1454
1479 .sff_irq_clear = bfin_irq_clear, 1455 .sff_irq_clear = bfin_irq_clear,
1480 .sff_irq_on = bfin_irq_on,
1481 1456
1482 .port_start = bfin_port_start, 1457 .port_start = bfin_port_start,
1483 .port_stop = bfin_port_stop, 1458 .port_stop = bfin_port_stop,
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 005a44483a7b..303ca7e82408 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -489,9 +489,8 @@ static void octeon_cf_exec_command16(struct ata_port *ap,
489 ata_wait_idle(ap); 489 ata_wait_idle(ap);
490} 490}
491 491
492static u8 octeon_cf_irq_on(struct ata_port *ap) 492static void octeon_cf_irq_on(struct ata_port *ap)
493{ 493{
494 return 0;
495} 494}
496 495
497static void octeon_cf_irq_clear(struct ata_port *ap) 496static void octeon_cf_irq_clear(struct ata_port *ap)
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 86b25fef34a9..d3988991ca68 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -828,29 +828,6 @@ static unsigned int scc_data_xfer (struct ata_device *dev, unsigned char *buf,
828} 828}
829 829
830/** 830/**
831 * scc_irq_on - Enable interrupts on a port.
832 * @ap: Port on which interrupts are enabled.
833 *
834 * Note: Original code is ata_sff_irq_on().
835 */
836
837static u8 scc_irq_on (struct ata_port *ap)
838{
839 struct ata_ioports *ioaddr = &ap->ioaddr;
840 u8 tmp;
841
842 ap->ctl &= ~ATA_NIEN;
843 ap->last_ctl = ap->ctl;
844
845 out_be32(ioaddr->ctl_addr, ap->ctl);
846 tmp = ata_wait_idle(ap);
847
848 ap->ops->sff_irq_clear(ap);
849
850 return tmp;
851}
852
853/**
854 * scc_pata_prereset - prepare for reset 831 * scc_pata_prereset - prepare for reset
855 * @ap: ATA port to be reset 832 * @ap: ATA port to be reset
856 * @deadline: deadline jiffies for the operation 833 * @deadline: deadline jiffies for the operation
@@ -977,7 +954,6 @@ static struct ata_port_operations scc_pata_ops = {
977 .post_internal_cmd = scc_bmdma_stop, 954 .post_internal_cmd = scc_bmdma_stop,
978 955
979 .sff_irq_clear = scc_irq_clear, 956 .sff_irq_clear = scc_irq_clear,
980 .sff_irq_on = scc_irq_on,
981 957
982 .port_start = scc_port_start, 958 .port_start = scc_port_start,
983 .port_stop = scc_port_stop, 959 .port_stop = scc_port_stop,