···540540 * @mask: capabilities that the channel must satisfy541541 * @fn: optional callback to disposition available channels542542 * @fn_param: opaque parameter to pass to dma_filter_fn543543+ *544544+ * Returns pointer to appropriate DMA channel on success or NULL.543545 */544546struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,545547 dma_filter_fn fn, void *fn_param)···593591 * dma_request_slave_channel - try to allocate an exclusive slave channel594592 * @dev: pointer to client device structure595593 * @name: slave channel name594594+ *595595+ * Returns pointer to appropriate DMA channel on success or an error pointer.596596 */597597-struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name)597597+struct dma_chan *dma_request_slave_channel_reason(struct device *dev,598598+ const char *name)598599{600600+ struct dma_chan *chan;601601+599602 /* If device-tree is present get slave info from here */600603 if (dev->of_node)601604 return of_dma_request_slave_channel(dev->of_node, name);602605603606 /* If device was enumerated by ACPI get slave info from here */604604- if (ACPI_HANDLE(dev))605605- return acpi_dma_request_slave_chan_by_name(dev, name);607607+ if (ACPI_HANDLE(dev)) {608608+ chan = acpi_dma_request_slave_chan_by_name(dev, name);609609+ if (chan)610610+ return chan;611611+ }606612607607- return NULL;613613+ return ERR_PTR(-ENODEV);614614+}615615+EXPORT_SYMBOL_GPL(dma_request_slave_channel_reason);616616+617617+/**618618+ * dma_request_slave_channel - try to allocate an exclusive slave channel619619+ * @dev: pointer to client device structure620620+ * @name: slave channel name621621+ *622622+ * Returns pointer to appropriate DMA channel on success or NULL.623623+ */624624+struct dma_chan *dma_request_slave_channel(struct device *dev,625625+ const char *name)626626+{627627+ struct dma_chan *ch = dma_request_slave_channel_reason(dev, name);628628+ if (IS_ERR(ch))629629+ return NULL;630630+ return ch;608631}609632EXPORT_SYMBOL_GPL(dma_request_slave_channel);610633
+9-6
drivers/dma/of-dma.c
···143143 * @np: device node to get DMA request from144144 * @name: name of desired channel145145 *146146- * Returns pointer to appropriate dma channel on success or NULL on error.146146+ * Returns pointer to appropriate DMA channel on success or an error pointer.147147 */148148struct dma_chan *of_dma_request_slave_channel(struct device_node *np,149149 const char *name)···152152 struct of_dma *ofdma;153153 struct dma_chan *chan;154154 int count, i;155155+ int ret_no_channel = -ENODEV;155156156157 if (!np || !name) {157158 pr_err("%s: not enough information provided\n", __func__);158158- return NULL;159159+ return ERR_PTR(-ENODEV);159160 }160161161162 count = of_property_count_strings(np, "dma-names");162163 if (count < 0) {163164 pr_err("%s: dma-names property of node '%s' missing or empty\n",164165 __func__, np->full_name);165165- return NULL;166166+ return ERR_PTR(-ENODEV);166167 }167168168169 for (i = 0; i < count; i++) {···173172 mutex_lock(&of_dma_lock);174173 ofdma = of_dma_find_controller(&dma_spec);175174176176- if (ofdma)175175+ if (ofdma) {177176 chan = ofdma->of_dma_xlate(&dma_spec, ofdma);178178- else177177+ } else {178178+ ret_no_channel = -EPROBE_DEFER;179179 chan = NULL;180180+ }180181181182 mutex_unlock(&of_dma_lock);182183···188185 return chan;189186 }190187191191- return NULL;188188+ return ERR_PTR(ret_no_channel);192189}193190194191/**