pinctrl: qcom: Handle get_function_mux failure
authorVaradarajan Narayanan <quic_varada@quicinc.com>
Wed, 26 Feb 2025 06:45:02 +0000 (12:15 +0530)
committerCaleb Connolly <caleb.connolly@linaro.org>
Mon, 17 Mar 2025 13:38:17 +0000 (13:38 +0000)
Presently, get_function_mux returns an unsigned int and cannot
differentiate between failure and correct function value. Change its
return type to int and check for failure in the caller.

Additionally, updated drivers/pinctrl/qcom/pinctrl-*.c to accommodate the
above return type change. Only compile test done.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Link: https://lore.kernel.org/r/20250226064505.1178054-5-quic_varada@quicinc.com
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
14 files changed:
drivers/pinctrl/qcom/pinctrl-apq8016.c
drivers/pinctrl/qcom/pinctrl-apq8096.c
drivers/pinctrl/qcom/pinctrl-ipq4019.c
drivers/pinctrl/qcom/pinctrl-qcm2290.c
drivers/pinctrl/qcom/pinctrl-qcom.c
drivers/pinctrl/qcom/pinctrl-qcom.h
drivers/pinctrl/qcom/pinctrl-qcs404.c
drivers/pinctrl/qcom/pinctrl-sdm845.c
drivers/pinctrl/qcom/pinctrl-sm6115.c
drivers/pinctrl/qcom/pinctrl-sm8150.c
drivers/pinctrl/qcom/pinctrl-sm8250.c
drivers/pinctrl/qcom/pinctrl-sm8550.c
drivers/pinctrl/qcom/pinctrl-sm8650.c
drivers/pinctrl/qcom/pinctrl-x1e80100.c

index 0c74378..9ae07d4 100644 (file)
@@ -50,8 +50,8 @@ static const char *apq8016_get_pin_name(struct udevice *dev,
        }
 }
 
-static unsigned int apq8016_get_function_mux(__maybe_unused unsigned int pin,
-                                            unsigned int selector)
+static int apq8016_get_function_mux(__maybe_unused unsigned int pin,
+                                   unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index 132ece8..eaa927c 100644 (file)
@@ -43,8 +43,8 @@ static const char *apq8096_get_pin_name(struct udevice *dev,
        }
 }
 
-static unsigned int apq8096_get_function_mux(__maybe_unused unsigned int pin,
-                                            unsigned int selector)
+static int apq8096_get_function_mux(__maybe_unused unsigned int pin,
+                                   unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index 3215c67..dafcd49 100644 (file)
@@ -311,8 +311,7 @@ static const char *ipq4019_get_pin_name(struct udevice *dev,
        return pin_name;
 }
 
-static unsigned int ipq4019_get_function_mux(unsigned int pin,
-                                            unsigned int selector)
+static int ipq4019_get_function_mux(unsigned int pin, unsigned int selector)
 {
        unsigned int i;
        const msm_pin_function *func = ipq4019_pin_functions + pin;
index af969e1..0c2222c 100644 (file)
@@ -38,7 +38,7 @@ static const char *qcm2290_get_pin_name(struct udevice *dev, unsigned int select
        return pin_name;
 }
 
-static unsigned int qcm2290_get_function_mux(__maybe_unused unsigned int pin, unsigned int selector)
+static int qcm2290_get_function_mux(__maybe_unused unsigned int pin, unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index 26a3fba..24d0319 100644 (file)
@@ -92,7 +92,10 @@ static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector,
                          unsigned int func_selector)
 {
        struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-       u32 func = priv->data->get_function_mux(pin_selector, func_selector);
+       int func = priv->data->get_function_mux(pin_selector, func_selector);
+
+       if (func < 0)
+               return func;
 
        /* Always NOP for special pins, assume they're in the correct state */
        if (qcom_is_special_pin(&priv->data->pin_data, pin_selector))
index 49b7bfb..cd167e6 100644 (file)
@@ -18,8 +18,7 @@ struct msm_pinctrl_data {
        int functions_count;
        const char *(*get_function_name)(struct udevice *dev,
                                         unsigned int selector);
-       unsigned int (*get_function_mux)(unsigned int pin,
-                                        unsigned int selector);
+       int (*get_function_mux)(unsigned int pin, unsigned int selector);
        const char *(*get_pin_name)(struct udevice *dev,
                                    unsigned int selector);
 };
index fb6defa..c272595 100644 (file)
@@ -93,8 +93,8 @@ static const char *qcs404_get_pin_name(struct udevice *dev,
        }
 }
 
-static unsigned int qcs404_get_function_mux(__maybe_unused unsigned int pin,
-                                           unsigned int selector)
+static int qcs404_get_function_mux(__maybe_unused unsigned int pin,
+                                  unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index f1a23f5..3f55fc8 100644 (file)
@@ -80,8 +80,8 @@ static const char *sdm845_get_pin_name(struct udevice *dev,
        return pin_name;
 }
 
-static unsigned int sdm845_get_function_mux(__maybe_unused unsigned int pin,
-                                           unsigned int selector)
+static int sdm845_get_function_mux(__maybe_unused unsigned int pin,
+                                  unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index f07f39f..7e80ea3 100644 (file)
@@ -167,7 +167,7 @@ static const char *sm6115_get_pin_name(struct udevice *dev, unsigned int selecto
        return pin_name;
 }
 
-static unsigned int sm6115_get_function_mux(__maybe_unused unsigned int pin, unsigned int selector)
+static int sm6115_get_function_mux(__maybe_unused unsigned int pin, unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index 1fb2ffb..fe789e8 100644 (file)
@@ -123,8 +123,8 @@ static const char *sm8150_get_pin_name(struct udevice *dev,
        return pin_name;
 }
 
-static unsigned int sm8150_get_function_mux(__maybe_unused unsigned int pin,
-                                           unsigned int selector)
+static int sm8150_get_function_mux(__maybe_unused unsigned int pin,
+                                  unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index b21cdc4..d544765 100644 (file)
@@ -99,7 +99,7 @@ static const char *sm8250_get_pin_name(struct udevice *dev, unsigned int selecto
        return pin_name;
 }
 
-static unsigned int sm8250_get_function_mux(__maybe_unused unsigned int pin, unsigned int selector)
+static int sm8250_get_function_mux(__maybe_unused unsigned int pin, unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index 25b972a..f7fcad0 100644 (file)
@@ -68,8 +68,8 @@ static const char *sm8550_get_pin_name(struct udevice *dev,
        return pin_name;
 }
 
-static unsigned int sm8550_get_function_mux(__maybe_unused unsigned int pin,
-                                           unsigned int selector)
+static int sm8550_get_function_mux(__maybe_unused unsigned int pin,
+                                  unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index 9146d6a..6b9d56b 100644 (file)
@@ -69,8 +69,8 @@ static const char *sm8650_get_pin_name(struct udevice *dev,
        return pin_name;
 }
 
-static unsigned int sm8650_get_function_mux(__maybe_unused unsigned int pin,
-                                           unsigned int selector)
+static int sm8650_get_function_mux(__maybe_unused unsigned int pin,
+                                  unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }
index f39dc42..319667b 100644 (file)
@@ -72,8 +72,8 @@ static const char *x1e80100_get_pin_name(struct udevice *dev,
        return pin_name;
 }
 
-static unsigned int x1e80100_get_function_mux(__maybe_unused unsigned int pin,
-                                             unsigned int selector)
+static int x1e80100_get_function_mux(__maybe_unused unsigned int pin,
+                                    unsigned int selector)
 {
        return msm_pinctrl_functions[selector].val;
 }