public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Takahiro AKASHI <akashi.tkhro@gmail.com>
Subject: Re: [RFC 3/7] pinctrl: introduce pinctrl_gpio_get_config()
Date: Mon, 5 May 2025 22:00:35 +0530	[thread overview]
Message-ID: <f59c3493-4630-4cf1-8d25-d4e9fbf23498@oracle.com> (raw)
In-Reply-To: <0e982ace876920162d27a521f5f460b1dd6fc929.1746443762.git.dan.carpenter@linaro.org>

Hi Dan,


Thanks for your patch.

On 05-05-2025 17:07, Dan Carpenter wrote:
> From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> 
> This is a counterpart of pinctrl_gpio_set_config(), which will initially
> be used to implement gpio_get interface in SCMI pinctrl based GPIO driver.
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/pinctrl/core.c           | 35 ++++++++++++++++++++++++++++++++
>   include/linux/pinctrl/consumer.h |  9 ++++++++
>   2 files changed, 44 insertions(+)
> 
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index 4bdbf6bb26e2..4310f9e2118b 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -30,6 +30,7 @@
>   #include <linux/pinctrl/consumer.h>
>   #include <linux/pinctrl/devinfo.h>
>   #include <linux/pinctrl/machine.h>
> +#include <linux/pinctrl/pinconf.h>
>   #include <linux/pinctrl/pinctrl.h>
>   
>   #include "core.h"
> @@ -937,6 +938,40 @@ int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
>   }
>   EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config);
>   
> +/**
> + * pinctrl_gpio_get_config() - Get the config for a given GPIO pin
> + * @gc: GPIO chip structure from the GPIO subsystem
> + * @offset: hardware offset of the GPIO relative to the controller
> +  * @config: the configuration to query.  On success it holds the result

remove extra ' ' before * @config and On.

> + */
> +int pinctrl_gpio_get_config(struct gpio_chip *gc, unsigned int offset, unsigned long *config)
> +{
> +	struct pinctrl_gpio_range *range;
> +	const struct pinconf_ops *ops;
> +	struct pinctrl_dev *pctldev;
> +	int ret, pin;
> +
> +	ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
> +	if (ret)
> +		return ret;
> +
> +	ops = pctldev->desc->confops;
> +	if (!ops || !ops->pin_config_get)
> +		return -EINVAL;
> +
> +	mutex_lock(&pctldev->mutex);
> +	pin = gpio_to_pin(range, gc, offset);
> +	ret = ops->pin_config_get(pctldev, pin, config);

can we add reason here, as now we are not calling pin_config_get_for_pin()

https://lore.kernel.org/all/20231002021602.260100-3-takahiro.akashi@linaro.org/

> +	mutex_unlock(&pctldev->mutex);
> +
> +	if (ret)
> +		return ret;
> +
> +	*config = pinconf_to_config_argument(*config);

a '\n' before return.

> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(pinctrl_gpio_get_config);
> +
>   static struct pinctrl_state *find_state(struct pinctrl *p,
>   					const char *name)
>   {


Thanks,
Alok


  reply	other threads:[~2025-05-05 16:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 11:36 [RFC 0/7] pinctrl-scmi: Add GPIO support Dan Carpenter
2025-05-05 11:37 ` [RFC 3/7] pinctrl: introduce pinctrl_gpio_get_config() Dan Carpenter
2025-05-05 16:30   ` ALOK TIWARI [this message]
2025-05-07 11:32     ` Dan Carpenter
2025-05-05 11:38 ` [RFC 4/7] pinctrl-scmi: add PIN_CONFIG_INPUT_VALUE Dan Carpenter
2025-05-05 11:39 ` [RFC 5/7] pinctrl: Delete PIN_CONFIG_OUTPUT_IMPEDANCE_OHMS support Dan Carpenter
2025-05-05 11:39 ` [RFC 6/7] pinctrl-scmi: Add GPIO support Dan Carpenter
2025-05-05 11:39 ` [RFC 7/7] pinctrl-scmi: remove unused struct member Dan Carpenter
2025-05-07  8:54 ` [RFC 0/7] pinctrl-scmi: Add GPIO support Khaled Ali Ahmed

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=f59c3493-4630-4cf1-8d25-d4e9fbf23498@oracle.com \
    --to=alok.a.tiwari@oracle.com \
    --cc=akashi.tkhro@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=dan.carpenter@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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