Skip to content

Commit b2498cb

Browse files
andy-shevbrgl
authored andcommitted
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent deb631c commit b2498cb

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/gpio/gpio-aggregator.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,
7272
if (!lookups)
7373
return -ENOMEM;
7474

75-
lookups->table[*n] =
76-
(struct gpiod_lookup)GPIO_LOOKUP_IDX(key, hwnum, NULL, *n, 0);
75+
lookups->table[*n] = GPIO_LOOKUP_IDX(key, hwnum, NULL, *n, 0);
7776

7877
(*n)++;
7978
memset(&lookups->table[*n], 0, sizeof(lookups->table[*n]));

include/linux/gpio/machine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct gpiod_hog {
7575
* gpiod_get_index()
7676
*/
7777
#define GPIO_LOOKUP_IDX(_key, _chip_hwnum, _con_id, _idx, _flags) \
78-
{ \
78+
(struct gpiod_lookup) { \
7979
.key = _key, \
8080
.chip_hwnum = _chip_hwnum, \
8181
.con_id = _con_id, \
@@ -87,7 +87,7 @@ struct gpiod_hog {
8787
* Simple definition of a single GPIO hog in an array.
8888
*/
8989
#define GPIO_HOG(_chip_label, _chip_hwnum, _line_name, _lflags, _dflags) \
90-
{ \
90+
(struct gpiod_hog) { \
9191
.chip_label = _chip_label, \
9292
.chip_hwnum = _chip_hwnum, \
9393
.line_name = _line_name, \

0 commit comments

Comments
 (0)