Re: [PATCH] [MTD] CORE: Use list_for_each_entry[_safe] where appropriate.

Jörn Engel
2008-05-17T19:49:26Z

On Sat, 17 May 2008 18:54:05 +0100, Chris Malley wrote:
>
> From: Chris Malley <mail@chrismalley.co.uk>
>
> Should be no functional changes, just a bit of janitorial work
> to remove temporary pointers and make some functions a bit more readable.

> - struct list_head *this;
> + struct mtd_blktrans_dev *this;
> int last_devnum = -1;
> struct gendisk *gd;
>
> @@ -221,25 +221,24 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
> BUG();
> }
>
> - list_for_each(this, &tr->devs) {
> - struct mtd_blktrans_dev *d = list_entry(this, struct mtd_blktrans_dev, list);

I guess whoever originally wrote the code used "d" for ..._dev. And in
spite of being just one letter, I find it more descriptive than "this".
Would you mind killing "this" instead of "d"? And likewise in the other
hunks, always nuke "this", as it has zero descriptiveness.

Otherwise a nice cleanup. Did you check that the resulting object code
remains identical?

Jörn

--
In America you can have either a flimsy box banged together out of two
by fours and drywall, or a McMansion -- a flimsy box banged together
out of two by fours and drywall, but larger, more dramatic-looking,
and full of expensive fittings.
-- Paul Graham