mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpio: regmap: move struct gpio_regmap definition
Date: Tue, 02 Mar 2021 19:10:50 +0100	[thread overview]
Message-ID: <b4a344af55ad238a554c56e31b1b87ed@walle.cc> (raw)
In-Reply-To: <20210302180601.12082-1-noltari@gmail.com>

Hi,

Am 2021-03-02 19:06, schrieb Álvaro Fernández Rojas:
> struct gpio_regmap should be declared in gpio/regmap.h.
> This way other drivers can access the structure data when registering a 
> gpio
> regmap controller.

The intention was really to keep this private to the gpio-regmap
driver. Why do you need to access to the properties?

-michael

> Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using 
> regmap")
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
>  drivers/gpio/gpio-regmap.c  | 20 ------------------
>  include/linux/gpio/regmap.h | 41 ++++++++++++++++++++++++++++++++++++-
>  2 files changed, 40 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index 5412cb3b0b2a..23b0a8572f53 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -11,26 +11,6 @@
>  #include <linux/module.h>
>  #include <linux/regmap.h>
> 
> -struct gpio_regmap {
> -	struct device *parent;
> -	struct regmap *regmap;
> -	struct gpio_chip gpio_chip;
> -
> -	int reg_stride;
> -	int ngpio_per_reg;
> -	unsigned int reg_dat_base;
> -	unsigned int reg_set_base;
> -	unsigned int reg_clr_base;
> -	unsigned int reg_dir_in_base;
> -	unsigned int reg_dir_out_base;
> -
> -	int (*reg_mask_xlate)(struct gpio_regmap *gpio, unsigned int base,
> -			      unsigned int offset, unsigned int *reg,
> -			      unsigned int *mask);
> -
> -	void *driver_data;
> -};
> -
>  static unsigned int gpio_regmap_addr(unsigned int addr)
>  {
>  	if (addr == GPIO_REGMAP_ADDR_ZERO)
> diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
> index ad76f3d0a6ba..ce2fc6e9b62b 100644
> --- a/include/linux/gpio/regmap.h
> +++ b/include/linux/gpio/regmap.h
> @@ -4,13 +4,52 @@
>  #define _LINUX_GPIO_REGMAP_H
> 
>  struct device;
> -struct gpio_regmap;
>  struct irq_domain;
>  struct regmap;
> 
>  #define GPIO_REGMAP_ADDR_ZERO ((unsigned int)(-1))
>  #define GPIO_REGMAP_ADDR(addr) ((addr) ? : GPIO_REGMAP_ADDR_ZERO)
> 
> +/**
> + * struct gpio_regmap - GPIO regmap controller
> + * @parent:		The parent device
> + * @regmap:		The regmap used to access the registers
> + *			given, the name of the device is used
> + * @gpio_chip:		GPIO chip controller
> + * @ngpio_per_reg:	Number of GPIOs per register
> + * @reg_stride:		(Optional) May be set if the registers (of the
> + *			same type, dat, set, etc) are not consecutive.
> + * @reg_dat_base:	(Optional) (in) register base address
> + * @reg_set_base:	(Optional) set register base address
> + * @reg_clr_base:	(Optional) clear register base address
> + * @reg_dir_in_base:	(Optional) in setting register base address
> + * @reg_dir_out_base:	(Optional) out setting register base address
> + * @reg_mask_xlate:     (Optional) Translates base address and GPIO
> + *			offset to a register/bitmask pair. If not
> + *			given the default gpio_regmap_simple_xlate()
> + *			is used.
> + * @driver_data:	(Optional) driver-private data
> + */
> +struct gpio_regmap {
> +	struct device *parent;
> +	struct regmap *regmap;
> +	struct gpio_chip gpio_chip;
> +
> +	int reg_stride;
> +	int ngpio_per_reg;
> +	unsigned int reg_dat_base;
> +	unsigned int reg_set_base;
> +	unsigned int reg_clr_base;
> +	unsigned int reg_dir_in_base;
> +	unsigned int reg_dir_out_base;
> +
> +	int (*reg_mask_xlate)(struct gpio_regmap *gpio, unsigned int base,
> +			      unsigned int offset, unsigned int *reg,
> +			      unsigned int *mask);
> +
> +	void *driver_data;
> +};
> +
>  /**
>   * struct gpio_regmap_config - Description of a generic regmap 
> gpio_chip.
>   * @parent:		The parent device

  reply	other threads:[~2021-03-02 21:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 18:06 Álvaro Fernández Rojas
2021-03-02 18:10 ` Michael Walle [this message]
2021-03-02 18:14   ` Álvaro Fernández Rojas
2021-03-02 19:24     ` Michael Walle
2021-03-02 19:52       ` Álvaro Fernández Rojas
2021-03-02 22:39     ` Linus Walleij
2021-03-03  7:05       ` Álvaro Fernández Rojas

Reply instructions:

You may reply publicly 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=b4a344af55ad238a554c56e31b1b87ed@walle.cc \
    --to=michael@walle.cc \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noltari@gmail.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®