lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sat, 27 Oct 2012 17:11:59 +0200
From:	Francesco Lavra <francescolavra.fl@...il.com>
To:	"Rajanikanth H.V" <rajanikanth.hv@...ricsson.com>
CC:	lee.jones@...aro.org, arnd@...db.de, anton.vorontsov@...aro.org,
	linus.walleij@...ricsson.com, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, linaro-dev@...ts.linaro.org,
	patches@...aro.org, STEricsson_nomadik_linux@...t.st.com
Subject: Re: [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg

On 10/25/2012 08:30 AM, Rajanikanth H.V wrote:
> From: "Rajanikanth H.V" <rajanikanth.hv@...ricsson.com>
> 
> This patch adds device tree support for charging algorithm
> driver
> 
> Signed-off-by: Rajanikanth H.V <rajanikanth.hv@...ricsson.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ