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

Merge branch 'for-3.14/deps-from-dma-defer_probe' into for-3.14/dmas-resets-rework

This merges git://git.infradead.org/users/vkoul/slave-dma.git topic/defer_probe

+48 -10
+31 -4
drivers/dma/dmaengine.c
··· 540 540 * @mask: capabilities that the channel must satisfy 541 541 * @fn: optional callback to disposition available channels 542 542 * @fn_param: opaque parameter to pass to dma_filter_fn 543 + * 544 + * Returns pointer to appropriate DMA channel on success or NULL. 543 545 */ 544 546 struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, 545 547 dma_filter_fn fn, void *fn_param) ··· 593 591 * dma_request_slave_channel - try to allocate an exclusive slave channel 594 592 * @dev: pointer to client device structure 595 593 * @name: slave channel name 594 + * 595 + * Returns pointer to appropriate DMA channel on success or an error pointer. 596 596 */ 597 - struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name) 597 + struct dma_chan *dma_request_slave_channel_reason(struct device *dev, 598 + const char *name) 598 599 { 600 + struct dma_chan *chan; 601 + 599 602 /* If device-tree is present get slave info from here */ 600 603 if (dev->of_node) 601 604 return of_dma_request_slave_channel(dev->of_node, name); 602 605 603 606 /* If device was enumerated by ACPI get slave info from here */ 604 - if (ACPI_HANDLE(dev)) 605 - return acpi_dma_request_slave_chan_by_name(dev, name); 607 + if (ACPI_HANDLE(dev)) { 608 + chan = acpi_dma_request_slave_chan_by_name(dev, name); 609 + if (chan) 610 + return chan; 611 + } 606 612 607 - return NULL; 613 + return ERR_PTR(-ENODEV); 614 + } 615 + EXPORT_SYMBOL_GPL(dma_request_slave_channel_reason); 616 + 617 + /** 618 + * dma_request_slave_channel - try to allocate an exclusive slave channel 619 + * @dev: pointer to client device structure 620 + * @name: slave channel name 621 + * 622 + * Returns pointer to appropriate DMA channel on success or NULL. 623 + */ 624 + struct dma_chan *dma_request_slave_channel(struct device *dev, 625 + const char *name) 626 + { 627 + struct dma_chan *ch = dma_request_slave_channel_reason(dev, name); 628 + if (IS_ERR(ch)) 629 + return NULL; 630 + return ch; 608 631 } 609 632 EXPORT_SYMBOL_GPL(dma_request_slave_channel); 610 633
+9 -6
drivers/dma/of-dma.c
··· 143 143 * @np: device node to get DMA request from 144 144 * @name: name of desired channel 145 145 * 146 - * Returns pointer to appropriate dma channel on success or NULL on error. 146 + * Returns pointer to appropriate DMA channel on success or an error pointer. 147 147 */ 148 148 struct dma_chan *of_dma_request_slave_channel(struct device_node *np, 149 149 const char *name) ··· 152 152 struct of_dma *ofdma; 153 153 struct dma_chan *chan; 154 154 int count, i; 155 + int ret_no_channel = -ENODEV; 155 156 156 157 if (!np || !name) { 157 158 pr_err("%s: not enough information provided\n", __func__); 158 - return NULL; 159 + return ERR_PTR(-ENODEV); 159 160 } 160 161 161 162 count = of_property_count_strings(np, "dma-names"); 162 163 if (count < 0) { 163 164 pr_err("%s: dma-names property of node '%s' missing or empty\n", 164 165 __func__, np->full_name); 165 - return NULL; 166 + return ERR_PTR(-ENODEV); 166 167 } 167 168 168 169 for (i = 0; i < count; i++) { ··· 173 172 mutex_lock(&of_dma_lock); 174 173 ofdma = of_dma_find_controller(&dma_spec); 175 174 176 - if (ofdma) 175 + if (ofdma) { 177 176 chan = ofdma->of_dma_xlate(&dma_spec, ofdma); 178 - else 177 + } else { 178 + ret_no_channel = -EPROBE_DEFER; 179 179 chan = NULL; 180 + } 180 181 181 182 mutex_unlock(&of_dma_lock); 182 183 ··· 188 185 return chan; 189 186 } 190 187 191 - return NULL; 188 + return ERR_PTR(ret_no_channel); 192 189 } 193 190 194 191 /**
+8
include/linux/dmaengine.h
··· 22 22 #define LINUX_DMAENGINE_H 23 23 24 24 #include <linux/device.h> 25 + #include <linux/err.h> 25 26 #include <linux/uio.h> 26 27 #include <linux/bug.h> 27 28 #include <linux/scatterlist.h> ··· 1041 1040 void dma_issue_pending_all(void); 1042 1041 struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, 1043 1042 dma_filter_fn fn, void *fn_param); 1043 + struct dma_chan *dma_request_slave_channel_reason(struct device *dev, 1044 + const char *name); 1044 1045 struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); 1045 1046 void dma_release_channel(struct dma_chan *chan); 1046 1047 #else ··· 1065 1062 dma_filter_fn fn, void *fn_param) 1066 1063 { 1067 1064 return NULL; 1065 + } 1066 + static inline struct dma_chan *dma_request_slave_channel_reason( 1067 + struct device *dev, const char *name) 1068 + { 1069 + return ERR_PTR(-ENODEV); 1068 1070 } 1069 1071 static inline struct dma_chan *dma_request_slave_channel(struct device *dev, 1070 1072 const char *name)