pinctrl: stmfx: Use PINNAME_SIZE for pin's name size
authorPatrice Chotard <patrice.chotard@foss.st.com>
Wed, 20 Jan 2021 12:43:40 +0000 (13:43 +0100)
committerPatrick Delaunay <patrick.delaunay@foss.st.com>
Tue, 9 Feb 2021 09:26:01 +0000 (10:26 +0100)
Instead of redefining a pin's name size, use PINNAME_SIZE defined
in include/dm/pinctrl.h

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
drivers/pinctrl/pinctrl-stmfx.c

index b4baf35..1a8d0a3 100644 (file)
@@ -346,15 +346,14 @@ static int stmfx_pinctrl_get_pins_count(struct udevice *dev)
  * STMFX pins[15:0] are called "gpio[15:0]"
  * and STMFX pins[23:16] are called "agpio[7:0]"
  */
-#define MAX_PIN_NAME_LEN 7
-static char pin_name[MAX_PIN_NAME_LEN];
+static char pin_name[PINNAME_SIZE];
 static const char *stmfx_pinctrl_get_pin_name(struct udevice *dev,
                                              unsigned int selector)
 {
        if (selector < STMFX_MAX_GPIO)
-               snprintf(pin_name, MAX_PIN_NAME_LEN, "gpio%u", selector);
+               snprintf(pin_name, PINNAME_SIZE, "gpio%u", selector);
        else
-               snprintf(pin_name, MAX_PIN_NAME_LEN, "agpio%u", selector - 16);
+               snprintf(pin_name, PINNAME_SIZE, "agpio%u", selector - 16);
        return pin_name;
 }