public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
Date: Sun, 10 Jan 2010 12:21:09 +0200	[thread overview]
Message-ID: <1263118869.7315.149.camel@localhost.localdomain> (raw)
In-Reply-To: <1262704813.2837.7.camel@achroite.uk.solarflarecom.com>

On Tue, 2010-01-05 at 15:20 +0000, Ben Hutchings wrote:
> This removes the need to know the number of MTD devices.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
>  drivers/mtd/mtdsuper.c |   18 ++++++------------
>  1 files changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
> index af8b42e..d257052 100644
> --- a/drivers/mtd/mtdsuper.c
> +++ b/drivers/mtd/mtdsuper.c
> @@ -150,18 +150,12 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
>  			DEBUG(1, "MTDSB: mtd:%%s, name \"%s\"\n",
>  			      dev_name + 4);
>  
> -			for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
> -				mtd = get_mtd_device(NULL, mtdnr);
> -				if (!IS_ERR(mtd)) {
> -					if (!strcmp(mtd->name, dev_name + 4))
> -						return get_sb_mtd_aux(
> -							fs_type, flags,
> -							dev_name, data, mtd,
> -							fill_super, mnt);
> -
> -					put_mtd_device(mtd);
> -				}
> -			}
> +			mtd = get_mtd_device_nm(dev_name + 4);
> +			if (!IS_ERR(mtd))
> +				return get_sb_mtd_aux(
> +					fs_type, flags,
> +					dev_name, data, mtd,
> +					fill_super, mnt);

Since now your indentation level is less, you could de-uglify the
'get_sb_mtd_aux()' as well, while you are on it. But this is minor.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  reply	other threads:[~2010-01-10 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 15:20 [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd() Ben Hutchings
2010-01-10 10:21 ` Artem Bityutskiy [this message]
2010-01-10 10:35 ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263118869.7315.149.camel@localhost.localdomain \
    --to=dedekind1@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox