From: Guenter Roeck <linux@roeck-us.net>
To: qiwuchen55@gmail.com
Cc: davem@davemloft.net, linux-ide@vger.kernel.org,
chenqiwu <chenqiwu@xiaomi.com>
Subject: Re: [PATCH] drivers/ide: convert to list_for_each_entry_safe()
Date: Sun, 5 Apr 2020 10:29:13 -0700 [thread overview]
Message-ID: <20200405172913.GA168671@roeck-us.net> (raw)
In-Reply-To: <1581671785-25125-1-git-send-email-qiwuchen55@gmail.com>
On Fri, Feb 14, 2020 at 05:16:25PM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
>
> Use list_for_each_entry_safe() instead of list_for_each_safe()
> to simplify the code.
>
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
> ---
> drivers/ide/ide-scan-pci.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c
> index acf8748..383f0d8 100644
> --- a/drivers/ide/ide-scan-pci.c
> +++ b/drivers/ide/ide-scan-pci.c
> @@ -89,8 +89,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev)
> static int __init ide_scan_pcibus(void)
> {
> struct pci_dev *dev = NULL;
> - struct pci_driver *d;
> - struct list_head *l, *n;
> + struct pci_driver *d, *tmp;
>
> pre_init = 0;
> for_each_pci_dev(dev)
> @@ -101,9 +100,8 @@ static int __init ide_scan_pcibus(void)
> * are post init.
> */
>
> - list_for_each_safe(l, n, &ide_pci_drivers) {
> - list_del(l);
> - d = list_entry(l, struct pci_driver, node);
> + list_for_each_entry_safe(d, tmp, &ide_pci_drivers, node) {
> + list_del(d->node);
Just in case this wasn't reported yet.
drivers/ide/ide-scan-pci.c: In function 'ide_scan_pcibus':
drivers/ide/ide-scan-pci.c:104:13: error: incompatible type for argument 1 of 'list_del'
104 | list_del(d->node);
| ~^~~~~~
| |
| struct list_head
In file included from include/linux/module.h:12,
from drivers/ide/ide-scan-pci.c:12:
include/linux/list.h:144:47: note: expected 'struct list_head *' but argument is of type 'struct list_head'
144 | static inline void list_del(struct list_head *entry)
Guenter
prev parent reply other threads:[~2020-04-05 17:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 9:16 [PATCH] drivers/ide: convert to list_for_each_entry_safe() qiwuchen55
2020-04-03 1:07 ` David Miller
2020-04-05 17:29 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200405172913.GA168671@roeck-us.net \
--to=linux@roeck-us.net \
--cc=chenqiwu@xiaomi.com \
--cc=davem@davemloft.net \
--cc=linux-ide@vger.kernel.org \
--cc=qiwuchen55@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).