[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <0418eade65d434a25d304eaa804b34f92318be87.1663254344.git.chiaen_wu@richtek.com>
Date: Thu, 15 Sep 2022 17:47:32 +0800
From: ChiaEn Wu <peterwu.pub@...il.com>
To: pavel@....cz, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, matthias.bgg@...il.com,
sre@...nel.org, jic23@...nel.org, lars@...afoo.de,
broonie@...nel.org, mazziesaccount@...il.com,
andriy.shevchenko@...ux.intel.com
Cc: chiaen_wu@...htek.com, alice_chen@...htek.com,
cy_huang@...htek.com, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org, linux-iio@...r.kernel.org,
szunichen@...il.com
Subject: [PATCH v11 4/8] lib: add linear range index macro
From: ChiaEn Wu <chiaen_wu@...htek.com>
Add linear_range_idx macro for declaring the linear_range struct simply.
Reviewed-by: Matti Vaittinen <mazziesaccount@...il.com>
Signed-off-by: ChiaEn Wu <chiaen_wu@...htek.com>
---
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
Powered by blists - more mailing lists