lkml.org 
[lkml]   [2014]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 3/4] power_supply: Introduce PSE compliant algorithm
Date
> > +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


\
 
 \ /
  Last update: 2014-07-08 13:41    [W:0.070 / U:7.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site