All of lore.kernel.org
 help / color / mirror / Atom feed
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/12] pinctrl: basic Nomadik pinctrl interface
Date: Wed, 09 May 2012 14:34:51 -0600	[thread overview]
Message-ID: <4FAAD4EB.4010007@wwwdotorg.org> (raw)
In-Reply-To: <1336470270-23518-1-git-send-email-linus.walleij@stericsson.com>

On 05/08/2012 03:44 AM, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> This adds a scratch pin control interface to the Nomadik pinctrl
> driver, and defines the pins and groups in the DB8500 ASIC. We
> define GPIO ranges to cover the pins exposed. The DB8500 has
> more pins than this but we restrict the driver to the pins that
> can be controlled from the combined GPIO and pin control hardware
> to begin with.

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

> +static int nmk_list_groups(struct pinctrl_dev *pctldev, unsigned selector)
> +{
> +	struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
> +
> +	if (selector >= npct->soc->ngroups)
> +		return -EINVAL;

I think all the other drivers removed this error-checking from functions
called by the pinctrl core, assuming that the core would error-check any
user-supplied data and respect limits in the pinctrl device descriptor.

> +static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)

> +	/* Poke in other ASIC variants here */
> +	if (platid->driver_data == PINCTRL_NMK_DB8500)
> +		nmk_pinctrl_db8500_init(&npct->soc);

Other platforms have a unique top-level driver for each variant, with
the probe() function for each variant calling into a utility function.
That way, the common/utility code doesn't need to contain a
table/list/... of all the variants. Can the same approach be used here?

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren@wwwdotorg.org>
To: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Stephen Warren <swarren@nvidia.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>,
	Haojian Zhuang <haojian.zhuang@marvell.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH 02/12] pinctrl: basic Nomadik pinctrl interface
Date: Wed, 09 May 2012 14:34:51 -0600	[thread overview]
Message-ID: <4FAAD4EB.4010007@wwwdotorg.org> (raw)
In-Reply-To: <1336470270-23518-1-git-send-email-linus.walleij@stericsson.com>

On 05/08/2012 03:44 AM, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> This adds a scratch pin control interface to the Nomadik pinctrl
> driver, and defines the pins and groups in the DB8500 ASIC. We
> define GPIO ranges to cover the pins exposed. The DB8500 has
> more pins than this but we restrict the driver to the pins that
> can be controlled from the combined GPIO and pin control hardware
> to begin with.

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

> +static int nmk_list_groups(struct pinctrl_dev *pctldev, unsigned selector)
> +{
> +	struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
> +
> +	if (selector >= npct->soc->ngroups)
> +		return -EINVAL;

I think all the other drivers removed this error-checking from functions
called by the pinctrl core, assuming that the core would error-check any
user-supplied data and respect limits in the pinctrl device descriptor.

> +static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)

> +	/* Poke in other ASIC variants here */
> +	if (platid->driver_data == PINCTRL_NMK_DB8500)
> +		nmk_pinctrl_db8500_init(&npct->soc);

Other platforms have a unique top-level driver for each variant, with
the probe() function for each variant calling into a utility function.
That way, the common/utility code doesn't need to contain a
table/list/... of all the variants. Can the same approach be used here?

  reply	other threads:[~2012-05-09 20:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08  9:44 [PATCH 02/12] pinctrl: basic Nomadik pinctrl interface Linus Walleij
2012-05-08  9:44 ` Linus Walleij
2012-05-09 20:34 ` Stephen Warren [this message]
2012-05-09 20:34   ` Stephen Warren
2012-05-10 15:10   ` Linus Walleij
2012-05-10 15:10     ` Linus Walleij
2012-05-10 15:12     ` Linus Walleij
2012-05-10 15:12       ` Linus Walleij
2012-05-10 15:53       ` Arnd Bergmann
2012-05-10 15:53         ` Arnd Bergmann
2012-05-10 15:57         ` Arnd Bergmann
2012-05-10 15:57           ` Arnd Bergmann
2012-05-11  7:12   ` Linus Walleij
2012-05-11  7:12     ` Linus Walleij

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=4FAAD4EB.4010007@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=linux-arm-kernel@lists.infradead.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.