[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20ADAB092842284E95860F279283C56422F95A3E@BGSMSX104.gar.corp.intel.com>
Date: Tue, 8 Jul 2014 06:07:29 +0000
From: "Tc, Jenny" <jenny.tc@...el.com>
To: Sebastian Reichel <sre@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Dmitry Eremin-Solenikov" <dbaryshkov@...il.com>,
Pavel Machek <pavel@....cz>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Anton Vorontsov <anton.vorontsov@...aro.org>,
David Woodhouse <dwmw2@...radead.org>,
"David Cohen" <david.a.cohen@...ux.intel.com>,
"Pallala, Ramakrishna" <ramakrishna.pallala@...el.com>
Subject: RE: [PATCH 3/4] power_supply: Introduce PSE compliant algorithm
> > +static int get_tempzone(struct psy_pse_chrg_prof *pse_mod_bprof,
> > + int temp)
> > +{
> > + int i = 0;
> > + int temp_range_cnt;
> > +
> > + temp_range_cnt = min_t(u16, pse_mod_bprof->temp_mon_ranges,
> > + BATT_TEMP_NR_RNG);
> > + if ((temp < pse_mod_bprof->temp_low_lim) ||
> > + (temp > pse_mod_bprof->temp_mon_range[0].temp_up_lim))
> > + return -EINVAL;
> > +
> > + for (i = 0; i < temp_range_cnt; ++i)
> > + if (temp > pse_mod_bprof->temp_mon_range[i].temp_up_lim)
> > + break;
> > + return i-1;
> > +}
>
> pse_mod_bprof->temp_mon_ranges > BATT_TEMP_NR_RNG is not allowed, so I
> suggest to print an error and return some error code.
>
min_t takes care of the upper bound. The algorithm process BATT_TEMP_NR_RNG
even if the actual number of zones are greater than this.
Agree to other comments
-Jenny
--
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