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:21:24 +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:
> This new patch caches addresses as suggested by Atsushi Nemoto

Well, I cannot remember any suggestion about caches.  I just said you
should kill all volatiles.

> +static inline int gpio_get_value(unsigned gpio)
> +{
> +     static unsigned addr;
> +
> +     if (!addr) {
> +             void __iomem *gpio_in = (void __iomem *)
> +                             KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_INPUT);
> +             addr = readl(gpio_in);
> +     }
> +
> +     return addr & (1 << gpio);
> +}

Anyway, this is absolutely broken.  You are caching the GPIO value,
not the address.

---
Atsushi Nemoto

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