aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-03-07 12:54:14 +0200
committerBartosz Golaszewski <brgl@bgdev.pl>2022-03-08 09:52:57 +0100
commit243cfa6a6782809975a0002125514a57db7df752 (patch)
tree8190cef26f94a36bce01ac3c7d94f2196a2ad159 /drivers/gpio
parentMerge tag 'intel-gpio-v5.18-1' of gitolite.kernel.org:pub/scm/linux/kernel/git/andy/linux-gpio-intel into gpio/for-next (diff)
downloadwireguard-linux-243cfa6a6782809975a0002125514a57db7df752.tar.xz
wireguard-linux-243cfa6a6782809975a0002125514a57db7df752.zip
gpiolib: Use list_first_entry()/list_last_entry()
Use list_first_entry()/list_last_entry() instead of open coded variants. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index b4d8bf3a1121..9b2b3a2cd1d8 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -262,14 +262,14 @@ static int gpiodev_add_to_list(struct gpio_device *gdev)
return 0;
}
- next = list_entry(gpio_devices.next, struct gpio_device, list);
+ next = list_first_entry(&gpio_devices, struct gpio_device, list);
if (gdev->base + gdev->ngpio <= next->base) {
/* add before first entry */
list_add(&gdev->list, &gpio_devices);
return 0;
}
- prev = list_entry(gpio_devices.prev, struct gpio_device, list);
+ prev = list_last_entry(&gpio_devices, struct gpio_device, list);
if (prev->base + prev->ngpio <= gdev->base) {
/* add behind last entry */
list_add_tail(&gdev->list, &gpio_devices);
@@ -4423,7 +4423,7 @@ static void *gpiolib_seq_next(struct seq_file *s, void *v, loff_t *pos)
if (list_is_last(&gdev->list, &gpio_devices))
ret = NULL;
else
- ret = list_entry(gdev->list.next, struct gpio_device, list);
+ ret = list_first_entry(&gdev->list, struct gpio_device, list);
spin_unlock_irqrestore(&gpio_lock, flags);
s->private = "\n";