Numonyx NOR and chip->mutex bug?

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Feb 4 07:35:50 EST 2011


>
> Stefan Bigler <stefan.bigler at keymile.com> wrote on 2011/02/04 12:04:40:
> >
> > Hi Jocke
> >
> > The code does the same, but is much nicer :-)
> > My test is also working again.
>
> Thinking a little more one could do:
> if (chip->state == chip_state) {
>    status = map_read(map, cmd_adr);
>       if (map_word_andequal(map, status, status_OK, status_OK))
>          break;
> }

This is a bit unoptimal too:
#define XIP_INVAL_CACHED_RANGE(x...)
#define INVAL_CACHE_AND_WAIT inval_cache_and_wait_for_operation

....

	mutex_unlock(&chip->mutex);
	if (inval_len)
		INVALIDATE_CACHED_RANGE(map, inval_adr, inval_len);
	mutex_lock(&chip->mutex);

XIP_INVAL_CACHED_RANGE is always a nop but still we drop and take the lock.
Just a waste of CPU.

 Jocke




More information about the linux-mtd mailing list