Usage of MTD_UADDR_UNNECESSARY broken?
Thayne Harbaugh
tharbaugh at lnxi.com
Mon Nov 8 13:30:15 EST 2004
On Mon, 2004-11-08 at 12:54 +0100, Alexander Hoffmann wrote:
> Hi everyone,
>
> can anybody please explain me the exact difference between
> MTD_UADDR_DONT_CARE and MTD_UADDR_UNNECESSARY .
It's exactly what the comments state:
MTD_UADDR_DONT_CARE, /* Requires an arbitrary address */
MTD_UADDR_UNNECESSARY, /* Does not require any address */
> Because if I use MTD_UADDR_UNNECESSARY an not existing field in the
> unlock_addrs array is beeing referenced
> (/drivers/mtd/chips/jedec_probe.c, function cfi_jedec_setup, line 1740):
Unlock addresses shouldn't be assigned if they aren't necessary - hence
why there isn't an entry for them in unlock_addrs[]. There should be
logic that checks this before making the assignment. Of course another
way to do it would be to have an entry assigned, but not use it. I
prefer, however, that things break when the logic is incorrect - which
is the way it is now.
> /* Mask out address bits which are smaller than the device type */
> mask = ~(p_cfi->device_type-1);
> p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 & mask;
> p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 & mask;
>
> If I change MTD_UADDR_DONT_CARE to MTD_UADDR_UNNECESSARY everything
> works fine!
Apparently there is a problem that it isn't exiting the function earlier
for the MTD_UADDR_UNNECESSARY case.
Of course you also need to know which kind of chip you have: Is it a
DONT_CARE or an UNNECESSARY?
--
Thayne Harbaugh
Linux Networx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20041108/2fbd76c9/attachment.bin
More information about the linux-mtd
mailing list