Linux-GPIO Archive on lore.kernel.org
 help / color / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: soc@kernel.org, arm-soc <linux-arm-kernel@lists.infradead.org>,
	Vladimir Zapolskiy <vz@mleia.com>,
	Sylvain Lemieux <slemieux.tyco@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Gregory Clement <gregory.clement@bootlin.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-gpio <linux-gpio@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>,
	linux-serial@vger.kernel.org,
	USB list <linux-usb@vger.kernel.org>,
	LINUXWATCHDOG <linux-watchdog@vger.kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 05/14] gpio: lpc32xx: allow building on non-lpc32xx targets
Date: Fri, 9 Aug 2019 16:18:43 +0200
Message-ID: <CAK8P3a1NT_yoP39y52oJTMsFCb96-bRyuMm=+5HPPsxyq0fJDA@mail.gmail.com> (raw)
In-Reply-To: <CAMpxmJUdSnp0QNwWB0rJ1opFrYs9R2KSVS64Tz8X5GDYAJYLpg@mail.gmail.com>

On Mon, Aug 5, 2019 at 10:28 AM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
>
> pt., 2 sie 2019 o 13:20 Arnd Bergmann <arnd@arndb.de> napisał(a):
> >
> > On Fri, Aug 2, 2019 at 9:10 AM Bartosz Golaszewski
> > <bgolaszewski@baylibre.com> wrote:
> > > > -#include <mach/hardware.h>
> > > > -#include <mach/platform.h>
> > > > +#define _GPREG(x)                              (x)
> > >
> > > What purpose does this macro serve?
> > >
> > > >
> > > >  #define LPC32XX_GPIO_P3_INP_STATE              _GPREG(0x000)
> > > >  #define LPC32XX_GPIO_P3_OUTP_SET               _GPREG(0x004)
> >
> > In the existing code base, this macro converts a register offset to
> > an __iomem pointer for a gpio register. I changed the definition of the
> > macro here to keep the number of changes down, but I it's just
> > as easy to remove it if you prefer.
>
> Could you just add a comment so that it's clear at first glance?

I ended up removing the macro. With the change to keep the reg_base as
a struct member, this ends up being a relatively small change, and it's
more straightforward that way.

> > > > @@ -167,14 +166,26 @@ struct lpc32xx_gpio_chip {
> > > >         struct gpio_regs        *gpio_grp;
> > > >  };
> > > >
> > > > +void __iomem *gpio_reg_base;
> > >
> > > Any reason why this can't be made part of struct lpc32xx_gpio_chip?
> >
> > It could be, but it's the same for each instance, and not known until
> > probe() time, so the same pointer would need to be copied into each
> > instance that is otherwise read-only.
> >
> > Let me know if you'd prefer me to rework these two things or leave
> > them as they are.
>
> I would prefer not to have global state in the driver, let's just
> store the pointer in the data passed to gpiochip_add_data().

Ok, done.

       Arnd

  reply index

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 19:56 [PATCH 00/14] ARM: move lpc32xx and dove to multiplatform Arnd Bergmann
2019-07-31 19:56 ` [PATCH 01/14] usb: ohci-nxp: enable compile-testing Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-07-31 19:56 ` [PATCH 02/14] usb: udc: lpc32xx: allow compile-testing Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-08-05 12:47     ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 03/14] watchdog: pnx4008_wdt: " Arnd Bergmann
2019-07-31 20:23   ` Guenter Roeck
2019-07-31 20:26     ` Arnd Bergmann
2019-07-31 20:36       ` Guenter Roeck
2019-08-05 12:42         ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 04/14] serial: lpc32xx_hs: " Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-08-05 12:43     ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 05/14] gpio: lpc32xx: allow building on non-lpc32xx targets Arnd Bergmann
2019-08-02  7:10   ` Bartosz Golaszewski
2019-08-02 11:19     ` Arnd Bergmann
2019-08-05  8:27       ` Bartosz Golaszewski
2019-08-09 14:18         ` Arnd Bergmann [this message]
2019-08-06 20:02   ` Sylvain Lemieux
2019-08-09 14:19     ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 06/14] net: lpc-enet: factor out iram access Arnd Bergmann
2019-07-31 19:56 ` [PATCH 07/14] net: lpc-enet: move phy setup into platform code Arnd Bergmann
2019-08-06 20:11   ` Sylvain Lemieux
2019-08-06 20:12   ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 08/14] net: lpc-enet: allow compile testing Arnd Bergmann
2019-08-06 20:13   ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 09/14] serial: lpc32xx: " Arnd Bergmann
2019-08-01  5:59   ` Greg Kroah-Hartman
2019-07-31 19:56 ` [PATCH 10/14] ARM: lpc32xx: clean up header files Arnd Bergmann
2019-08-06 20:16   ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 11/14] ARM: lpc32xx: allow multiplatform build Arnd Bergmann
2019-07-31 19:56 ` [PATCH 12/14] ARM: dove: clean up mach/*.h headers Arnd Bergmann
2019-07-31 19:56 ` [PATCH 13/14] ARM: orion/mvebu: unify debug-ll virtual addresses Arnd Bergmann
2019-07-31 19:56 ` [PATCH 14/14] ARM: dove: multiplatform support Arnd Bergmann
2019-07-31 22:53 ` [PATCH 00/14] ARM: move lpc32xx and dove to multiplatform Russell King - ARM Linux admin
2019-08-01  7:33   ` Arnd Bergmann
2019-08-15 13:11     ` Arnd Bergmann
2019-08-15 18:32       ` Sylvain Lemieux
2019-08-15 19:38         ` Arnd Bergmann

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK8P3a1NT_yoP39y52oJTMsFCb96-bRyuMm=+5HPPsxyq0fJDA@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=andrew@lunn.ch \
    --cc=bgolaszewski@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=slemieux.tyco@gmail.com \
    --cc=soc@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=vz@mleia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-GPIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-gpio/0 linux-gpio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-gpio linux-gpio/ https://lore.kernel.org/linux-gpio \
		linux-gpio@vger.kernel.org linux-gpio@archiver.kernel.org
	public-inbox-index linux-gpio


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-gpio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox