Skip to contentSkip to conversation

iio/inkern.c Use list_for_each_entry_safe

PATCH Applied Anshul Garg 2 participants 2 messages Dec 8, 2015 – Dec 12, 2015 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio/inkern.c Use list_for_each_entry_safe

Use list_for_each_entry_safe instead of list_for_each_safe and list_entry call.

---
 drivers/iio/inkern.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/inkern.c +2 -4
index c8bad3c..f764eb6 100644
@@ -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);
Signature · 6 lines
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
maintainer Applied
#1 lore raw
Quoted 4 lines · Anshul Garg

Use list_for_each_entry_safe instead of list_for_each_safe and list_entry call.

Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilder to play with it.

Thanks,

Jonathan

Quoted 24 lines
---
 drivers/iio/inkern.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/inkern.c +2 -4
index c8bad3c..f764eb6 100644
@@ -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);