* [PATCH net-next] atm: Use list_for_each_entry() to simplify code in resources.c
@ 2021-06-10 13:03 Wang Hai
2021-06-10 21:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Wang Hai @ 2021-06-10 13:03 UTC (permalink / raw)
To: davem, kuba, gustavoars; +Cc: netdev, linux-kernel
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>
---
net/atm/resources.c | 7 ++-----
1 file 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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] atm: Use list_for_each_entry() to simplify code in resources.c
2021-06-10 13:03 [PATCH net-next] atm: Use list_for_each_entry() to simplify code in resources.c Wang Hai
@ 2021-06-10 21:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-10 21:10 UTC (permalink / raw)
To: Wang Hai; +Cc: davem, kuba, gustavoars, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Thu, 10 Jun 2021 21:03:55 +0800 you wrote:
> 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>
> ---
> net/atm/resources.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
Here is the summary with links:
- [net-next] atm: Use list_for_each_entry() to simplify code in resources.c
https://git.kernel.org/netdev/net-next/c/73e42909ef2d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-10 21:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 13:03 [PATCH net-next] atm: Use list_for_each_entry() to simplify code in resources.c Wang Hai
2021-06-10 21:10 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.