public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/3] firmware: arm_scmi: Miscellaneous improvements
@ 2026-04-03  8:41 Geert Uytterhoeven
  2026-04-03  8:41 ` [PATCH 1/3] firmware: arm_scmi: quirk: Improve quirk range parsing Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-04-03  8:41 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Marek Vasut
  Cc: arm-scmi, linux-arm-kernel, linux-renesas-soc, Geert Uytterhoeven

	Hi all,

This patch series contains miscellaneous improvements for SCMI quirk
handling and SCMI instance iteration.

Thanks for your comments!

Geert Uytterhoeven (3):
  firmware: arm_scmi: quirk: Improve quirk range parsing
  firmware: arm_scmi: quirk: Simplify quirk table iteration
  firmware: arm_scmi: Convert to list_for_each_entry()

 drivers/firmware/arm_scmi/driver.c |  4 +---
 drivers/firmware/arm_scmi/quirks.c | 15 ++++++---------
 2 files changed, 7 insertions(+), 12 deletions(-)

-- 
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] firmware: arm_scmi: quirk: Improve quirk range parsing
  2026-04-03  8:41 [PATCH 0/3] firmware: arm_scmi: Miscellaneous improvements Geert Uytterhoeven
@ 2026-04-03  8:41 ` Geert Uytterhoeven
  2026-04-03  8:41 ` [PATCH 2/3] firmware: arm_scmi: quirk: Simplify quirk table iteration Geert Uytterhoeven
  2026-04-03  8:41 ` [PATCH 3/3] firmware: arm_scmi: Convert to list_for_each_entry() Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-04-03  8:41 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Marek Vasut
  Cc: arm-scmi, linux-arm-kernel, linux-renesas-soc, Geert Uytterhoeven

When a range contains only an end ("-X"), the number string is parsed
twice, as both "sep == first" and "sep != last" are true.  Fix this by
dropping the superfluous number parsing for "sep == first".

This does have a harmless functional impact for the unbounded range:
"-" is now accepted, while it was rejected before.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/firmware/arm_scmi/quirks.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/arm_scmi/quirks.c b/drivers/firmware/arm_scmi/quirks.c
index 03848283c2a07b72..b1d9cd9fa2427879 100644
--- a/drivers/firmware/arm_scmi/quirks.c
+++ b/drivers/firmware/arm_scmi/quirks.c
@@ -238,16 +238,15 @@ static int scmi_quirk_range_parse(struct scmi_quirk *quirk)
 	if (sep)
 		*sep = '\0';
 
-	if (sep == first) /* -X */
-		ret = kstrtouint(first + 1, 0, &quirk->end_range);
-	else /* X OR X- OR X-y */
+	if (sep != first) /* X OR X- OR X-y */ {
 		ret = kstrtouint(first, 0, &quirk->start_range);
-	if (ret)
-		return ret;
+		if (ret)
+			return ret;
+	}
 
 	if (!sep)
 		quirk->end_range = quirk->start_range;
-	else if (sep != last) /* x-Y */
+	else if (sep != last) /* -X OR x-Y */
 		ret = kstrtouint(sep + 1, 0, &quirk->end_range);
 
 	if (quirk->start_range > quirk->end_range)
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] firmware: arm_scmi: quirk: Simplify quirk table iteration
  2026-04-03  8:41 [PATCH 0/3] firmware: arm_scmi: Miscellaneous improvements Geert Uytterhoeven
  2026-04-03  8:41 ` [PATCH 1/3] firmware: arm_scmi: quirk: Improve quirk range parsing Geert Uytterhoeven
@ 2026-04-03  8:41 ` Geert Uytterhoeven
  2026-04-03  8:41 ` [PATCH 3/3] firmware: arm_scmi: Convert to list_for_each_entry() Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-04-03  8:41 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Marek Vasut
  Cc: arm-scmi, linux-arm-kernel, linux-renesas-soc, Geert Uytterhoeven

The current table entry is assigned in both the init and loop
expressions of the for-statement.  Merge this into a single assignment
in the conditional expression, to simplify the code.

While at it, make the loop counter unsigned and loop-local.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/firmware/arm_scmi/quirks.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/firmware/arm_scmi/quirks.c b/drivers/firmware/arm_scmi/quirks.c
index b1d9cd9fa2427879..2b38ba3f59a13c9e 100644
--- a/drivers/firmware/arm_scmi/quirks.c
+++ b/drivers/firmware/arm_scmi/quirks.c
@@ -258,10 +258,8 @@ static int scmi_quirk_range_parse(struct scmi_quirk *quirk)
 void scmi_quirks_initialize(void)
 {
 	struct scmi_quirk *quirk;
-	int i;
 
-	for (i = 0, quirk = scmi_quirks_table[0]; quirk;
-	     i++, quirk = scmi_quirks_table[i]) {
+	for (unsigned int i = 0; (quirk = scmi_quirks_table[i]); i++) {
 		int ret;
 
 		ret = scmi_quirk_range_parse(quirk);
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] firmware: arm_scmi: Convert to list_for_each_entry()
  2026-04-03  8:41 [PATCH 0/3] firmware: arm_scmi: Miscellaneous improvements Geert Uytterhoeven
  2026-04-03  8:41 ` [PATCH 1/3] firmware: arm_scmi: quirk: Improve quirk range parsing Geert Uytterhoeven
  2026-04-03  8:41 ` [PATCH 2/3] firmware: arm_scmi: quirk: Simplify quirk table iteration Geert Uytterhoeven
@ 2026-04-03  8:41 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-04-03  8:41 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Marek Vasut
  Cc: arm-scmi, linux-arm-kernel, linux-renesas-soc, Geert Uytterhoeven

Simplify the loop in scmi_handle_get() by using list_for_each_entry().

Suggested-by: Marek Vasut <marek.vasut@mailbox.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/firmware/arm_scmi/driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 57785c0c04241e46..b1bba2c61b728b56 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2584,13 +2584,11 @@ static bool scmi_is_transport_atomic(const struct scmi_handle *handle,
  */
 static struct scmi_handle *scmi_handle_get(struct device *dev)
 {
-	struct list_head *p;
 	struct scmi_info *info;
 	struct scmi_handle *handle = NULL;
 
 	mutex_lock(&scmi_list_mutex);
-	list_for_each(p, &scmi_list) {
-		info = list_entry(p, struct scmi_info, node);
+	list_for_each_entry(info, &scmi_list, node) {
 		if (dev->parent == info->dev) {
 			info->users++;
 			handle = &info->handle;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-03  8:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03  8:41 [PATCH 0/3] firmware: arm_scmi: Miscellaneous improvements Geert Uytterhoeven
2026-04-03  8:41 ` [PATCH 1/3] firmware: arm_scmi: quirk: Improve quirk range parsing Geert Uytterhoeven
2026-04-03  8:41 ` [PATCH 2/3] firmware: arm_scmi: quirk: Simplify quirk table iteration Geert Uytterhoeven
2026-04-03  8:41 ` [PATCH 3/3] firmware: arm_scmi: Convert to list_for_each_entry() Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox