linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: sameo@linux.intel.com, haojian.zhuang@gmail.com,
	linux-kernel@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 11/13] power_supply: max8925: use platform_data from cell
Date: Wed, 13 Apr 2011 19:03:24 +0400	[thread overview]
Message-ID: <20110413150324.GA16679@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1302706264-25815-12-git-send-email-haojian.zhuang@marvell.com>

On Wed, Apr 13, 2011 at 10:51:02PM +0800, Haojian Zhuang wrote:
> Avoid to get platform_data from parent device. Get it from mfd cell
> device instead.
> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> Cc: Anton Vorontsov <cbou@mail.ru>
> Cc: David Woodhouse <dwmw2@infradead.org>
> ---

I don't see the whole series, but I hope the patch doesn't break any
existing in-tree users of that driver?

>  drivers/power/max8925_power.c |   16 +++++-----------
>  1 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c
> index 8e5aec2..359c53c 100644
> --- a/drivers/power/max8925_power.c
> +++ b/drivers/power/max8925_power.c
> @@ -425,21 +425,16 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info)
>  static __devinit int max8925_power_probe(struct platform_device *pdev)
>  {
>  	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
> -	struct max8925_platform_data *max8925_pdata;
>  	struct max8925_power_pdata *pdata = NULL;
>  	struct max8925_power_info *info;
> -	int ret;
> -
> -	if (pdev->dev.parent->platform_data) {
> -		max8925_pdata = pdev->dev.parent->platform_data;
> -		pdata = max8925_pdata->power;
> -	}
> +	int ret = -EINVAL;

I guess you don't need the initializer.

>  
> -	if (!pdata) {
> +	pdata = pdev->dev.platform_data;
> +	if (pdata == NULL) {

I'd prefer to keep '!pdata'.

>  		dev_err(&pdev->dev, "platform data isn't assigned to "
>  			"power supply\n");
>  		return -EINVAL;
> -	}
> +	};

No need for the semicolon.

>  
>  	info = kzalloc(sizeof(struct max8925_power_info), GFP_KERNEL);
>  	if (!info)
> @@ -447,6 +442,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev)
>  	info->chip = chip;
>  	info->gpm = chip->i2c;
>  	info->adc = chip->adc;
> +	dev_set_drvdata(&pdev->dev, info);

As this is a platform driver, you'd better do platform_set_drvdata(pdev, info),
not dev_set_drvdata(). In the end, it's the same thing.

>  
>  	info->ac.name = "max8925-ac";
>  	info->ac.type = POWER_SUPPLY_TYPE_MAINS;
> @@ -482,8 +478,6 @@ static __devinit int max8925_power_probe(struct platform_device *pdev)
>  	info->topoff_threshold = pdata->topoff_threshold;
>  	info->fast_charge = pdata->fast_charge;
>  	info->set_charger = pdata->set_charger;
> -	dev_set_drvdata(&pdev->dev, info);
> -	platform_set_drvdata(pdev, info);
>  
>  	max8925_init_charger(chip, info);
>  	return 0;

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

  parent reply	other threads:[~2011-04-13 15:04 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2011041301>
2011-04-13 14:50 ` 1. Replace mfd_data with platform_data for 88pm860x since mfd tree is upgraded Haojian Zhuang
2011-04-13 14:50   ` [PATCH 01/13] input: touchscreen: use polling mode in 88pm860x Haojian Zhuang
2011-04-13 14:50     ` [PATCH 02/13] input: touchscreen: move initialization " Haojian Zhuang
2011-04-13 14:50       ` [PATCH 03/13] rtc: add 88pm860x rtc Haojian Zhuang
2011-04-13 14:50         ` [PATCH 04/13] input: set the long press detection in 88pm860x onkey Haojian Zhuang
2011-04-13 14:50           ` [PATCH 05/13] w1: add DS278x slave driver Haojian Zhuang
2011-04-13 14:50             ` [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control + DS1WM chip Haojian Zhuang
2011-04-13 14:50               ` [PATCH 07/13] mfd: fix build warning on 88pm860x Haojian Zhuang
2011-04-13 14:50                 ` [PATCH 08/13] mfd: use platform_data in max8925 Haojian Zhuang
2011-04-13 14:51                   ` [PATCH 09/13] input: get irq from resource in max8925 onkey Haojian Zhuang
2011-04-13 14:51                     ` [PATCH 10/13] rtc: avoid to use hardcoding irq number in max8925 Haojian Zhuang
2011-04-13 14:51                       ` [PATCH 11/13] power_supply: max8925: use platform_data from cell Haojian Zhuang
2011-04-13 14:51                         ` [PATCH 12/13] regulator: check name in initialization of max8925 Haojian Zhuang
2011-04-13 14:51                           ` [PATCH 13/13] regulator: max8925: enable i2c sequence for control Haojian Zhuang
2011-04-16 18:02                             ` Mark Brown
2011-04-16 18:01                           ` [PATCH 12/13] regulator: check name in initialization of max8925 Mark Brown
2011-04-18 13:49                             ` Haojian Zhuang
2011-04-13 15:03                         ` Anton Vorontsov [this message]
2011-04-14  2:26                           ` [PATCH 11/13] power_supply: max8925: use platform_data from cell Haojian Zhuang
2011-04-14  2:16                         ` Haojian Zhuang
2011-04-15  0:41                       ` [PATCH 10/13] rtc: avoid to use hardcoding irq number in max8925 Wanlong Gao
2011-04-15  0:35                   ` [PATCH 08/13] mfd: use platform_data " Wanlong Gao
2011-04-14 14:17               ` [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control + DS1WM chip Wanlong Gao
2011-04-14 14:21                 ` Haojian Zhuang
2011-04-14 14:29                   ` Wanlong Gao
2011-04-14 14:02     ` [PATCH 01/13] input: touchscreen: use polling mode in 88pm860x Wanlong Gao
2011-04-14 14:41       ` Haojian Zhuang
2011-04-14 14:52         ` Wanlong Gao
2011-04-16 12:46   ` Haojian Zhuang
2011-04-16 13:17     ` Wanlong Gao
2011-04-16 14:17     ` Valdis.Kletnieks
2011-04-18 13:12       ` Haojian Zhuang

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=20110413150324.GA16679@oksana.dev.rtsoft.ru \
    --to=cbouatmailru@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=haojian.zhuang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).