public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@avionic-design.de>
To: Chao Xie <chao.xie@marvell.com>
Cc: linux-kernel@vger.kernel.org, xiechao.mail@gmail.com
Subject: Re: [PATCH 3/3] pwm: pxa: add device tree support
Date: Thu, 18 Apr 2013 10:03:29 +0200	[thread overview]
Message-ID: <20130418080329.GA18212@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <1366095115-21864-4-git-send-email-chao.xie@marvell.com>

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

On Tue, Apr 16, 2013 at 02:51:55AM -0400, Chao Xie wrote:
> Add the deice tree support for pwm-pxa.

"device" and you can drop "the".

>  drivers/pwm/pwm-pxa.c |   31 ++++++++++++++++++++++++++++++-
>  1 files changed, 30 insertions(+), 1 deletions(-)

This is missing a file in Documentation/devicetree/bindings/pwm that
describe the device tree bindings for this driver.

> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
[...]
> +static struct of_device_id pxa_pwm_of_match[] = {

I know not all drivers do this, but this should be "static const".

> +	{
> +		.compatible = "mrvl,pxa25x-pwm",

According to Documentation/devicetree/bindings/vendor-prefixes.txt the
vendor prefix for Marvell is "marvell".

> +		.data = (void *)0

Initialization to 0 is redundant here.

>  static int pwm_probe(struct platform_device *pdev)
>  {
>  	const struct platform_device_id *id = platform_get_device_id(pdev);
> +	const struct of_device_id *of_id =
> +			of_match_device(pxa_pwm_of_match, &pdev->dev);
>  	struct pxa_pwm_chip *pwm;
>  	struct resource *r;
>  	int ret = 0;
> +	unsigned int npwm;
>  
>  	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>  	if (pwm == NULL) {
> @@ -157,7 +181,12 @@ static int pwm_probe(struct platform_device *pdev)
>  	pwm->chip.dev = &pdev->dev;
>  	pwm->chip.ops = &pxa_pwm_ops;
>  	pwm->chip.base = -1;
> -	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
> +	if (of_id)
> +		npwm = (unsigned int)(of_id->data);
> +	else
> +		npwm = id->driver_data;
> +
> +	pwm->chip.npwm = (npwm & HAS_SECONDARY_PWM) ? 2 : 1;

Can you rebase this on my for-next branch since it has some patches that
this conflicts with.

Also I think this patch is missing the assignment of

	.of_match_table = pxa_pwm_of_match;

in the platform_driver structure initialization. And I think PXA hasn't
been fully converted to OF-only, so you need to conditionalize the OF
bits.

Thierry

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

      reply	other threads:[~2013-04-18  8:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16  6:51 [PATCH 0/3] pwm: pxa: bug fix and device tree support Chao Xie
2013-04-16  6:51 ` [PATCH 1/3] pwm: pxa: ARCH_MMP share same pwm driver with ARCH_PXA Chao Xie
2013-04-16  6:51 ` [PATCH 2/3] pwm: pxa: use module_platform_driver for driver register Chao Xie
2013-04-16  6:51 ` [PATCH 3/3] pwm: pxa: add device tree support Chao Xie
2013-04-18  8:03   ` Thierry Reding [this message]

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=20130418080329.GA18212@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=chao.xie@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiechao.mail@gmail.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