[PATCH 3/6] mtd: nand: bb: use mtd api directly

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 28 11:48:30 PDT 2014


On Mon, Apr 28, 2014 at 03:05:26PM +0200, Alexander Aring wrote:
> Hi Sascha,
> 
> On Mon, Apr 28, 2014 at 11:49:36AM +0200, Sascha Hauer wrote:
> > The devfs layer just adds an addition indirection between mtd
> > and the bb devices with no purpose. Drop it.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> >  drivers/mtd/nand/nand-bb.c | 122 +++++++++++++++++++--------------------------
> >  1 file changed, 50 insertions(+), 72 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
> > index f387ef6..06b5824 100644
> > --- a/drivers/mtd/nand/nand-bb.c
> > +++ b/drivers/mtd/nand/nand-bb.c
> > @@ -25,22 +25,18 @@
> >  #include <init.h>
> >  #include <ioctl.h>
> >  #include <nand.h>
> > -#include <linux/mtd/mtd-abi.h>
> > +#include <linux/mtd/mtd.h>
> >  #include <fcntl.h>
> >  #include <libgen.h>
> ...
> 
> > @@ -313,8 +291,8 @@ int dev_remove_bb_dev(const char *name)
> >  	list_for_each_entry(bb, &bb_list, list) {
> >  		if (!strcmp(bb->cdev.name, name)) {
> >  			devfs_remove(&bb->cdev);
> > -			cdev_close(bb->cdev_parent);
> >  			list_del_init(&bb->list);
> > +			free(bb->name);
> >  			free(bb);
> >  			return 0;
> >  		}
> 
> I know you doesn't change this line but I think we need a
> list_for_each_entry_safe here instead of list_for_each_entry.

Ouch, you are right. I'll prepare a patch for this.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list