From: thierry.reding@avionic-design•de (Thierry Reding)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3] pwm: vt8500: Update vt8500 PWM driver support
Date: Wed, 24 Oct 2012 00:14:19 +0200 [thread overview]
Message-ID: <20121023221419.GA8501@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <1350929425-17516-1-git-send-email-linux@prisktech.co.nz>
On Tue, Oct 23, 2012 at 07:10:24AM +1300, Tony Prisk wrote:
[...]
> @@ -87,6 +98,11 @@ static int vt8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> {
> struct vt8500_chip *vt8500 = to_vt8500_chip(chip);
>
> + if (!clk_enable(vt8500->clk)) {
> + dev_err(chip->dev, "failed to enable clock\n");
> + return -EBUSY;
> + };
> +
I don't think that works. The clock API returns 0 on success and a
negative error code on failure. So this should rather be something like:
err = clk_enable(vt8500->clk);
if (err < 0) {
dev_err(chip->dev, "failed to enable clock: %d\n", err);
return err;
}
> @@ -123,6 +153,12 @@ static int __devinit pwm_probe(struct platform_device *pdev)
> chip->chip.ops = &vt8500_pwm_ops;
> chip->chip.base = -1;
> chip->chip.npwm = VT8500_NR_PWMS;
> + chip->clk = devm_clk_get(&pdev->dev, NULL);
> +
The blank line should go above the call to devm_clk_get().
> + if (IS_ERR_OR_NULL(chip->clk)) {
> + dev_err(&pdev->dev, "clock source not specified\n");
> + return PTR_ERR(chip->clk);
> + }
[...]
> + if (!clk_prepare(chip->clk)) {
> + dev_err(&pdev->dev, "failed to prepare clock\n");
> + return -EBUSY;
> + }
> +
Same comment here. I wonder how this code can work, since if the clock
is properly prepared, then it will return 0, and the above will return
-EBUSY.
> ret = pwmchip_add(&chip->chip);
> - if (ret < 0)
> + if (ret < 0) {
> + dev_err(&pdev->dev, "failed to add pwmchip\n");
Error messages can be considered prose, so this should be: "failed to
add PWM chip".
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121024/d37c6d31/attachment-0001.sig>
next prev parent reply other threads:[~2012-10-23 22:14 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 10:38 [PATCH 1/3] ARM: dts: Update board files for pwm support Tony Prisk
2012-10-19 10:38 ` [PATCH 2/3] PWM: vt8500: Update vt8500 PWM driver support Tony Prisk
2012-10-22 6:34 ` Thierry Reding
2012-10-22 6:51 ` Tony Prisk
2012-10-22 7:09 ` Tony Prisk
2012-10-22 7:24 ` Thierry Reding
2012-10-22 7:36 ` Tony Prisk
2012-10-22 8:04 ` Thierry Reding
2012-10-22 8:13 ` [PATCH v2] pwm: " Tony Prisk
2012-10-22 8:40 ` Thierry Reding
2012-10-22 18:10 ` [PATCH v3] " Tony Prisk
2012-10-23 22:14 ` Thierry Reding [this message]
2012-10-24 3:46 ` Tony Prisk
2012-10-24 5:41 ` Thierry Reding
2012-10-24 17:35 ` Tony Prisk
2012-10-24 3:48 ` Tony Prisk
2012-10-23 8:41 ` [PATCH 2/3] PWM: " Tony Prisk
2012-10-23 9:22 ` Thierry Reding
2012-10-23 9:31 ` Russell King - ARM Linux
2012-10-23 9:56 ` Thierry Reding
2012-10-22 7:11 ` Thierry Reding
2012-10-22 11:50 ` Arnd Bergmann
2012-10-22 12:07 ` Thierry Reding
2012-10-22 13:52 ` Arnd Bergmann
2012-10-22 15:08 ` Thierry Reding
2012-10-22 17:49 ` Tony Prisk
2012-10-19 10:38 ` [PATCH 3/3] DOC: PWM: Adding binding document for via,vt8500-pwm Tony Prisk
2012-10-22 6:35 ` Thierry Reding
2012-10-22 6:53 ` Tony Prisk
2012-10-19 22:37 ` [PATCH 1/3] ARM: dts: Update board files for pwm support Tony Prisk
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=20121023221419.GA8501@avionic-0098.mockup.avionic-design.de \
--to=thierry.reding@avionic-design$(echo .)de \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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