linux-mips
[Top] [All Lists]

Re: [PATCH][MIPS]: AR7 GPIO

To: technoboy85@gmail.com
Subject: Re: [PATCH][MIPS]: AR7 GPIO
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Sun, 13 Jan 2008 21:32:44 +0900 (JST)
Cc: linux-mips@linux-mips.org, florian@openwrt.org, nbd@openwrt.org, ejka@imfi.kspu.ru, nico@openwrt.org, ralf@linux-mips.org, akpm@linux-foundation.org
In-reply-to: <200801121818.02550.technoboy85@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200801121818.02550.technoboy85@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
On Sat, 12 Jan 2008 18:18:02 +0100, Matteo Croce <technoboy85@gmail.com> wrote:
> +static inline void gpio_set_value(unsigned gpio, int value)
> +{
> +     static void __iomem *gpio_out;
> +     unsigned tmp;
> +
> +     if (!gpio_out)
> +             gpio_out = (void __iomem *)
> +                             KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_OUTPUT);
> +
> +     tmp = readl(gpio_out) & ~(1 << gpio);
> +     if (value)
> +             tmp |= 1 << gpio;
> +     writel(tmp, gpio_out);
> +}

It seems the compiler can calculate gpio_out value at compile time.
So I think caching it just make the function slower.

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>