Message ID | 0418eade65d434a25d304eaa804b34f92318be87.1663254344.git.chiaen_wu@richtek.com (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | Add MediaTek MT6370 PMIC support | expand |
Hi, On Thu, Sep 15, 2022 at 05:47:32PM +0800, ChiaEn Wu wrote: > From: ChiaEn Wu <chiaen_wu@richtek.com> > > Add linear_range_idx macro for declaring the linear_range struct simply. > > Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> > Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com> > --- Thanks, queued via immutable branch: The following changes since commit 568035b01cfb107af8d2e4bd2fb9aea22cf5b868: Linux 6.0-rc1 (2022-08-14 15:50:18 -0700) are available in the Git repository at: ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git tags/psy-linear-range-for-v6.1-signed for you to fetch changes up to c2f2e2c3aecdbabf822272a4b6e7d91537633cd9: lib: add linear range index macro (2022-09-16 22:27:19 +0200) ---------------------------------------------------------------- Immutable branch for linear range and power-supply for v6.1 Immutable branch between linear range and power-supply for driver changes in MT6370. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> ---------------------------------------------------------------- ChiaEn Wu (1): lib: add linear range index macro include/linux/linear_range.h | 11 +++++++++++ 1 file changed, 11 insertions(+) -- Sebastian > include/linux/linear_range.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/linear_range.h b/include/linux/linear_range.h > index fd3d0b3..2e4f4c3 100644 > --- a/include/linux/linear_range.h > +++ b/include/linux/linear_range.h > @@ -26,6 +26,17 @@ struct linear_range { > unsigned int step; > }; > > +#define LINEAR_RANGE(_min, _min_sel, _max_sel, _step) \ > + { \ > + .min = _min, \ > + .min_sel = _min_sel, \ > + .max_sel = _max_sel, \ > + .step = _step, \ > + } > + > +#define LINEAR_RANGE_IDX(_idx, _min, _min_sel, _max_sel, _step) \ > + [_idx] = LINEAR_RANGE(_min, _min_sel, _max_sel, _step) > + > unsigned int linear_range_values_in_range(const struct linear_range *r); > unsigned int linear_range_values_in_range_array(const struct linear_range *r, > int ranges); > -- > 2.7.4 >
diff --git a/include/linux/linear_range.h b/include/linux/linear_range.h index fd3d0b3..2e4f4c3 100644 --- a/include/linux/linear_range.h +++ b/include/linux/linear_range.h @@ -26,6 +26,17 @@ struct linear_range { unsigned int step; }; +#define LINEAR_RANGE(_min, _min_sel, _max_sel, _step) \ + { \ + .min = _min, \ + .min_sel = _min_sel, \ + .max_sel = _max_sel, \ + .step = _step, \ + } + +#define LINEAR_RANGE_IDX(_idx, _min, _min_sel, _max_sel, _step) \ + [_idx] = LINEAR_RANGE(_min, _min_sel, _max_sel, _step) + unsigned int linear_range_values_in_range(const struct linear_range *r); unsigned int linear_range_values_in_range_array(const struct linear_range *r, int ranges);