public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* finfo_uaddr in jedec_probe.c
@ 2005-09-13 16:18 Matthieu it
  0 siblings, 0 replies; only message in thread
From: Matthieu it @ 2005-09-13 16:18 UTC (permalink / raw)
  To: linux-mtd

Hello, 

I have some difficulties to understand the way the function
finfo_uaddr is working, especially for probing non x8 flash :

static inline __u8 finfo_uaddr(const struct amd_flash_info *finfo, int
device_type)
{
	int uaddr_idx;
	__u8 uaddr = MTD_UADDR_NOT_SUPPORTED;

	switch ( device_type ) {
	case CFI_DEVICETYPE_X8:  uaddr_idx = 0; break;
	case CFI_DEVICETYPE_X16: uaddr_idx = 1; break;
	case CFI_DEVICETYPE_X32: uaddr_idx = 2; break;
	default:
		printk(KERN_NOTICE "MTD: %s(): unknown device_type %d\n",
		       __func__, device_type);
		goto uaddr_done;
	}

	uaddr = finfo->uaddr[uaddr_idx];

	if (uaddr != MTD_UADDR_NOT_SUPPORTED ) {
		/* ASSERT("The unlock addresses for non-8-bit mode
		   are bollocks. We don't really need an array."); */
		uaddr = finfo->uaddr[0];
	}

 uaddr_done:
	return uaddr;
}

I would have replaced the line : 
if (uaddr != MTD_UADDR_NOT_SUPPORTED )
by 
if (uaddr == MTD_UADDR_NOT_SUPPORTED )

(at least, it makes my 2.6.12 kernel recognising the flash I have on
my board, with correct uaddr values in the table).

but it seems so strange that I may have missed something...

Can someone told me if I am wrong ? 

Regards,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-13 16:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-13 16:18 finfo_uaddr in jedec_probe.c Matthieu it

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox