Skip to content

Commit

Permalink
nvmem: use list_for_each_entry_safe in nvmem_device_remove_all_cells()
Browse files Browse the repository at this point in the history
Use the provided helper for iterating over list entries without having
to use the list_entry() macro.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
brgl authored and gregkh committed Sep 28, 2018
1 parent 5db652c commit 1852183
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/nvmem/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,11 @@ static void nvmem_cell_drop(struct nvmem_cell *cell)

static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem)
{
struct nvmem_cell *cell;
struct list_head *p, *n;
struct nvmem_cell *cell, *p;

list_for_each_safe(p, n, &nvmem_cells) {
cell = list_entry(p, struct nvmem_cell, node);
list_for_each_entry_safe(cell, p, &nvmem_cells, node)
if (cell->nvmem == nvmem)
nvmem_cell_drop(cell);
}
}

static void nvmem_cell_add(struct nvmem_cell *cell)
Expand Down

0 comments on commit 1852183

Please sign in to comment.