public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv7 1/2] pwm: Add Allwinner SoC support
Date: Mon, 6 Oct 2014 15:24:05 +0200	[thread overview]
Message-ID: <20141006132404.GC26921@ulmo> (raw)
In-Reply-To: <1410983638-24915-2-git-send-email-alexandre.belloni@free-electrons.com>

On Wed, Sep 17, 2014 at 09:53:57PM +0200, Alexandre Belloni wrote:
[...]
> diff --git a/drivers/pwm/pwm-sunxi.c b/drivers/pwm/pwm-sunxi.c
> new file mode 100644
> index 000000000000..643f84ea013e
> --- /dev/null
> +++ b/drivers/pwm/pwm-sunxi.c
> @@ -0,0 +1,371 @@
> +/*
> + * Driver for Allwinner Pulse Width Modulation Controller
> + *
> + * Copyright (C) 2014 Alexandre Belloni <alexandre.belloni@free-electrons.com>

This is somewhat weird. So you are the copyright holder, not your
employer? The email address is somewhat misleading.

> +#define BIT_CH(bit, chan)	(bit << (chan * PWMCH_OFFSET))

bit and chan could use additional parentheses here for extra safety.

> +static const u32 prescaler_table[] = {
> +	120,
> +	180,
> +	240,
> +	360,
> +	480,
> +	0,
> +	0,
> +	0,
> +	12000,
> +	24000,
> +	36000,
> +	48000,
> +	72000,
> +	0,
> +	0,
> +	0, /* Actually 1 but tested separately */
> +};

Did I already mention that this was really weird?

> +static inline u32 sunxi_pwm_readl(struct sunxi_pwm_chip *chip,
> +				  unsigned long offset)
> +{
> +	return readl(chip->base + offset);
> +}
> +
> +

There's a gratuitous blank line here.

> +static int sunxi_pwm_probe(struct platform_device *pdev)
> +{
[...]
> +
> +	ret = pwmchip_add(&pwm->chip);
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "failed to add PWM chip %d\n", ret);

"chip: %d" to make it clear that it's not some kind of chip ID.

> +		goto error;
> +	}
> +
> +	ret = clk_prepare_enable(pwm->clk);
> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to enable PWM clock\n");
> +		goto error;

Don't you want to remove the stale PWM chip here? Why not do this at the
very end, after everything's been set up properly?

> +MODULE_ALIAS("platform:sunxi-pwm");
> +MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@free-electrons.com>");
> +MODULE_DESCRIPTION("Allwinner PWM driver");

Perhaps "Allwinner sunxi PWM driver"? Presumably Allwinner could at some
point release a different family of SoCs.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141006/086cee29/attachment-0001.sig>

  reply	other threads:[~2014-10-06 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 19:53 [PATCHv7 0/2] Add Allwinner SoCs PWM support Alexandre Belloni
2014-09-17 19:53 ` [PATCHv7 1/2] pwm: Add Allwinner SoC support Alexandre Belloni
2014-10-06 13:24   ` Thierry Reding [this message]
2014-10-06 14:30     ` Alexandre Belloni
2014-10-06 14:43       ` Alexandre Belloni
2014-10-06 14:48       ` Thierry Reding
2014-09-17 19:53 ` [PATCHv7 2/2] pwm: sunxi: document OF bindings Alexandre Belloni

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=20141006132404.GC26921@ulmo \
    --to=thierry.reding@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox