linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: francescolavra.fl@gmail.com (Francesco Lavra)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg
Date: Sat, 27 Oct 2012 17:11:59 +0200	[thread overview]
Message-ID: <508BF9BF.4080602@gmail.com> (raw)
In-Reply-To: <1351146654-9110-5-git-send-email-rajanikanth.hv@stericsson.com>

On 10/25/2012 08:30 AM, Rajanikanth H.V wrote:
> From: "Rajanikanth H.V" <rajanikanth.hv@stericsson.com>
> 
> This patch adds device tree support for charging algorithm
> driver
> 
> Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
[...]
> diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
> index 88b5cc1..829fcfd 100644
> --- a/drivers/power/abx500_chargalg.c
> +++ b/drivers/power/abx500_chargalg.c
> @@ -21,6 +21,8 @@
>  #include <linux/completion.h>
>  #include <linux/workqueue.h>
>  #include <linux/kobject.h>
> +#include <linux/of.h>
> +#include <linux/mfd/core.h>
>  #include <linux/mfd/abx500.h>
>  #include <linux/mfd/abx500/ux500_chargalg.h>
>  #include <linux/mfd/abx500/ab8500-bm.h>
> @@ -231,7 +233,6 @@ struct abx500_chargalg {
>  	struct abx500_chargalg_charger_info chg_info;
>  	struct abx500_chargalg_battery_data batt_data;
>  	struct abx500_chargalg_suspension_status susp_status;
> -	struct abx500_bmdevs_plat_data *pdata;

pdata should be removed from the description of the struct members as well.

>  	struct abx500_bm_data *bat;
>  	struct power_supply chargalg_psy;
>  	struct ux500_charger *ac_chg;
> @@ -1795,25 +1796,45 @@ static int __devexit abx500_chargalg_remove(struct platform_device *pdev)
>  	flush_scheduled_work();
>  	power_supply_unregister(&di->chargalg_psy);
>  	platform_set_drvdata(pdev, NULL);
> -	kfree(di);
>  
>  	return 0;
>  }
>  
> +static char *supply_interface[] = {
> +	"ab8500_fg",
> +};
> +
>  static int __devinit abx500_chargalg_probe(struct platform_device *pdev)
>  {
> -	struct abx500_bmdevs_plat_data *plat_data;
> +	struct device_node *np = pdev->dev.of_node;
> +	struct abx500_chargalg *di;
>  	int ret = 0;
>  
> -	struct abx500_chargalg *di =
> -		kzalloc(sizeof(struct abx500_chargalg), GFP_KERNEL);
> -	if (!di)
> +	di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
> +	if (!di) {
> +		dev_err(&pdev->dev, "%s no mem for ab8500_chargalg\n", __func__);
>  		return -ENOMEM;
> +	}
> +	di->bat = pdev->mfd_cell->platform_data;
> +	if (!di->bat) {
> +		if (np) {
> +			ret = bmdevs_of_probe(&pdev->dev, np, &di->bat);
> +			if (ret) {
> +				dev_err(&pdev->dev,
> +					"failed to get battery information\n");
> +				return ret;
> +			}
> +		} else {
> +			dev_err(&pdev->dev, "missing dt node for ab8500_chargalg\n");
> +			return -EINVAL;
> +		}
> +	} else {
> +		dev_info(&pdev->dev, "falling back to legacy platform data\n");
> +		printk("%s falling back to legacy platform data\n", __func__);

You forgot to remove the printk() call.

--
Francesco

  reply	other threads:[~2012-10-27 15:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25  6:30 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-10-25  6:30 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-10-27 15:07   ` Francesco Lavra
2012-10-27 16:00     ` Rajanikanth HV
2012-10-27 16:18       ` Francesco Lavra
2012-10-25  6:30 ` [PATCH 2/4] mfd: ab8500: add devicetree support for btemp Rajanikanth H.V
2012-10-27 15:08   ` Francesco Lavra
2012-10-25  6:30 ` [PATCH 3/4] mfd: ab8500: add devicetree support for charger Rajanikanth H.V
2012-10-27 15:10   ` Francesco Lavra
2012-10-25  6:30 ` [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg Rajanikanth H.V
2012-10-27 15:11   ` Francesco Lavra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-10-31 15:40 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-10-31 15:40 ` [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg Rajanikanth H.V
2012-11-22 18:43 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-11-22 18:43 ` [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg Rajanikanth H.V

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=508BF9BF.4080602@gmail.com \
    --to=francescolavra.fl@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;
as well as URLs for NNTP newsgroup(s).