Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: virtuser: Use GPIO_LOOKUP_IDX() macro

Use GPIO_LOOKUP_IDX() macro which provides a compound literal
and can be used with dynamic data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240820200858.3659995-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
2a4727e6 4b91188d

+4 -9
+4 -9
drivers/gpio/gpio-virtuser.c
··· 1410 1410 size_t num_entries = gpio_virtuser_get_lookup_count(dev); 1411 1411 struct gpio_virtuser_lookup_entry *entry; 1412 1412 struct gpio_virtuser_lookup *lookup; 1413 - struct gpiod_lookup *curr; 1414 1413 unsigned int i = 0; 1415 1414 1416 1415 lockdep_assert_held(&dev->lock); ··· 1425 1426 1426 1427 list_for_each_entry(lookup, &dev->lookup_list, siblings) { 1427 1428 list_for_each_entry(entry, &lookup->entry_list, siblings) { 1428 - curr = &table->table[i]; 1429 - 1430 - curr->con_id = lookup->con_id; 1431 - curr->idx = i; 1432 - curr->key = entry->key; 1433 - curr->chip_hwnum = entry->offset < 0 ? 1434 - U16_MAX : entry->offset; 1435 - curr->flags = entry->flags; 1429 + table->table[i] = 1430 + GPIO_LOOKUP_IDX(entry->key, 1431 + entry->offset < 0 ? U16_MAX : entry->offset, 1432 + lookup->con_id, i, entry->flags); 1436 1433 i++; 1437 1434 } 1438 1435 }