[RESEND PATCH v8 06/12] lib: add linear range index macro

ChiaEn Wu peterwu.pub at gmail.com
Mon Aug 15 02:01:19 PDT 2022


From: ChiaEn Wu <chiaen_wu at richtek.com>

Add linear_range_idx macro for declaring the linear_range struct simply.

Signed-off-by: ChiaEn Wu <chiaen_wu at richtek.com>
---
 include/linux/linear_range.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/linear_range.h b/include/linux/linear_range.h
index fd3d0b358f22..fb53ea13c593 100644
--- a/include/linux/linear_range.h
+++ b/include/linux/linear_range.h
@@ -26,6 +26,14 @@ struct linear_range {
 	unsigned int step;
 };
 
+#define LINEAR_RANGE_IDX(_min, _min_sel, _max_sel, _step)	\
+	{							\
+		.min = _min,					\
+		.min_sel = _min_sel,				\
+		.max_sel = _max_sel,				\
+		.step = _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.34.1




More information about the Linux-mediatek mailing list