99 * Mika Westerberg <mika.westerberg@linux.intel.com>
1010 */
1111
12+ #include <linux/acpi.h>
13+ #include <linux/acpi_dma.h>
1214#include <linux/device.h>
1315#include <linux/dma-mapping.h>
1416#include <linux/err.h>
15- #include <linux/module.h>
17+ #include <linux/errno.h>
18+ #include <linux/export.h>
19+ #include <linux/ioport.h>
1620#include <linux/kernel.h>
1721#include <linux/list.h>
1822#include <linux/mutex.h>
19- #include <linux/slab.h>
20- #include <linux/ioport.h>
21- #include <linux/acpi.h>
22- #include <linux/acpi_dma.h>
2323#include <linux/property.h>
24+ #include <linux/slab.h>
25+ #include <linux/string.h>
26+ #include <linux/types.h>
2427
2528static LIST_HEAD (acpi_dma_list );
2629static DEFINE_MUTEX (acpi_dma_lock );
@@ -236,7 +239,7 @@ int acpi_dma_controller_free(struct device *dev)
236239}
237240EXPORT_SYMBOL_GPL (acpi_dma_controller_free );
238241
239- static void devm_acpi_dma_release ( struct device * dev , void * res )
242+ static void devm_acpi_dma_free ( void * dev )
240243{
241244 acpi_dma_controller_free (dev );
242245}
@@ -259,37 +262,15 @@ int devm_acpi_dma_controller_register(struct device *dev,
259262 (struct acpi_dma_spec * , struct acpi_dma * ),
260263 void * data )
261264{
262- void * res ;
263265 int ret ;
264266
265- res = devres_alloc (devm_acpi_dma_release , 0 , GFP_KERNEL );
266- if (!res )
267- return - ENOMEM ;
268-
269267 ret = acpi_dma_controller_register (dev , acpi_dma_xlate , data );
270- if (ret ) {
271- devres_free (res );
268+ if (ret )
272269 return ret ;
273- }
274- devres_add (dev , res );
275- return 0 ;
276- }
277- EXPORT_SYMBOL_GPL (devm_acpi_dma_controller_register );
278270
279- /**
280- * devm_acpi_dma_controller_free - resource managed acpi_dma_controller_free()
281- * @dev: device that is unregistering as DMA controller
282- *
283- * Unregister a DMA controller registered with
284- * devm_acpi_dma_controller_register(). Normally this function will not need to
285- * be called and the resource management code will ensure that the resource is
286- * freed.
287- */
288- void devm_acpi_dma_controller_free (struct device * dev )
289- {
290- WARN_ON (devres_release (dev , devm_acpi_dma_release , NULL , NULL ));
271+ return devm_add_action_or_reset (dev , devm_acpi_dma_free , dev );
291272}
292- EXPORT_SYMBOL_GPL (devm_acpi_dma_controller_free );
273+ EXPORT_SYMBOL_GPL (devm_acpi_dma_controller_register );
293274
294275/**
295276 * acpi_dma_update_dma_spec - prepare dma specifier to pass to translation function
0 commit comments