Commit b2498cb8 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Bartosz Golaszewski

gpio: aggregator: Use compound literal from the header

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
parent deb631c4
...@@ -72,8 +72,7 @@ static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key, ...@@ -72,8 +72,7 @@ static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,
if (!lookups) if (!lookups)
return -ENOMEM; return -ENOMEM;
lookups->table[*n] = lookups->table[*n] = GPIO_LOOKUP_IDX(key, hwnum, NULL, *n, 0);
(struct gpiod_lookup)GPIO_LOOKUP_IDX(key, hwnum, NULL, *n, 0);
(*n)++; (*n)++;
memset(&lookups->table[*n], 0, sizeof(lookups->table[*n])); memset(&lookups->table[*n], 0, sizeof(lookups->table[*n]));
......
...@@ -75,7 +75,7 @@ struct gpiod_hog { ...@@ -75,7 +75,7 @@ struct gpiod_hog {
* gpiod_get_index() * gpiod_get_index()
*/ */
#define GPIO_LOOKUP_IDX(_key, _chip_hwnum, _con_id, _idx, _flags) \ #define GPIO_LOOKUP_IDX(_key, _chip_hwnum, _con_id, _idx, _flags) \
{ \ (struct gpiod_lookup) { \
.key = _key, \ .key = _key, \
.chip_hwnum = _chip_hwnum, \ .chip_hwnum = _chip_hwnum, \
.con_id = _con_id, \ .con_id = _con_id, \
...@@ -87,7 +87,7 @@ struct gpiod_hog { ...@@ -87,7 +87,7 @@ struct gpiod_hog {
* Simple definition of a single GPIO hog in an array. * Simple definition of a single GPIO hog in an array.
*/ */
#define GPIO_HOG(_chip_label, _chip_hwnum, _line_name, _lflags, _dflags) \ #define GPIO_HOG(_chip_label, _chip_hwnum, _line_name, _lflags, _dflags) \
{ \ (struct gpiod_hog) { \
.chip_label = _chip_label, \ .chip_label = _chip_label, \
.chip_hwnum = _chip_hwnum, \ .chip_hwnum = _chip_hwnum, \
.line_name = _line_name, \ .line_name = _line_name, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment