driver core: Replace open-coded list_last_entry()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 24 Mar 2020 12:20:23 +0000 (14:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Mar 2020 12:33:26 +0000 (13:33 +0100)
There is a place in the code where open-coded version of list entry accessors
list_last_entry() is used.

Replace that with the standard macro.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200324122023.9649-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/dd.c

index 3f5b8bdd94f0b4e630e17ae076c85b062b8661a4..06ec0e851fa168f734641514475659e07d7d9e3c 100644 (file)
@@ -1199,7 +1199,7 @@ void driver_detach(struct device_driver *drv)
                        spin_unlock(&drv->p->klist_devices.k_lock);
                        break;
                }
-               dev_prv = list_entry(drv->p->klist_devices.k_list.prev,
+               dev_prv = list_last_entry(&drv->p->klist_devices.k_list,
                                     struct device_private,
                                     knode_driver.n_node);
                dev = dev_prv->device;