From: Ville Herva <vherva@vianova.fi>
To: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] [MTD] block2mtd.c: Make kernel boot command line arguments work (try 3)
Date: Tue, 11 Jul 2006 09:23:42 +0300 [thread overview]
Message-ID: <20060711062342.GY6240@vianova.fi> (raw)
In-Reply-To: <20060707122221.GW6240@vianova.fi>
Few notes about the admittedly ugly #ifndef MODULE chunks:
On Fri, Jul 07, 2006 at 03:22:21PM +0300, you [Ville Herva] wrote:
>
> --- linux-mtd-GIT/drivers/mtd/devices/block2mtd.c 2006-07-05 23:06:10.000000000 +0300
> +++ linux-2.6.17.3.NEW3/drivers/mtd/devices/block2mtd.c 2006-07-07 15:04:48.000000000 +0300
> bdev = open_bdev_excl(devname, O_RDWR, NULL);
> +#ifndef MODULE
> + dev_t dev = name_to_dev_t(devname);
> +#endif
Apparently, name_to_dev_t() is not exported to use in modules (which kind of
makes sense - there shouldn't be need as rootfs should already be available
when a module is being loaded.) So I had to #ifdef it. And on the other
hand, open_bdev_excl() should be enough for modules anyway.
> +#ifndef MODULE
> +static int block2mtd_init_called = 0;
> +static __initdata char block2mtd_paramline[80 + 12]; /* 80 for device, 12 for erase size */
> +#endif
The __initdata variable gave warnings when compiling with -DMODULE (it was
referred, but not on a possible call path.) I decided to #ifdef it away, and
take block2mtd_init_called away as well. At least this saves some memory.
> +{
> +#ifdef MODULE
> + return block2mtd_setup2(val);
> +#else
> + if (block2mtd_init_called)
> + return block2mtd_setup2(val);
> + strlcpy(block2mtd_paramline, val, sizeof(block2mtd_paramline));
> + return 0;
> +#endif
This should make sure that the behaviour is exactly the same as before in
-DMODULE and echo XX > /sys/module/block2mtd/parameters/block2mtd cases.
Specifically, static char block2mtd_paramline[80 + 12]; instruduced an
additional 92 char upper limit for the device name len. With the new patch,
this limit is only introduced for the kernel boot param (kernel internal
name_to_dev_t() probably won't accept anything longer anyway, but
open_bdev_excl() might, as it takes paths to the filesystem.)
Jörn, the #ifdef MODULE do clutter up the code, so I leave it to you as the
maintainer to decide if they are worth it.
next prev parent reply other threads:[~2006-07-11 6:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-07 12:22 [PATCH] [MTD] block2mtd.c: Make kernel boot command line arguments work (try 3) Ville Herva
2006-07-10 22:31 ` Ville Herva
2006-07-11 6:23 ` Ville Herva [this message]
2006-07-12 9:50 ` Jörn Engel
2006-07-12 17:24 ` Ville Herva
2006-07-13 13:39 ` Jörn Engel
2006-07-13 13:49 ` Ville Herva
2006-07-13 14:55 ` Jörn Engel
2006-07-13 21:02 ` David Woodhouse
2006-07-13 21:33 ` Ville Herva
2006-07-13 15:41 ` [PATCH] [MTD] block2mtd.c: Remove unnecessary parsing of empty boot-time argument Ville Herva
2006-07-12 9:50 ` [PATCH] [MTD] block2mtd.c: Make kernel boot command line arguments work (try 3) Jörn Engel
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=20060711062342.GY6240@vianova.fi \
--to=vherva@vianova.fi \
--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