From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: jenny.tc@intel.com, ramakrishna.pallala@intel.com,
myungjoo.ham@samsung.com, kyungmin.park@samsung.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] charger-manager: Add support sysfs entry for charger
Date: Thu, 20 Sep 2012 22:12:40 -0700 [thread overview]
Message-ID: <20120921051239.GA31443@lizard> (raw)
In-Reply-To: <1345536409-25880-1-git-send-email-cw00.choi@samsung.com>
On Tue, Aug 21, 2012 at 05:06:49PM +0900, Chanwoo Choi wrote:
> This patch add support sysfs entry for each charger(regulator).
> Charger-manager use one or more chargers for charging battery but
> some charger isn't necessary on specific scenario. So, if some charger
> isn't needed, can disable specific charger through 'externally_control'
> entry while system is on state and confirm the information(name, state)
> of charger.
>
> the list of added sysfs entry
> - /sys/class/power_supply/battery/chargers/charger.[index]/name
> : show name of charger(regulator)
> - /sys/class/power_supply/battery/chargers/charger.[index]/state
> : show either enabled or disabled state of charger
> - /sys/class/power_supply/battery/chargers/charger.[index]/externally_control
The API looks sane.
For the future, you might want to get rid of the 'name', and instead
just point to a regulator device (via a sysfs symlink). I.e.
/sys/class/power_supply/battery/chargers/charger.[index]/device
would be a symlink to the regulator device.
But for the time being, I guess it's OK as is (although I wouldn't
mind if it'll use the symlink from the start. :-)
[...]
> for (j = 0 ; j < charger->num_cables ; j++) {
> struct charger_cable *cable = &charger->cables[j];
> @@ -1287,6 +1386,71 @@ static int charger_manager_probe(struct platform_device *pdev)
> cable->charger = charger;
> cable->cm = cm;
> }
> +
[...]
> + charger->attr_g.attrs = charger->attrs;
> +
> + sysfs_attr_init(&cable->attr_name.attr);
Notice that 'cable' is declared in the 'for' loop above,
so this doesn't compile for me:
CHECK drivers/power/charger-manager.c
drivers/power/charger-manager.c:1559:17: error: undefined identifier 'cable'
drivers/power/charger-manager.c:1564:17: error: undefined identifier 'cable'
drivers/power/charger-manager.c:1569:17: error: undefined identifier 'cable'
CC drivers/power/charger-manager.o
drivers/power/charger-manager.c: In function ‘charger_manager_probe’:
drivers/power/charger-manager.c:1559:3: error: ‘cable’ undeclared (first use in this function)
drivers/power/charger-manager.c:1559:3: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [drivers/power/charger-manager.o] Error 1
Also:
- Please adhere to the codingstyle, there should be no spaces
before ';' in the for loop statement.
- If possible, please consider splitting _probe routine, it is more
than 300 lines long nowadays.
Thanks,
Anton.
next prev parent reply other threads:[~2012-09-21 5:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 8:06 [PATCH 3/5] charger-manager: Add support sysfs entry for charger Chanwoo Choi
2012-09-21 5:12 ` Anton Vorontsov [this message]
2012-09-21 7:25 ` Chanwoo Choi
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=20120921051239.GA31443@lizard \
--to=anton.vorontsov@linaro.org \
--cc=cw00.choi@samsung.com \
--cc=jenny.tc@intel.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=ramakrishna.pallala@intel.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