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

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: Simplify dmaenginem_async_device_register() function

Use devm_add_action_or_reset() instead of devres_alloc() and
devres_add(), which works the same. This will simplify the
code. There is no functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230130112830.52353-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Andy Shevchenko and committed by
Vinod Koul
a1beaa50 40e171c2

+4 -16
+4 -16
drivers/dma/dmaengine.c
··· 1322 1322 } 1323 1323 EXPORT_SYMBOL(dma_async_device_unregister); 1324 1324 1325 - static void dmam_device_release(struct device *dev, void *res) 1325 + static void dmaenginem_async_device_unregister(void *device) 1326 1326 { 1327 - struct dma_device *device; 1328 - 1329 - device = *(struct dma_device **)res; 1330 1327 dma_async_device_unregister(device); 1331 1328 } 1332 1329 ··· 1335 1338 */ 1336 1339 int dmaenginem_async_device_register(struct dma_device *device) 1337 1340 { 1338 - void *p; 1339 1341 int ret; 1340 1342 1341 - p = devres_alloc(dmam_device_release, sizeof(void *), GFP_KERNEL); 1342 - if (!p) 1343 - return -ENOMEM; 1344 - 1345 1343 ret = dma_async_device_register(device); 1346 - if (!ret) { 1347 - *(struct dma_device **)p = device; 1348 - devres_add(device->dev, p); 1349 - } else { 1350 - devres_free(p); 1351 - } 1344 + if (ret) 1345 + return ret; 1352 1346 1353 - return ret; 1347 + return devm_add_action(device->dev, dmaenginem_async_device_unregister, device); 1354 1348 } 1355 1349 EXPORT_SYMBOL(dmaenginem_async_device_register); 1356 1350