Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1294987
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 05/14] atm: use list_for_each_entry |
| Date | 2015-12-18 16:50 +0100 |
| Message-ID | <qH5s6-7vm-21@gated-at.bofh.it> (permalink) |
| References | <qH5ip-7rE-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Use list_for_each_entry() instead of list_for_each() to simplify
the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
net/atm/ioctl.c | 5 ++---
net/atm/resources.c | 8 ++------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c
index bbd3b63..9feb293 100644
--- a/net/atm/ioctl.c
+++ b/net/atm/ioctl.c
@@ -53,7 +53,7 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
struct sock *sk = sock->sk;
struct atm_vcc *vcc;
int error;
- struct list_head *pos;
+ struct atm_ioctl *ic;
void __user *argp = (void __user *)arg;
vcc = ATM_SD(sock);
@@ -163,8 +163,7 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
error = -ENOIOCTLCMD;
mutex_lock(&ioctl_mutex);
- list_for_each(pos, &ioctl_list) {
- struct atm_ioctl *ic = list_entry(pos, struct atm_ioctl, list);
+ list_for_each_entry(ic, &ioctl_list, list) {
if (try_module_get(ic->owner)) {
error = ic->ioctl(sock, cmd, arg);
module_put(ic->owner);
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 0447d5d..413d919 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -51,10 +51,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;
@@ -238,10 +236,8 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
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);
error = ((copy_to_user(buf, tmp_buf, size)) ||
put_user(size, iobuf_len))
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 01/14] Bluetooth: use list_for_each_entry* Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 07/14] batman-adv: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
Re: [PATCH 07/14] batman-adv: use list_for_each_entry_safe Antonio Quartulli <a@unstable.cc> - 2015-12-21 16:10 +0100
[PATCH 02/14] sctp: use list_for_each_entry* Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
Re: [PATCH 02/14] sctp: use list_for_each_entry* Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2015-12-18 17:00 +0100
[PATCH 08/14] caif: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 10/14] lapb: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 12/14] net: sched: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 06/14] libceph: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 16:50 +0100
[PATCH 05/14] atm: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:50 +0100
Re: [PATCH 01/14] Bluetooth: use list_for_each_entry* Marcel Holtmann <marcel@holtmann.org> - 2015-12-20 08:20 +0100
csiph-web