diff options
author | ChiaEn Wu <chiaen_wu@richtek.com> | 2022-09-15 17:47:32 +0800 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2022-09-16 22:27:19 +0200 |
commit | c2f2e2c3aecdbabf822272a4b6e7d91537633cd9 (patch) | |
tree | 68715df2736f42c3904dff7b71ca931403a69a19 /include/linux/linear_range.h | |
parent | 568035b01cfb107af8d2e4bd2fb9aea22cf5b868 (diff) | |
download | lwn-c2f2e2c3aecdbabf822272a4b6e7d91537633cd9.tar.gz lwn-c2f2e2c3aecdbabf822272a4b6e7d91537633cd9.zip |
lib: add linear range index macro
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>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'include/linux/linear_range.h')
-rw-r--r-- | include/linux/linear_range.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/linear_range.h b/include/linux/linear_range.h index fd3d0b358f22..2e4f4c3539c0 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); |