Skip to contentSkip to conversation

finfo_uaddr in jedec_probe.c

DISCUSSION Matthieu it 1 participant 1 message Sep 13, 2005 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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,