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

Merge branch 'topic/dmaengine_devm' into next

+37
+30
drivers/dma/dmaengine.c
··· 926 926 } 927 927 EXPORT_SYMBOL_GPL(dma_release_channel); 928 928 929 + static void dmaenginem_release_channel(void *chan) 930 + { 931 + dma_release_channel(chan); 932 + } 933 + 934 + /** 935 + * devm_dma_request_chan - try to allocate an exclusive slave channel 936 + * @dev: pointer to client device structure 937 + * @name: slave channel name 938 + * 939 + * Returns pointer to appropriate DMA channel on success or an error pointer. 940 + * 941 + * The operation is managed and will be undone on driver detach. 942 + */ 943 + 944 + struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) 945 + { 946 + struct dma_chan *chan = dma_request_chan(dev, name); 947 + int ret = 0; 948 + 949 + if (!IS_ERR(chan)) 950 + ret = devm_add_action_or_reset(dev, dmaenginem_release_channel, chan); 951 + 952 + if (ret) 953 + return ERR_PTR(ret); 954 + 955 + return chan; 956 + } 957 + EXPORT_SYMBOL_GPL(devm_dma_request_chan); 958 + 929 959 /** 930 960 * dmaengine_get - register interest in dma_channels 931 961 */
+7
include/linux/dmaengine.h
··· 1524 1524 1525 1525 struct dma_chan *dma_request_chan(struct device *dev, const char *name); 1526 1526 struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask); 1527 + struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name); 1527 1528 1528 1529 void dma_release_channel(struct dma_chan *chan); 1529 1530 int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps); ··· 1561 1560 { 1562 1561 return ERR_PTR(-ENODEV); 1563 1562 } 1563 + 1564 + static inline struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) 1565 + { 1566 + return ERR_PTR(-ENODEV); 1567 + } 1568 + 1564 1569 static inline void dma_release_channel(struct dma_chan *chan) 1565 1570 { 1566 1571 }