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

mfd: make mfd_remove_devices() iterate in reverse order

The newly introduced device_for_each_child_reverse() would be used when MFD
core removes the device.

After this patch applied the devices will be removed in a reversed order. This
behaviour is useful when devices have implicit dependency on order, i.e.
consider MFD device with serial bus controller, such as SPI, and DMA IP that is
attached to serial bus controller: before remove the DMA driver we have to be
ensured that no DMA transfers is ongoing and the requested channel are unused.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Andy Shevchenko and committed by
Lee Jones
b9a8a271 3d060aeb

+1 -1
+1 -1
drivers/mfd/mfd-core.c
··· 302 302 { 303 303 atomic_t *cnts = NULL; 304 304 305 - device_for_each_child(parent, &cnts, mfd_remove_devices_fn); 305 + device_for_each_child_reverse(parent, &cnts, mfd_remove_devices_fn); 306 306 kfree(cnts); 307 307 } 308 308 EXPORT_SYMBOL(mfd_remove_devices);