Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1702049
| From | Belisko Marek <marek.belisko@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 2/5] power: generic-adc-battery: Parse more properties from DT |
| Date | 2017-08-02 14:00 +0200 |
| Message-ID | <ua0tI-Vn-27@gated-at.bofh.it> (permalink) |
| References | <u9MqK-nk-3@gated-at.bofh.it> <u9MqL-nk-29@gated-at.bofh.it> <ua0tI-Vn-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Pavel,
On Wed, Aug 2, 2017 at 1:56 PM, Pavel Machek <pavel@ucw.cz> wrote:
> 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.
You're right. I'll add bindings documentation. Thanks.
> Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
BR,
marek
--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer
Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 2/5] power: generic-adc-battery: Parse more properties from DT Marek Belisko <marek.belisko@open-nandra.com> - 2017-08-01 23:00 +0200 Re: [RFC PATCH 2/5] power: generic-adc-battery: Parse more properties from DT Belisko Marek <marek.belisko@gmail.com> - 2017-08-02 14:00 +0200 Re: [RFC PATCH 2/5] power: generic-adc-battery: Parse more properties from DT Pavel Machek <pavel@ucw.cz> - 2017-08-02 14:00 +0200
csiph-web