[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170802115610.GC2765@amd>
Date: Wed, 2 Aug 2017 13:56:10 +0200
From: Pavel Machek <pavel@....cz>
To: Marek Belisko <marek.belisko@...n-nandra.com>
Cc: sre@...nel.org, robh+dt@...nel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, hns@...delico.com,
Marek Belisko <marek.belisko@...il.com>
Subject: Re: [RFC PATCH 2/5] power: generic-adc-battery: Parse more
properties from DT
Hi!
> +#ifdef CONFIG_OF
> +static struct gab_platform_data *gab_dt_probe(struct platform_device *pdev)
> +{
> + struct gab_platform_data *pdata;
> + struct device_node *np = pdev->dev.of_node;
> + const char *name;
> + u32 val;
> + int err;
> +
> + pdata = devm_kzalloc(&pdev->dev,
> + sizeof(struct gab_platform_data),
> + GFP_KERNEL);
> + if (!pdata)
> + return ERR_PTR(-ENOMEM);
> +
> + pdata->gpio_charge_finished = of_get_gpio(np, 0);
> +
> + /* parse and fill power_supply_info struct */
> + err = of_property_read_u32(np, "technology", &val);
> + if (err) {
> + dev_info(&pdev->dev, "Battery technology unknown\n");
> + val = 0;
> + }
> + pdata->battery_info.technology = val;
> +
> + err = of_property_read_string(np, "battery-name", &name);
> + if (err) {
> + dev_info(&pdev->dev, "Battery name empty, setting default\n");
> + }
> + pdata->battery_info.name = name;
Actually ... looking at this once more. These are new properties,
right?
They'll need to be documented:
pavel@duo:/data/l/linux$ grep -ri battery-name Documentation/devicetree/
shows empty.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists