Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1286719 > unrolled thread

[PATCH] iio/inkern.c Use list_for_each_entry_safe

Started byAnshul Garg <aksgarg1989@gmail.com>
First post2015-12-08 18:50 +0100
Last post2015-12-12 18:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iio/inkern.c Use list_for_each_entry_safe Anshul Garg <aksgarg1989@gmail.com> - 2015-12-08 18:50 +0100
    Re: [PATCH] iio/inkern.c Use list_for_each_entry_safe Jonathan Cameron <jic23@kernel.org> - 2015-12-12 18:30 +0100

#1286719 — [PATCH] iio/inkern.c Use list_for_each_entry_safe

FromAnshul Garg <aksgarg1989@gmail.com>
Date2015-12-08 18:50 +0100
Subject[PATCH] iio/inkern.c Use list_for_each_entry_safe
Message-ID<qDuyJ-5mF-1@gated-at.bofh.it>
Use list_for_each_entry_safe instead of list_for_each_safe
and list_entry call.

Signed-off-by: Anshul Garg <aksgarg1989@gmail.com>
---
 drivers/iio/inkern.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index c8bad3c..f764eb6 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -61,12 +61,10 @@ EXPORT_SYMBOL_GPL(iio_map_array_register);
 int iio_map_array_unregister(struct iio_dev *indio_dev)
 {
 	int ret = -ENODEV;
-	struct iio_map_internal *mapi;
-	struct list_head *pos, *tmp;
+	struct iio_map_internal *mapi, *next;
 
 	mutex_lock(&iio_map_list_lock);
-	list_for_each_safe(pos, tmp, &iio_map_list) {
-		mapi = list_entry(pos, struct iio_map_internal, l);
+	list_for_each_entry_safe(mapi, next, &iio_map_list, l) {
 		if (indio_dev == mapi->indio_dev) {
 			list_del(&mapi->l);
 			kfree(mapi);
-- 
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
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/

[toc] | [next] | [standalone]


#1290248

FromJonathan Cameron <jic23@kernel.org>
Date2015-12-12 18:30 +0100
Message-ID<qEW9A-542-5@gated-at.bofh.it>
In reply to#1286719
On 08/12/15 17:45, Anshul Garg wrote:
> Use list_for_each_entry_safe instead of list_for_each_safe
> and list_entry call.
> 
> Signed-off-by: Anshul Garg <aksgarg1989@gmail.com>
Applied to the togreg branch of iio.git - initially pushed out
as testing for the autobuilder to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/inkern.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index c8bad3c..f764eb6 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -61,12 +61,10 @@ EXPORT_SYMBOL_GPL(iio_map_array_register);
>  int iio_map_array_unregister(struct iio_dev *indio_dev)
>  {
>  	int ret = -ENODEV;
> -	struct iio_map_internal *mapi;
> -	struct list_head *pos, *tmp;
> +	struct iio_map_internal *mapi, *next;
>  
>  	mutex_lock(&iio_map_list_lock);
> -	list_for_each_safe(pos, tmp, &iio_map_list) {
> -		mapi = list_entry(pos, struct iio_map_internal, l);
> +	list_for_each_entry_safe(mapi, next, &iio_map_list, l) {
>  		if (indio_dev == mapi->indio_dev) {
>  			list_del(&mapi->l);
>  			kfree(mapi);
> 

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web