OSDN Git Service

staging: greybus: Inline gpio_chip_to_gb_gpio_controller()
authorSumitra Sharma <sumitraartsy@gmail.com>
Sat, 25 Mar 2023 08:23:33 +0000 (01:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Mar 2023 08:54:52 +0000 (09:54 +0100)
Convert 'gpio_chip_to_gb_gpio_controller' from a macro to a static
inline function, to make the relevant types apparent in the
definition and to benefit from the type checking performed by
the compiler at call sites.

Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
Link: https://lore.kernel.org/r/3fc5d84a99574ac4a76d26427ac544de375adeb4.1679732179.git.sumitraartsy@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/gpio.c

index d729b92..2a115a8 100644 (file)
@@ -41,8 +41,11 @@ struct gb_gpio_controller {
        struct irq_chip         irqc;
        struct mutex            irq_lock;
 };
-#define gpio_chip_to_gb_gpio_controller(chip) \
-       container_of(chip, struct gb_gpio_controller, chip)
+
+static inline struct gb_gpio_controller *gpio_chip_to_gb_gpio_controller(struct gpio_chip *chip)
+{
+       return container_of(chip, struct gb_gpio_controller, chip);
+}
 
 static struct gpio_chip *irq_data_to_gpio_chip(struct irq_data *d)
 {