aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-dma.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:24 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:24 -0400
commitf37afdaca711838b50ecd89b9c15fc745270d77c (patch)
tree0580bdac04d7d9ef0cc9f4dc2350ea38141980b5 /drivers/ide/ide-dma.c
parent5e37bdc081a980dd0d669e6387bcf15ca9666f81 (diff)
ide: constify struct ide_dma_ops
* Export ide_dma_exec_cmd() and __ide_dma_test_irq(). * Constify struct ide_dma_ops. * Always set hwif->dma_ops to &sff_dma_ops in ide_setup_dma() (it is later overriden by ide_init_port() if needed) and drop 'const struct ide_port_info *d' argument. While at it: * Rename __ide_dma_test_irq() to ide_dma_test_irq(). Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r--drivers/ide/ide-dma.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index a00d2598ec7f..c352cf27b6e7 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -482,11 +482,12 @@ int ide_dma_setup(ide_drive_t *drive)
482 482
483EXPORT_SYMBOL_GPL(ide_dma_setup); 483EXPORT_SYMBOL_GPL(ide_dma_setup);
484 484
485static void ide_dma_exec_cmd(ide_drive_t *drive, u8 command) 485void ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
486{ 486{
487 /* issue cmd to drive */ 487 /* issue cmd to drive */
488 ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, dma_timer_expiry); 488 ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, dma_timer_expiry);
489} 489}
490EXPORT_SYMBOL_GPL(ide_dma_exec_cmd);
490 491
491void ide_dma_start(ide_drive_t *drive) 492void ide_dma_start(ide_drive_t *drive)
492{ 493{
@@ -532,7 +533,7 @@ int __ide_dma_end (ide_drive_t *drive)
532EXPORT_SYMBOL(__ide_dma_end); 533EXPORT_SYMBOL(__ide_dma_end);
533 534
534/* returns 1 if dma irq issued, 0 otherwise */ 535/* returns 1 if dma irq issued, 0 otherwise */
535static int __ide_dma_test_irq(ide_drive_t *drive) 536int ide_dma_test_irq(ide_drive_t *drive)
536{ 537{
537 ide_hwif_t *hwif = HWIF(drive); 538 ide_hwif_t *hwif = HWIF(drive);
538 u8 dma_stat = hwif->INB(hwif->dma_status); 539 u8 dma_stat = hwif->INB(hwif->dma_status);
@@ -545,6 +546,7 @@ static int __ide_dma_test_irq(ide_drive_t *drive)
545 drive->name, __func__); 546 drive->name, __func__);
546 return 0; 547 return 0;
547} 548}
549EXPORT_SYMBOL_GPL(ide_dma_test_irq);
548#else 550#else
549static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } 551static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
550#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 552#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
@@ -839,21 +841,19 @@ int ide_allocate_dma_engine(ide_hwif_t *hwif)
839} 841}
840EXPORT_SYMBOL_GPL(ide_allocate_dma_engine); 842EXPORT_SYMBOL_GPL(ide_allocate_dma_engine);
841 843
842static struct ide_dma_ops sff_dma_ops = { 844static const struct ide_dma_ops sff_dma_ops = {
843 .dma_host_set = ide_dma_host_set, 845 .dma_host_set = ide_dma_host_set,
844 .dma_setup = ide_dma_setup, 846 .dma_setup = ide_dma_setup,
845 .dma_exec_cmd = ide_dma_exec_cmd, 847 .dma_exec_cmd = ide_dma_exec_cmd,
846 .dma_start = ide_dma_start, 848 .dma_start = ide_dma_start,
847 .dma_end = __ide_dma_end, 849 .dma_end = __ide_dma_end,
848 .dma_test_irq = __ide_dma_test_irq, 850 .dma_test_irq = ide_dma_test_irq,
849 .dma_timeout = ide_dma_timeout, 851 .dma_timeout = ide_dma_timeout,
850 .dma_lost_irq = ide_dma_lost_irq, 852 .dma_lost_irq = ide_dma_lost_irq,
851}; 853};
852 854
853void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, 855void ide_setup_dma(ide_hwif_t *hwif, unsigned long base)
854 const struct ide_port_info *d)
855{ 856{
856 struct ide_dma_ops *dma_ops = d->dma_ops ? d->dma_ops : &sff_dma_ops;
857 hwif->dma_base = base; 857 hwif->dma_base = base;
858 858
859 if (!hwif->dma_command) 859 if (!hwif->dma_command)
@@ -867,24 +867,7 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base,
867 if (!hwif->dma_prdtable) 867 if (!hwif->dma_prdtable)
868 hwif->dma_prdtable = hwif->dma_base + 4; 868 hwif->dma_prdtable = hwif->dma_base + 4;
869 869
870 hwif->dma_ops = dma_ops; 870 hwif->dma_ops = &sff_dma_ops;
871
872 if (dma_ops->dma_host_set == NULL)
873 dma_ops->dma_host_set = ide_dma_host_set;
874 if (dma_ops->dma_setup == NULL)
875 dma_ops->dma_setup = ide_dma_setup;
876 if (dma_ops->dma_exec_cmd == NULL)
877 dma_ops->dma_exec_cmd = ide_dma_exec_cmd;
878 if (dma_ops->dma_start == NULL)
879 dma_ops->dma_start = ide_dma_start;
880 if (dma_ops->dma_end == NULL)
881 dma_ops->dma_end = __ide_dma_end;
882 if (dma_ops->dma_test_irq == NULL)
883 dma_ops->dma_test_irq = __ide_dma_test_irq;
884 if (dma_ops->dma_timeout == NULL)
885 dma_ops->dma_timeout = ide_dma_timeout;
886 if (dma_ops->dma_lost_irq == NULL)
887 dma_ops->dma_lost_irq = ide_dma_lost_irq;
888} 871}
889 872
890EXPORT_SYMBOL_GPL(ide_setup_dma); 873EXPORT_SYMBOL_GPL(ide_setup_dma);