linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@avionic-design.de>
To: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Koen Kooi <koen@dominion.thruhere.net>,
	Matt Porter <mporter@ti.com>, Russ Dill <Russ.Dill@ti.com>,
	linux-omap@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] pwm-backlight: Pinctrl-fy
Date: Fri, 9 Nov 2012 09:06:04 +0100	[thread overview]
Message-ID: <20121109080604.GA25611@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <1351699047-4487-1-git-send-email-panto@antoniou-consulting.com>

[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

On Wed, Oct 31, 2012 at 05:57:27PM +0200, Pantelis Antoniou wrote:
> Enable pinctrl for pwm-backlight.
> 
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> ---
>  drivers/video/backlight/pwm_bl.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 0c91023..f3b6194 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -20,6 +20,8 @@
>  #include <linux/pwm.h>
>  #include <linux/pwm_backlight.h>
>  #include <linux/slab.h>
> +#include <linux/pinctrl/consumer.h>
> +#include <linux/err.h>
>  
>  struct pwm_bl_data {
>  	struct pwm_device	*pwm;
> @@ -180,9 +182,14 @@ static int pwm_backlight_probe(struct platform_device *pdev)
>  	struct backlight_properties props;
>  	struct backlight_device *bl;
>  	struct pwm_bl_data *pb;
> +	struct pinctrl *pinctrl;
>  	unsigned int max;
>  	int ret;
>  
> +	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> +	if (IS_ERR(pinctrl))
> +		dev_warn(&pdev->dev, "unable to select pin group\n");
> +

I just saw this done in a similar way in some other driver and then
remembered your patch. When I reviewed this I wasn't sure if a warning
was good enough in this case. I've checked the kernel tree and it seems
like a majority handled this as failure instead of a warning. I took a
look at the pinctrl core and it seems like indeed if neither pinctrl is
enabled or if there isn't actually a pinmux configuration for a device,
then devm_pinctrl_get_select_default() will actually not return an
error, so in those cases where an error is returned it should actually
be handled as a fatal error.

I'm Cc'ing Linus Walleij, maybe he knows what to do.

Thierry

>  	if (!data) {
>  		ret = pwm_backlight_parse_dt(&pdev->dev, &defdata);
>  		if (ret < 0) {
> -- 
> 1.7.12
> 
> 
> 

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-11-09  8:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 15:57 [PATCH] pwm-backlight: Pinctrl-fy Pantelis Antoniou
2012-11-05  7:33 ` Thierry Reding
2012-11-09  8:06 ` Thierry Reding [this message]
2012-11-11 18:26   ` Linus Walleij
2012-11-12 10:21     ` Pantelis Antoniou

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=20121109080604.GA25611@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=FlorianSchandinat@gmx.de \
    --cc=Russ.Dill@ti.com \
    --cc=koen@dominion.thruhere.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mporter@ti.com \
    --cc=panto@antoniou-consulting.com \
    --cc=rpurdie@rpsys.net \
    /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;
as well as URLs for NNTP newsgroup(s).