diff options
author | Wang Hai <wanghai38@huawei.com> | 2021-06-10 21:03:55 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-10 14:08:09 -0700 |
commit | 73e42909ef2d1fa554b39bf6ae3eb1546dfc97a5 (patch) | |
tree | d1be33f687ab172204f432a5298a609dca2bfe34 /net/atm | |
parent | 3e98ae0014cb882a2989cf4465e2b26688d3608d (diff) |
atm: Use list_for_each_entry() to simplify code in resources.c
Convert list_for_each() to list_for_each_entry() where
applicable. This simplifies the code.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-rw-r--r-- | net/atm/resources.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/atm/resources.c b/net/atm/resources.c index 53236986dfe0..2b2d33eeaf20 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c @@ -52,10 +52,8 @@ static struct atm_dev *__alloc_atm_dev(const char *type) static struct atm_dev *__atm_dev_lookup(int number) { struct atm_dev *dev; - struct list_head *p; - list_for_each(p, &atm_devs) { - dev = list_entry(p, struct atm_dev, dev_list); + list_for_each_entry(dev, &atm_devs, dev_list) { if (dev->number == number) { atm_dev_hold(dev); return dev; @@ -215,8 +213,7 @@ int atm_getnames(void __user *buf, int __user *iobuf_len) return -ENOMEM; } tmp_p = tmp_buf; - list_for_each(p, &atm_devs) { - dev = list_entry(p, struct atm_dev, dev_list); + list_for_each_entry(dev, &atm_devs, dev_list) { *tmp_p++ = dev->number; } mutex_unlock(&atm_dev_mutex); |