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.

Signed-off-by: Anshul Garg <aksgarg1989@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Anshul Garg 2015-12-08 09:45:56 -08:00 committed by Jonathan Cameron
parent 50672011d6
commit c34c18195d

View File

@ -61,12 +61,10 @@ EXPORT_SYMBOL_GPL(iio_map_array_register);
int iio_map_array_unregister(struct iio_dev *indio_dev) int iio_map_array_unregister(struct iio_dev *indio_dev)
{ {
int ret = -ENODEV; int ret = -ENODEV;
struct iio_map_internal *mapi; struct iio_map_internal *mapi, *next;
struct list_head *pos, *tmp;
mutex_lock(&iio_map_list_lock); mutex_lock(&iio_map_list_lock);
list_for_each_safe(pos, tmp, &iio_map_list) { list_for_each_entry_safe(mapi, next, &iio_map_list, l) {
mapi = list_entry(pos, struct iio_map_internal, l);
if (indio_dev == mapi->indio_dev) { if (indio_dev == mapi->indio_dev) {
list_del(&mapi->l); list_del(&mapi->l);
kfree(mapi); kfree(mapi);