]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: aggregator: Use compound literal from the header
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 22 Jan 2021 12:38:52 +0000 (14:38 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 15 Feb 2021 10:43:32 +0000 (11:43 +0100)
Instead of doing it in place, convert GPIO_LOOKUP_IDX() and GPIO_HOG()
to be compund literals that's allow to use them as rvalue in assignments.

Due to above conversion, use compound literal from the header
in the gpio-aggregator.c.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/gpio/gpio-aggregator.c
include/linux/gpio/machine.h

index 40a081b095fb3804c56891b2473c5f0bb8adbe17..13e473c97ce4303abfce77763f67d420cff7fb6e 100644 (file)
@@ -72,8 +72,7 @@ static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,
        if (!lookups)
                return -ENOMEM;
 
-       lookups->table[*n] =
-               (struct gpiod_lookup)GPIO_LOOKUP_IDX(key, hwnum, NULL, *n, 0);
+       lookups->table[*n] = GPIO_LOOKUP_IDX(key, hwnum, NULL, *n, 0);
 
        (*n)++;
        memset(&lookups->table[*n], 0, sizeof(lookups->table[*n]));
index 781a053abbb99a1d3c048f3c50879dcec3e366e9..d755e529c1e31f8d67260dc577715de6d54a627a 100644 (file)
@@ -75,7 +75,7 @@ struct gpiod_hog {
  * gpiod_get_index()
  */
 #define GPIO_LOOKUP_IDX(_key, _chip_hwnum, _con_id, _idx, _flags)         \
-{                                                                         \
+(struct gpiod_lookup) {                                                   \
        .key = _key,                                                      \
        .chip_hwnum = _chip_hwnum,                                        \
        .con_id = _con_id,                                                \
@@ -87,7 +87,7 @@ struct gpiod_hog {
  * Simple definition of a single GPIO hog in an array.
  */
 #define GPIO_HOG(_chip_label, _chip_hwnum, _line_name, _lflags, _dflags)  \
-{                                                                         \
+(struct gpiod_hog) {                                                      \
        .chip_label = _chip_label,                                        \
        .chip_hwnum = _chip_hwnum,                                        \
        .line_name = _line_name,                                          \