[PATCH] MTD: make panic_write() conditional to CONFIG_MTD_OOPS
Florian Fainelli
ffainelli at freebox.fr
Tue Jan 10 12:02:00 EST 2012
Hello Ira,
----- "Ira W. Snyder" <iws at ovro.caltech.edu> a écrit :
> On Tue, Jan 10, 2012 at 05:51:03PM +0100, Florian Fainelli wrote:
> > The mtdoops driver is the only user of the panic_write callback
> > make all panic_write related code conditionnal to CONFIG_MTD_OOPS
> > so we can save some code. Since CONFIG_MTD_OOPS can be a module
> > use the newly introduced IS_ENABLED() macro to cope with that.
> >
> > It is safe to define the panic_write callback as NULL when
> > CONFIG_MTD_OOPS is disabled since the mtdoops drivers check for the
> > callback being non-NULL and returns an error if this the case.
> >
> > Signed-off-by: Florian Fainelli <ffainelli at freebox.fr>
> > ---
[snip]
> > diff --git a/drivers/mtd/onenand/onenand_base.c
> b/drivers/mtd/onenand/onenand_base.c
> > index a061bc1..9f6a2a9 100644
> > --- a/drivers/mtd/onenand/onenand_base.c
> > +++ b/drivers/mtd/onenand/onenand_base.c
> > @@ -1736,6 +1736,7 @@ static void onenand_panic_wait(struct mtd_info
> *mtd)
> > *
> > * Write with ECC
> > */
> > +#if IS_ENABLED(CONFIG_MTD_OOPS)
>
> This #if should be moved up above onenand_panic_wait() which is only
> used from onenand_panic_write().
Indeed, thanks for spotting this.
>
> Other than that, the patch looks good to me.
Thanks.
--
Florian
>
> Ira
>
> > static int onenand_panic_write(struct mtd_info *mtd, loff_t to,
> size_t len,
> > size_t *retlen, const u_char *buf)
> > {
> > @@ -1819,6 +1820,10 @@ static int onenand_panic_write(struct
> mtd_info *mtd, loff_t to, size_t len,
> > *retlen = written;
> > return ret;
> > }
> > +#else
> > +#define onenand_panic_write NULL
> > +#endif
> > +
> >
> > /**
> > * onenand_fill_auto_oob - [INTERN] oob auto-placement transfer
> > --
> > 1.7.5.4
> >
More information about the linux-mtd
mailing list