mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@nvidia.com>
To: Linus Walleij <linus.walleij@stericsson.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Barry Song <21cnbao@gmail.com>,
	Shawn Guo <shawn.guo@freescale.com>,
	Thomas Abraham <thomas.abraham@linaro.org>,
	Dong Aisheng <dong.aisheng@linaro.org>,
	Rajendra Nayak <rajendra.nayak@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: RE: [PATCH 2/2 v4] pinctrl: introduce generic pin config
Date: Wed, 30 Nov 2011 11:45:37 -0800	[thread overview]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF174FDAFF30@HQMAIL01.nvidia.com> (raw)
In-Reply-To: <1322160380-27711-1-git-send-email-linus.walleij@stericsson.com>

Linus Walleij wrote at Thursday, November 24, 2011 11:46 AM:
> This is a split-off from the earlier patch set which adds generic
> pin configuration for the pin controllers that want it. Since
> we may have a system with mixed generic and custom pin controllers,
> we pass a boolean in the pin controller ops vtable to indicate
> if it is generic.

> diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c

> +void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
...
> +	for(i = 0; i < ARRAY_SIZE(conf_items); i++) {
...
> +		/* We want to check out this parameter */
> +		config = (unsigned long) conf_items[i].param;

Don't you need to use to_config_packed() here?

> +		ret = pin_config_get(pctldev, pin, &config);
> +		/* These are legal errors */
> +		if (ret == -EINVAL || ret == -ENOTSUPP)
> +			continue;

Ah, I guess I see why you consider -ENOTSUPP an error that you don't want
to print to syslog. Maybe you should call _pin_config_get() here which
doesn't spew messages on -ENOTSUPP, but have the public pin_config_get()
function spew errors.

> +		if (ret) {
> +			seq_printf(s, "ERROR READING CONFIG SETTING %d ", i);
> +			continue;
> +		}
> +		/* Space between multiple configs */
> +		seq_puts(s, " ");
> +		seq_puts(s, conf_items[i].display);
> +		/* Print unit if available */
> +		if (conf_items[i].format && config != 0)
> +			seq_printf(s, " (%lu %s)", config,
> +				   conf_items[i].format);

Don't you need to use to_config_argument() here?

> diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c

> @@ -169,6 +169,8 @@ static void pinconf_dump_pin(struct pinctrl_dev *pctldev,
>  {
>  	const struct pinconf_ops *ops = pctldev->desc->confops;
> 
> +	/* no-op when not using generic pin config */
> +	pinconf_generic_dump_pin(pctldev, s, pin);
>  	if (ops && ops->pin_config_dbg_show)
>  		ops->pin_config_dbg_show(pctldev, s, pin);
>  }

This is really a comment on the previous patch, but what about config
params that only apply to groups?

> diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h

> +/*
> + * You shouldn't even be able to compile with these enums etc unless you're
> + * using generic pin config. That is why this is defined out.
> + */
> +#ifdef CONFIG_GENERIC_PINCONF

Hmm. I'd prefer to have drivers able to use both generic values and
extend them with custom values. Can't we just use the top bit of the
param value to indicate 0:standard (from the enum below) 1:custom
(something meaningful to only the individual pinctrl driver). This
could then trigger calling pinconf_generic_dump_pin() or not for
example.

> +#ifdef CONFIG_GENERIC_PINCONF
> +	bool is_generic;
> +#endif

... and get rid of that flag.

-- 
nvpublic


  reply	other threads:[~2011-11-30 19:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24 18:46 Linus Walleij
2011-11-30 19:45 ` Stephen Warren [this message]
2011-12-01 10:11   ` Linus Walleij
2011-12-01 17:16     ` Stephen Warren
2011-12-05 13:35       ` Linus Walleij
2011-12-05 15:37         ` Mark Brown
2011-12-05 17:51         ` Stephen Warren

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=74CDBE0F657A3D45AFBB94109FB122FF174FDAFF30@HQMAIL01.nvidia.com \
    --to=swarren@nvidia.com \
    --cc=21cnbao@gmail.com \
    --cc=dong.aisheng@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rajendra.nayak@linaro.org \
    --cc=shawn.guo@freescale.com \
    --cc=thomas.abraham@linaro.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

Powered by JetHome