]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
firmware: arm_scmi: Move boiler plate code into the get info functions
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 27 Oct 2025 15:16:06 +0000 (18:16 +0300)
committerSudeep Holla <sudeep.holla@arm.com>
Tue, 16 Dec 2025 12:27:26 +0000 (12:27 +0000)
commita3c46c82d8a2075dfe2a2af1431486c8b128e93c
tree94e013de532c44906a9719a94959ce3b5e227233
parentf6753869a25ebf0022fe531a31e4fd2435d5e1a5
firmware: arm_scmi: Move boiler plate code into the get info functions

This code to check whether the selector is valid and if the item has
already been recorded in the array can be moved to the
scmi_pinctrl_get_function_info() type functions.  That way it's in
one place instead of duplicated in each of the callers.

Remove the check for if "pi->nr_groups == 0" because if that were the
case then "selector >= pi->nr_groups" would already be true.  It already
was not checked for the pin case so this makes things a bit more uniform.

Also remove the check for if (!pin) since pin is an offset into the
middle of an array and can't be NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Message-Id: <287b5302f583e3535d50617ec3b0856e38253171.1761576798.git.dan.carpenter@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/pinctrl.c