diff options
Diffstat (limited to 'drivers/dma/dmaengine.c')
-rw-r--r-- | drivers/dma/dmaengine.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 504420f213ff..272bed6c8ba7 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -1141,6 +1141,41 @@ void dma_async_device_unregister(struct dma_device *device) | |||
1141 | } | 1141 | } |
1142 | EXPORT_SYMBOL(dma_async_device_unregister); | 1142 | EXPORT_SYMBOL(dma_async_device_unregister); |
1143 | 1143 | ||
1144 | static void dmam_device_release(struct device *dev, void *res) | ||
1145 | { | ||
1146 | struct dma_device *device; | ||
1147 | |||
1148 | device = *(struct dma_device **)res; | ||
1149 | dma_async_device_unregister(device); | ||
1150 | } | ||
1151 | |||
1152 | /** | ||
1153 | * dmaenginem_async_device_register - registers DMA devices found | ||
1154 | * @device: &dma_device | ||
1155 | * | ||
1156 | * The operation is managed and will be undone on driver detach. | ||
1157 | */ | ||
1158 | int dmaenginem_async_device_register(struct dma_device *device) | ||
1159 | { | ||
1160 | void *p; | ||
1161 | int ret; | ||
1162 | |||
1163 | p = devres_alloc(dmam_device_release, sizeof(void *), GFP_KERNEL); | ||
1164 | if (!p) | ||
1165 | return -ENOMEM; | ||
1166 | |||
1167 | ret = dma_async_device_register(device); | ||
1168 | if (!ret) { | ||
1169 | *(struct dma_device **)p = device; | ||
1170 | devres_add(device->dev, p); | ||
1171 | } else { | ||
1172 | devres_free(p); | ||
1173 | } | ||
1174 | |||
1175 | return ret; | ||
1176 | } | ||
1177 | EXPORT_SYMBOL(dmaenginem_async_device_register); | ||
1178 | |||
1144 | struct dmaengine_unmap_pool { | 1179 | struct dmaengine_unmap_pool { |
1145 | struct kmem_cache *cache; | 1180 | struct kmem_cache *cache; |
1146 | const char *name; | 1181 | const char *name; |