From: Jingoo Han <jg1.han@samsung.com>
To: "'Olof Johansson'" <olof@lixom.net>,
"'Richard Purdie'" <rpurdie@rpsys.net>
Cc: linux-kernel@vger.kernel.org, sameo@linux.intel.com,
"'Qing Xu'" <qingx@marvell.com>,
"'Haojian Zhuang'" <haojian.zhuang@gmail.com>,
linux-arm-kernel@lists.infradead.org, holt@sgi.com,
Andrew Morton <akpm@linux-foundation.org>,
Jingoo Han <jg1.han@samsung.com>
Subject: Re: [PATCH] mfd: max8925: fix dt code for backlight
Date: Thu, 25 Jul 2013 10:13:41 +0900 [thread overview]
Message-ID: <000401ce88d4$33773de0$9a65b9a0$@samsung.com> (raw)
In-Reply-To: <1374680547-5336-1-git-send-email-olof@lixom.net>
On Thursday, July 25, 2013 12:42 AM, Olof Johansson wrote:
>
> The device-tree enablement for max8925 has several problems, but besides
> the bindings being wrong (and not having seen review) there's also some
> bad coding practices on how to fill in the platform_data from device tree.
>
> I came across this since it causes a warning when compiling
> mmp2_defconfig, and instead of doing the minimal fix to silence the
> warning, I restructured the code a bit.
>
> This silences the warning:
> drivers/video/backlight/max8925_bl.c: In function 'max8925_backlight_probe':
> drivers/video/backlight/max8925_bl.c:177:3: warning: statement with no effect [-Wunused-value]
>
> Note that the bindings themselves need to be revisited too, but that will
> affect more than just the backlight driver and is best done separately;
> this just fixes the bad code for the backlight driver.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
> ---
>
> Richard, Jingoo, this would be good to see go into 3.11 if you're
> comfortable with it.
CC'ed Andrew Morton
Hi Olof Johansson,
Currently, there is not git tree for Backlight subsystem.
I hope that this would go into 3.11 through one of other trees
with my Ack.
If not, it will go into 3.12-rc1 through mm-tree.
Acked-by: Jingoo Han <jg1.han@samsung.com>
Best regards,
Jingoo Han
>
>
> -Olof
>
> drivers/video/backlight/max8925_bl.c | 41 +++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c
> index 5ca11b0..886e797 100644
> --- a/drivers/video/backlight/max8925_bl.c
> +++ b/drivers/video/backlight/max8925_bl.c
> @@ -101,33 +101,37 @@ static const struct backlight_ops max8925_backlight_ops = {
> .get_brightness = max8925_backlight_get_brightness,
> };
>
> -#ifdef CONFIG_OF
> -static int max8925_backlight_dt_init(struct platform_device *pdev,
> - struct max8925_backlight_pdata *pdata)
> +static void max8925_backlight_dt_init(struct platform_device *pdev)
> {
> struct device_node *nproot = pdev->dev.parent->of_node, *np;
> - int dual_string;
> + struct max8925_backlight_pdata *pdata;
> + u32 val;
> +
> + if (!nproot || !IS_ENABLED(CONFIG_OF))
> + return;
> +
> + pdata = devm_kzalloc(&pdev->dev,
> + sizeof(struct max8925_backlight_pdata),
> + GFP_KERNEL);
> + if (!pdata)
> + return;
>
> - if (!nproot)
> - return -ENODEV;
> np = of_find_node_by_name(nproot, "backlight");
> if (!np) {
> dev_err(&pdev->dev, "failed to find backlight node\n");
> - return -ENODEV;
> + return;
> }
>
> - of_property_read_u32(np, "maxim,max8925-dual-string", &dual_string);
> - pdata->dual_string = dual_string;
> - return 0;
> + if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val))
> + pdata->dual_string = val;
> +
> + pdev->dev.platform_data = pdata;
> }
> -#else
> -#define max8925_backlight_dt_init(x, y) (-1)
> -#endif
>
> static int max8925_backlight_probe(struct platform_device *pdev)
> {
> struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
> - struct max8925_backlight_pdata *pdata = pdev->dev.platform_data;
> + struct max8925_backlight_pdata *pdata;
> struct max8925_backlight_data *data;
> struct backlight_device *bl;
> struct backlight_properties props;
> @@ -170,13 +174,10 @@ static int max8925_backlight_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, bl);
>
> value = 0;
> - if (pdev->dev.parent->of_node && !pdata) {
> - pdata = devm_kzalloc(&pdev->dev,
> - sizeof(struct max8925_backlight_pdata),
> - GFP_KERNEL);
> - max8925_backlight_dt_init(pdev, pdata);
> - }
> + if (!pdev->dev.platform_data)
> + max8925_backlight_dt_init(pdev);
>
> + pdata = pdev->dev.platform_data;
> if (pdata) {
> if (pdata->lxw_scl)
> value |= (1 << 7);
> --
> 1.7.10.4
next prev parent reply other threads:[~2013-07-25 1:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 15:42 Olof Johansson
2013-07-25 1:13 ` Jingoo Han [this message]
2013-07-25 21:00 ` Olof Johansson
2013-07-25 23:17 ` Jingoo Han
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='000401ce88d4$33773de0$9a65b9a0$@samsung.com' \
--to=jg1.han@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=haojian.zhuang@gmail.com \
--cc=holt@sgi.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olof@lixom.net \
--cc=qingx@marvell.com \
--cc=rpurdie@rpsys.net \
--cc=sameo@linux.intel.com \
/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