All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Dario Binacchi <dariobin@libero.it>
Cc: linux-kernel@vger.kernel.org,
	Haojian Zhuang <haojian.zhuang@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH v2 2/2] pinctrl: single: set pinmux from pins debug file
Date: Tue, 18 May 2021 09:05:23 +0300	[thread overview]
Message-ID: <YKNZIzyO5Q/XGLRs@atomide.com> (raw)
In-Reply-To: <20210517200002.6316-3-dariobin@libero.it>

Hi,

I noticed few more things I started to wonder about after
looking at this again.

* Dario Binacchi <dariobin@libero.it> [210517 20:00]:
> +static int pcs_pin_dbg_set(struct pinctrl_dev *pctldev, unsigned int pin,
> +			   char *buf)
> +{
> +	struct pcs_device *pcs;
> +	unsigned int val, mux_bytes;
> +
> +	buf = skip_spaces(buf);
> +	if (kstrtouint(buf, 0, &val))
> +		return -EINVAL;
> +
> +	pcs = pinctrl_dev_get_drvdata(pctldev);
> +
> +	mux_bytes = pcs->width / BITS_PER_BYTE;
> +	pcs->write(val, pcs->base + pin * mux_bytes);
> +	return 0;
> +}

Since you're adding a new interface, how about pass unsigned
int val instead of char *buf?

>  static void pcs_dt_free_map(struct pinctrl_dev *pctldev,
>  				struct pinctrl_map *map, unsigned num_maps)
>  {
> @@ -331,6 +348,9 @@ static const struct pinctrl_ops pcs_pinctrl_ops = {
>  	.get_group_name = pinctrl_generic_get_group_name,
>  	.get_group_pins = pinctrl_generic_get_group_pins,
>  	.pin_dbg_show = pcs_pin_dbg_show,
> +#if IS_ENABLED(CONFIG_DEVMEM)
> +	.pin_dbg_set = pcs_pin_dbg_set,
> +#endif
>  	.dt_node_to_map = pcs_dt_node_to_map,
>  	.dt_free_map = pcs_dt_free_map,
>  };

It might be better to always have the .pin_dbg_set around to
avoid the IS_ENABLED(CONFIG_DEVMEM).

Does the new interface need something under Documentation too?

Regards,

Tony

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Dario Binacchi <dariobin@libero.it>
Cc: linux-kernel@vger.kernel.org,
	Haojian Zhuang <haojian.zhuang@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH v2 2/2] pinctrl: single: set pinmux from pins debug file
Date: Tue, 18 May 2021 09:05:23 +0300	[thread overview]
Message-ID: <YKNZIzyO5Q/XGLRs@atomide.com> (raw)
In-Reply-To: <20210517200002.6316-3-dariobin@libero.it>

Hi,

I noticed few more things I started to wonder about after
looking at this again.

* Dario Binacchi <dariobin@libero.it> [210517 20:00]:
> +static int pcs_pin_dbg_set(struct pinctrl_dev *pctldev, unsigned int pin,
> +			   char *buf)
> +{
> +	struct pcs_device *pcs;
> +	unsigned int val, mux_bytes;
> +
> +	buf = skip_spaces(buf);
> +	if (kstrtouint(buf, 0, &val))
> +		return -EINVAL;
> +
> +	pcs = pinctrl_dev_get_drvdata(pctldev);
> +
> +	mux_bytes = pcs->width / BITS_PER_BYTE;
> +	pcs->write(val, pcs->base + pin * mux_bytes);
> +	return 0;
> +}

Since you're adding a new interface, how about pass unsigned
int val instead of char *buf?

>  static void pcs_dt_free_map(struct pinctrl_dev *pctldev,
>  				struct pinctrl_map *map, unsigned num_maps)
>  {
> @@ -331,6 +348,9 @@ static const struct pinctrl_ops pcs_pinctrl_ops = {
>  	.get_group_name = pinctrl_generic_get_group_name,
>  	.get_group_pins = pinctrl_generic_get_group_pins,
>  	.pin_dbg_show = pcs_pin_dbg_show,
> +#if IS_ENABLED(CONFIG_DEVMEM)
> +	.pin_dbg_set = pcs_pin_dbg_set,
> +#endif
>  	.dt_node_to_map = pcs_dt_node_to_map,
>  	.dt_free_map = pcs_dt_free_map,
>  };

It might be better to always have the .pin_dbg_set around to
avoid the IS_ENABLED(CONFIG_DEVMEM).

Does the new interface need something under Documentation too?

Regards,

Tony

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-05-18  6:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 20:00 [PATCH v2 0/2] am335x: set pinmux registers from pins debug file Dario Binacchi
2021-05-17 20:00 ` Dario Binacchi
2021-05-17 20:00 ` [PATCH v2 1/2] pinctrl: core: configure pinmux " Dario Binacchi
2021-05-19 11:29   ` Andy Shevchenko
2021-05-17 20:00 ` [PATCH v2 2/2] pinctrl: single: set " Dario Binacchi
2021-05-17 20:00   ` Dario Binacchi
2021-05-18  6:05   ` Tony Lindgren [this message]
2021-05-18  6:05     ` Tony Lindgren
2021-05-18  8:57     ` Dario Binacchi
2021-05-18  8:57       ` Dario Binacchi
2021-05-21  9:25       ` Tony Lindgren
2021-05-21  9:25         ` Tony Lindgren
2021-05-19 11:31 ` [PATCH v2 0/2] am335x: set pinmux registers " Andy Shevchenko
2021-05-19 11:31   ` Andy Shevchenko

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=YKNZIzyO5Q/XGLRs@atomide.com \
    --to=tony@atomide.com \
    --cc=dariobin@libero.it \
    --cc=haojian.zhuang@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-omap@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.