> -----Original Message----- > From: linux-omap-owner@xxxxxxxxxxxxxxx [mailto:linux-omap- > owner@xxxxxxxxxxxxxxx] On Behalf Of Russell King - ARM Linux > Sent: Monday, August 17, 2009 1:05 PM > To: Rabin Vincent > Cc: Syed Mohammed, Khasim; linux-arm-kernel@xxxxxxxxxxxxxxxxxxxxxx; linux- > omap@xxxxxxxxxxxxxxx > Subject: Re: Exception while handling MEM Hole on OMAP3 / ARM Cortex A8 > > On Mon, Aug 17, 2009 at 11:31:45PM +0530, Rabin Vincent wrote: > > When mid == 0, the loop exits because the condition you have is : > > > > while ((mid = (right - left) / 2) > 0) { > > ^^^^^^ > > > > Thus bank[0] will never be checked. > > Ah yes, right. Damn it. > > Oh well, this will probably have to wait a couple of weeks now (by > which time I expect I will have forgotten about the problem.) How about this?: #ifndef CONFIG_SPARSEMEM int pfn_valid(unsigned long pfn) { struct meminfo *mi = &meminfo; unsigned int left = 0, right = mi->nr_banks; while (left <= right) { unsigned int mid = (right - left) / 2; struct membank *bank = &mi->bank[mid]; if (pfn < bank_pfn_start(bank)) right = mid; else if (pfn >= bank_pfn_end(bank)) left = mid + 1; else return 1; } return 0; } EXPORT_SYMBOL(pfn_valid); #endif Regards, Sergio > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html