On Thu, 2005-07-07 at 13:11 -0400, Robert Whaley wrote: > This IOCTL is asking about bad blocks on the on-board flash. The > current MTD layer doesn't support bad blocks checking, so it returns > -EOPNOSUPP when this ioctl is called. It does. See below. > The current 'erase' and 'eraseall' commands from Debian, use this IOCTL. > These commands fail if the IOCTL returns -EOPNOTSUPP. First off, the utils are renamed to flash_xxxx and reworked since long. Please kick the responsible Debian maintainer to update his outdated stuff. Obsolete utilities are no excuse for changing current kernel code. Otherwise use the utils from MTD repository. The MTD team is not responsible for distro maintainers deep sleep. > Probably the better thing to do would be to fix these commands so that > they continue to erase even when -EOPNOTSUPP is returned. > > On the otherhand, returning 0 (which indicates the block is OK), is also > a reasonable return, since MTD is not keeping track of the bad blocks - > so the block must be OK as far as the MTD layer is concerned. Bla... RTFC. MTD _is_ keeping track in case of FLASH types which rely on bad block handling, namely NAND. In case of NOR FLASH which does not support bad block checking, the -EOPNOTSUPP return value is intentional to signal the absence of bad block handling code for the particular MTD device to the calling application. The application should disable further bad block check ioctl calls. Read the relevant source of current MTD utils for further clarification. > > --- linux-2.6.12.2-ep93xx/drivers/mtd/mtdchar.c 2005-06-29 > > if (!mtd->block_isbad) > > +#if 0 > > ret = -EOPNOTSUPP; > > +#else > > + ret = 0; > > +#endif Don't even think about changing the relevant code in mtdchar.c. Such a change will never be accepted. Ignorance is no excuse at all. :) tglx