[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 7 Jul 2015 07:58:01 +0100
From: Lee Jones <lee.jones@...aro.org>
To: "Opensource [Adam Thomson]" <Adam.Thomson.Opensource@...semi.com>
Cc: Samuel Ortiz <sameo@...ux.intel.com>,
Sebastian Reichel <sre@...nel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Support Opensource <Support.Opensource@...semi.com>,
jic23@....ac.uk
Subject: Re: [PATCH v2 3/4] power: Add support for DA9150 Fuel-Gauge
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists