From: Lee Jones <lee.jones@linaro.org>
To: "Opensource [Adam Thomson]" <Adam.Thomson.Opensource@diasemi.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
Sebastian Reichel <sre@kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Support Opensource <Support.Opensource@diasemi.com>,
jic23@cam.ac.uk
Subject: Re: [PATCH v2 3/4] power: Add support for DA9150 Fuel-Gauge
Date: Tue, 7 Jul 2015 07:58:01 +0100 [thread overview]
Message-ID: <20150707065801.GG3182@x1> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A0337AB55C839@SW-EX-MBX01.diasemi.com>
On Mon, 06 Jul 2015, Opensource [Adam Thomson] wrote:
> On July 3, 2015 16:22, Lee Jones wrote:
>
> > > +/*
> > > + * Function template to provide battery temperature. Should provide
> > > + * 0.1 degrees C resolution return values.
> > > + */
> > > +typedef int (*da9150_read_temp_t)(void *context);
> > > +
> > > +/* Register temp callback function */
> > > +void da9150_fg_register_temp_cb(struct power_supply *psy,
> > da9150_read_temp_t cb,
> > > + void *cb_context);
> > > +
> > > #endif /* __DA9150_FG_H */
> >
> > I still don't get why you think pointers are better than just calling
> > the function directly. Can the *fn() ever point to different functions?
>
> Here, the intention is to cover the scenario where a battery has no internal
> thermistor, and cannot provide temperature readings to the DA9150 device. In
> that scenario I've allowed for the option of providing an external function
> which can give the temperature reading instead as DA9150 will not be able to
> provide a correct reading in that scenario. This would be platform dependent and
> such a platform using a battery not employing an NTC in their battery can
> register its own call-back function to provide battery temperature instead.
>
> So, in answer to your question, yes.
Before you add this scenario, I would like to see the code which
utilises it. I'm not a fan of coding-up 'just-in-case's. Please
re-submit when you have a user in the same patch-set.
This whole idea will need a discussion with Jonathan (the IIO
Maintainer), now CC'ed.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2015-07-07 6:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-26 8:47 [PATCH v2 0/4] Add support for DA9150 Fuel-Gauge Adam Thomson
2015-06-26 8:47 ` [PATCH v2 1/4] mfd: da9150: Add support for Fuel-Gauge Adam Thomson
2015-07-03 15:16 ` Lee Jones
2015-07-06 14:03 ` Opensource [Adam Thomson]
2015-06-26 8:47 ` [PATCH v2 2/4] mfd: da9150: Update DT bindings for Fuel-Gauge support Adam Thomson
2015-07-03 15:19 ` Lee Jones
2015-07-06 14:23 ` Opensource [Adam Thomson]
2015-06-26 8:47 ` [PATCH v2 3/4] power: Add support for DA9150 Fuel-Gauge Adam Thomson
2015-07-03 15:22 ` Lee Jones
2015-07-06 14:27 ` Opensource [Adam Thomson]
2015-07-07 6:58 ` Lee Jones [this message]
2015-06-26 8:47 ` [PATCH v2 4/4] power: da9150: Add DT bindings documentation for Fuel-Gauge Adam Thomson
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=20150707065801.GG3182@x1 \
--to=lee.jones@linaro.org \
--cc=Adam.Thomson.Opensource@diasemi.com \
--cc=Support.Opensource@diasemi.com \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jic23@cam.ac.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sameo@linux.intel.com \
--cc=sre@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).