From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gw1.transmode.se ([213.115.205.20]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PlKzj-0001Mn-TX for linux-mtd@lists.infradead.org; Fri, 04 Feb 2011 12:42:37 +0000 In-Reply-To: References: <16826B66-31FE-41AD-A6EF-E668A45AF1FE@prograde.net> <25631ED7-C6A0-44B1-B33D-F48DC48C812E@prograde.net> <626D0191-85FC-41E2-94C7-CBFF9D9629BE@prograde.net> <6FC0E416-EEBD-453F-AAB9-88BB6D90BFAB@prograde.net> <4D4AD9ED.8060104@keymile.com> <4D4B37D4.4050204@keymile.com> <4D4BDD48.6040600@keymile.com> Subject: Re: Numonyx NOR and chip->mutex bug? Message-ID: From: Joakim Tjernlund Date: Fri, 4 Feb 2011 13:42:33 +0100 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Cc: linux-mtd@lists.infradead.org, Holger brunck , stefan.bigler@keymile.com, Michael Cashwell List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , > > > > Stefan Bigler 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. Duuh, disregard