]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge remote-tracking branch 'asoc/topic/dma' into asoc-next
authorMark Brown <broonie@linaro.org>
Thu, 2 Jan 2014 13:01:52 +0000 (13:01 +0000)
committerMark Brown <broonie@linaro.org>
Thu, 2 Jan 2014 13:01:52 +0000 (13:01 +0000)
1  2 
drivers/dma/dmaengine.c
sound/soc/soc-devres.c

diff --combined drivers/dma/dmaengine.c
index ef63b9058f3c09d9d9dea56096bc5edda6d3b125,e17e9b22d85ed3407f009e3d7ce8cd68c3298dc5..92caad629d996cec8415b5d96dfc10605b127195
@@@ -540,6 -540,8 +540,8 @@@ EXPORT_SYMBOL_GPL(dma_get_slave_channel
   * @mask: capabilities that the channel must satisfy
   * @fn: optional callback to disposition available channels
   * @fn_param: opaque parameter to pass to dma_filter_fn
+  *
+  * Returns pointer to appropriate DMA channel on success or NULL.
   */
  struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
                                       dma_filter_fn fn, void *fn_param)
@@@ -591,18 -593,43 +593,43 @@@ EXPORT_SYMBOL_GPL(__dma_request_channel
   * dma_request_slave_channel - try to allocate an exclusive slave channel
   * @dev:      pointer to client device structure
   * @name:     slave channel name
+  *
+  * Returns pointer to appropriate DMA channel on success or an error pointer.
   */
- struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name)
+ struct dma_chan *dma_request_slave_channel_reason(struct device *dev,
+                                                 const char *name)
  {
+       struct dma_chan *chan;
        /* If device-tree is present get slave info from here */
        if (dev->of_node)
                return of_dma_request_slave_channel(dev->of_node, name);
  
        /* If device was enumerated by ACPI get slave info from here */
-       if (ACPI_HANDLE(dev))
-               return acpi_dma_request_slave_chan_by_name(dev, name);
+       if (ACPI_HANDLE(dev)) {
+               chan = acpi_dma_request_slave_chan_by_name(dev, name);
+               if (chan)
+                       return chan;
+       }
  
-       return NULL;
+       return ERR_PTR(-ENODEV);
+ }
+ EXPORT_SYMBOL_GPL(dma_request_slave_channel_reason);
+ /**
+  * dma_request_slave_channel - try to allocate an exclusive slave channel
+  * @dev:      pointer to client device structure
+  * @name:     slave channel name
+  *
+  * Returns pointer to appropriate DMA channel on success or NULL.
+  */
+ struct dma_chan *dma_request_slave_channel(struct device *dev,
+                                          const char *name)
+ {
+       struct dma_chan *ch = dma_request_slave_channel_reason(dev, name);
+       if (IS_ERR(ch))
+               return NULL;
+       return ch;
  }
  EXPORT_SYMBOL_GPL(dma_request_slave_channel);
  
@@@ -912,7 -939,7 +939,7 @@@ struct dmaengine_unmap_pool 
  #define __UNMAP_POOL(x) { .size = x, .name = "dmaengine-unmap-" __stringify(x) }
  static struct dmaengine_unmap_pool unmap_pool[] = {
        __UNMAP_POOL(2),
 -      #if IS_ENABLED(CONFIG_ASYNC_TX_DMA)
 +      #if IS_ENABLED(CONFIG_DMA_ENGINE_RAID)
        __UNMAP_POOL(16),
        __UNMAP_POOL(128),
        __UNMAP_POOL(256),
@@@ -1054,7 -1081,7 +1081,7 @@@ dma_async_memcpy_pg_to_pg(struct dma_ch
        dma_cookie_t cookie;
        unsigned long flags;
  
 -      unmap = dmaengine_get_unmap_data(dev->dev, 2, GFP_NOIO);
 +      unmap = dmaengine_get_unmap_data(dev->dev, 2, GFP_NOWAIT);
        if (!unmap)
                return -ENOMEM;
  
diff --combined sound/soc/soc-devres.c
index 3449c1e909ae10c71a695f6dc2eedecba9e8c163,999861942d28d4712d2e62657d0778fba3baf30b..7ac745df1412689c6adf0bf246399870b79e44e7
@@@ -12,6 -12,7 +12,7 @@@
  #include <linux/module.h>
  #include <linux/moduleparam.h>
  #include <sound/soc.h>
+ #include <sound/dmaengine_pcm.h>
  
  static void devm_component_release(struct device *dev, void *res)
  {
@@@ -66,7 -67,7 +67,7 @@@ static void devm_card_release(struct de
   */
  int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card)
  {
 -      struct device **ptr;
 +      struct snd_soc_card **ptr;
        int ret;
  
        ptr = devres_alloc(devm_card_release, sizeof(*ptr), GFP_KERNEL);
@@@ -75,7 -76,7 +76,7 @@@
  
        ret = snd_soc_register_card(card);
        if (ret == 0) {
 -              *ptr = dev;
 +              *ptr = card;
                devres_add(dev, ptr);
        } else {
                devres_free(ptr);
        return ret;
  }
  EXPORT_SYMBOL_GPL(devm_snd_soc_register_card);
+ #ifdef CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM
+ static void devm_dmaengine_pcm_release(struct device *dev, void *res)
+ {
+       snd_dmaengine_pcm_unregister(*(struct device **)res);
+ }
+ /**
+  * devm_snd_dmaengine_pcm_register - resource managed dmaengine PCM registration
+  * @dev: The parent device for the PCM device
+  * @config: Platform specific PCM configuration
+  * @flags: Platform specific quirks
+  *
+  * Register a dmaengine based PCM device with automatic unregistration when the
+  * device is unregistered.
+  */
+ int devm_snd_dmaengine_pcm_register(struct device *dev,
+       const struct snd_dmaengine_pcm_config *config, unsigned int flags)
+ {
+       struct device **ptr;
+       int ret;
+       ptr = devres_alloc(devm_dmaengine_pcm_release, sizeof(*ptr), GFP_KERNEL);
+       if (!ptr)
+               return -ENOMEM;
+       ret = snd_dmaengine_pcm_register(dev, config, flags);
+       if (ret == 0) {
+               *ptr = dev;
+               devres_add(dev, ptr);
+       } else {
+               devres_free(ptr);
+       }
+       return ret;
+ }
+ EXPORT_SYMBOL_GPL(devm_snd_dmaengine_pcm_register);
+ #endif