> On Wed, Oct 14, 2009 at 9:11 AM, G, Manjunath Kondaiah > <manjugk@xxxxxx> wrote: > > > Any advantage of using both enum and register offsets? > > You can have only register offset macros instead of enum. > > This was the appproach proposed by Tony in response to Alistair's > original query. Tony originally cited something from Russel for the > reason. > > http://www.mail-archive.com/linux-omap@xxxxxxxxxxxxxxx/msg14918.html > > If static #define's were used, then it would probably be impossible to > support multiple omap1 cpu's with the same binary driver / binary > kernel. Having a run-time cpu check (referencing static offset arrays) > makes this possible and in the worst case scenario, it adds ~20 bytes. > I guess if you really wanted to save those 20 bytes, then you could > check #ifdef OMAP1_MULTI or something like that. > You can acheive the same using only enum with following: #define OMAP_RTC_REGISTER_SIZE (cpu_is_omap7xx()?1:4) #define rtc_read(reg) omap_readb(OMAP_RTC_BASE + (reg * OMAP_RTC_REGISTER_SIZE)) #define rtc_write(val, reg) omap_writeb(val, OMAP_RTC_BASE + (reg * OMAP_RTC_REGISTER_SIZE)) Russel point is different compared to your scenario. > > Why 50? Count can be decreased from 50 to 30/35 which will > increase rtc performance. > > No idea, I didn't write the driver, I just patched it, and that is > completely irrelevent to my patch, but feel free to test 30/35 and > submit the changes back :) > This should be tested and optimized before pushing upstream. -- 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