Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma: omap: hide legacy interface

The legacy interface for omap-dma is only used on OMAP1, and the
same is true for the non-DT case. Make both of these conditional on
CONFIG_ARCH_OMAP1 being set to simplify the dependency.

The non-OMAP stub functions in include/linux/omap-dma.h are note needed
any more either now, because they are only called on OMAP1.

Acked-by: Tony Lindgren <tony@atomide.com>
Acked-By: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+13 -28
+13 -6
drivers/dma/ti/omap-dma.c
··· 699 699 mutex_unlock(&od->lch_lock); 700 700 } 701 701 702 + static inline bool omap_dma_legacy(struct omap_dmadev *od) 703 + { 704 + return IS_ENABLED(CONFIG_ARCH_OMAP1) && od->legacy; 705 + } 706 + 702 707 static int omap_dma_alloc_chan_resources(struct dma_chan *chan) 703 708 { 704 709 struct omap_dmadev *od = to_omap_dma_dev(chan->device); ··· 711 706 struct device *dev = od->ddev.dev; 712 707 int ret; 713 708 714 - if (od->legacy) { 709 + if (omap_dma_legacy(od)) { 715 710 ret = omap_request_dma(c->dma_sig, "DMA engine", 716 711 omap_dma_callback, c, &c->dma_ch); 717 712 } else { ··· 723 718 if (ret >= 0) { 724 719 omap_dma_assign(od, c, c->dma_ch); 725 720 726 - if (!od->legacy) { 721 + if (!omap_dma_legacy(od)) { 727 722 unsigned val; 728 723 729 724 spin_lock_irq(&od->irq_lock); ··· 762 757 struct omap_dmadev *od = to_omap_dma_dev(chan->device); 763 758 struct omap_chan *c = to_omap_dma_chan(chan); 764 759 765 - if (!od->legacy) { 760 + if (!omap_dma_legacy(od)) { 766 761 spin_lock_irq(&od->irq_lock); 767 762 od->irq_enable_mask &= ~BIT(c->dma_ch); 768 763 omap_dma_glbl_write(od, IRQENABLE_L1, od->irq_enable_mask); ··· 773 768 od->lch_map[c->dma_ch] = NULL; 774 769 vchan_free_chan_resources(&c->vc); 775 770 776 - if (od->legacy) 771 + if (omap_dma_legacy(od)) 777 772 omap_free_dma(c->dma_ch); 778 773 else 779 774 omap_dma_put_lch(od, c->dma_ch); ··· 1679 1674 dev_err(&pdev->dev, "omap_system_dma_plat_info is missing"); 1680 1675 return -ENODEV; 1681 1676 } 1682 - } else { 1677 + } else if (IS_ENABLED(CONFIG_ARCH_OMAP1)) { 1683 1678 od->cfg = &default_cfg; 1684 1679 1685 1680 od->plat = omap_get_plat_info(); 1686 1681 if (!od->plat) 1687 1682 return -EPROBE_DEFER; 1683 + } else { 1684 + return -ENODEV; 1688 1685 } 1689 1686 1690 1687 od->reg_map = od->plat->reg_map; ··· 1862 1855 1863 1856 dma_async_device_unregister(&od->ddev); 1864 1857 1865 - if (!od->legacy) { 1858 + if (!omap_dma_legacy(od)) { 1866 1859 /* Disable all interrupts */ 1867 1860 omap_dma_glbl_write(od, IRQENABLE_L0, 0); 1868 1861 }
-22
include/linux/omap-dma.h
··· 292 292 #define dma_omap15xx() __dma_omap15xx(d) 293 293 #define dma_omap16xx() __dma_omap16xx(d) 294 294 295 - #if defined(CONFIG_ARCH_OMAP) 296 295 extern struct omap_system_dma_plat_info *omap_get_plat_info(void); 297 296 298 297 extern void omap_set_dma_priority(int lch, int dst_port, int priority); ··· 338 339 return 0; 339 340 } 340 341 #endif 341 - 342 - #else /* CONFIG_ARCH_OMAP */ 343 - static inline void omap_set_dma_priority(int lch, int dst_port, int priority) 344 - { 345 - } 346 - 347 - static inline struct omap_system_dma_plat_info *omap_get_plat_info(void) 348 - { 349 - return NULL; 350 - } 351 - 352 - static inline int omap_request_dma(int dev_id, const char *dev_name, 353 - void (*callback)(int lch, u16 ch_status, void *data), 354 - void *data, int *dma_ch) 355 - { 356 - return -ENODEV; 357 - } 358 - 359 - static inline void omap_free_dma(int ch) { } 360 - 361 - #endif /* CONFIG_ARCH_OMAP */ 362 342 363 343 #endif /* __LINUX_OMAP_DMA_H */