[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201311281737.32696.arnd@arndb.de>
Date: Thu, 28 Nov 2013 17:37:32 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Jonas Jensen <jonas.jensen@...il.com>
Cc: linux-gpio@...r.kernel.org, grant.likely@...aro.org,
linus.walleij@...aro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, arm@...nel.org, mark.rutland@....com,
devicetree@...r.kernel.org
Subject: Re: [PATCH v6] gpio: Add MOXA ART GPIO driver
On Thursday 28 November 2013, Jonas Jensen wrote:
> +static void __iomem *moxart_gpio_base;
Just one comment: the usual way to do such a driver is to have
a derived data structure like
struct moxart_gpio_chip {
struct gpio_chip chip;
void __iomem *moxart_gpio_base;
};
and dynamically allocate that from probe(), using container_of() to
get from the gpio_chip pointer to your own structure.
You obviously rely on the fact that there is only one gpio_chip
in a moxart soc, which is a safe assumption, the only real disadvantage
of your approach is that it makes your driver less suitable as an
example for others to look at when they are not dealing with
just a single instance, so decide for yourself whether you want
to change it or not.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists