Skip to content

Commit

Permalink
ARM: OMAP2+: id: cache omap_type value
Browse files Browse the repository at this point in the history
There is no need to read the register with every invocation of the function,
as the value is constant. Thus, cache the value in a static variable.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
  • Loading branch information
Tero Kristo committed Mar 31, 2015
1 parent ae0f679 commit 23d240d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/arm/mach-omap2/id.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ EXPORT_SYMBOL(omap_rev);

int omap_type(void)
{
u32 val = 0;
static u32 val = OMAP2_DEVICETYPE_MASK;

if (val < OMAP2_DEVICETYPE_MASK)
return val;

if (cpu_is_omap24xx()) {
val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
Expand Down

0 comments on commit 23d240d

Please sign in to comment.