From: Rajanikanth HV <rajanikanth.hv@stericsson.com>
To: Francesco Lavra <francescolavra.fl@gmail.com>
Cc: Rajanikanth H V <rajanikanth.hv@linaro.org>,
"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
"lee.jones@linaro.org" <lee.jones@linaro.org>,
"arnd@arndb.de" <arnd@arndb.de>,
"anton.vorontsov@linaro.org" <anton.vorontsov@linaro.org>,
Linus WALLEIJ <linus.walleij@stericsson.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linaro-dev@lists.linaro.org" <linaro-dev@lists.linaro.org>,
"patches@linaro.org" <patches@linaro.org>,
STEricsson_nomadik_linux <STEricsson_nomadik_linux@list.st.com>
Subject: Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge
Date: Thu, 15 Nov 2012 17:04:58 +0530 [thread overview]
Message-ID: <50A4D362.5060402@stericsson.com> (raw)
In-Reply-To: <509E8694.7080609@gmail.com>
On Saturday 10 November 2012 10:23 PM, Francesco Lavra wrote:
>>> I don't get the point of declaring the char array and copying the string
>>> in it, when you could simply use just the pointer returned by
>>> of_get_property().
>>
>> I am considering a corner case where in 'battery-type' property is not
>> present and battery is connected.In this case i promote battery to
>> UNKNOWN from null.
>
> You could achieve the same result without using the char array, with
> this assignment:
>
> btech = "UNKNOWN";
>
>> FYI: Further, btemp driver will identify the connected battery based on
>> resistance value and decide to use.
>> Ref: ab8500_btemp_id(...) ab8500_btemp.c
>>
>>> Anyway, if the string property is longer than 8 characters, you are
>>> writing past the size of the destination array.
>>
>> i believe it is safe as power_supply.h comprises defines having battery
>> technology type in 4 characters length which is normally the case and
>> 7 chars length being "UNKNOWN" seldom referred
>
> You should be able to handle whatever the device tree contains, and if
> it contains unexpected data this is not a good excuse for locking up the
> system.
agreed, if we were to go by what device tree contains then explicit
assignment for battery type as "UNKNOWN" is not required, hence only 2
use case persist as :
a) property name with one of the said value be present
(as per documentation)
b) property name not present
next prev parent reply other threads:[~2012-11-15 11:35 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
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 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-11-01 15:15 ` Francesco Lavra
2012-11-07 18:45 ` Rajanikanth H V
2012-11-10 16:53 ` Francesco Lavra
2012-11-15 11:34 ` Rajanikanth HV [this message]
2012-10-31 15:40 ` [PATCH 2/4] mfd: ab8500: add devicetree support for btemp Rajanikanth H.V
2012-10-31 15:40 ` [PATCH 3/4] mfd: ab8500: add devicetree support for charger Rajanikanth H.V
2012-10-31 15:40 ` [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg Rajanikanth H.V
2012-11-19 3:46 ` [PATCH 0/4] Implement device tree support for ab8500 BM Devices Anton Vorontsov
2012-11-19 3:58 ` Rajanikanth HV
2012-11-19 4:57 ` Anton Vorontsov
-- strict thread matches above, loose matches on Subject: below --
2012-11-22 18:43 Rajanikanth H.V
2012-11-22 18:43 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-11-22 20:08 ` Anton Vorontsov
2012-11-23 9:50 ` Lee Jones
[not found] <1351146654-9110-1-git-send-email-rajanikanth.hv@stericsson.com>
[not found] ` <1351146654-9110-2-git-send-email-rajanikanth.hv@stericsson.com>
2012-10-27 15:07 ` Francesco Lavra
2012-10-27 16:00 ` Rajanikanth HV
2012-10-27 16:18 ` Francesco Lavra
[not found] <1349064513-31301-1-git-send-email-rajanikanth.hv@stericsson.com>
[not found] ` <1349064513-31301-2-git-send-email-rajanikanth.hv@stericsson.com>
2012-10-01 9:49 ` Lee Jones
2012-10-01 9:59 ` Rajanikanth HV
2012-10-01 10:36 ` Lee Jones
2012-10-01 10:22 ` Lee Jones
2012-10-06 14:01 ` Francesco Lavra
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=50A4D362.5060402@stericsson.com \
--to=rajanikanth.hv@stericsson.com \
--cc=STEricsson_nomadik_linux@list.st.com \
--cc=anton.vorontsov@linaro.org \
--cc=arnd@arndb.de \
--cc=francescolavra.fl@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=rajanikanth.hv@linaro.org \
--cc=rob.herring@calxeda.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
Powered by JetHome