@@ -2502,22 +2502,33 @@ static int lineinfo_changed_notify(struct notifier_block *nb,
{
struct gpio_chardev_data *cdev = to_gpio_chardev_data(nb);
struct gpio_v2_line_info_changed chg;
- struct gpio_desc *desc = data;
+ struct gpio_desc *desc;
int ret;
- if (!test_bit(gpio_chip_hwgpio(desc), cdev->watched_lines))
- return NOTIFY_DONE;
+ switch (action) {
+ case GPIO_V2_LINE_CHANGED_REQUESTED:
+ case GPIO_V2_LINE_CHANGED_RELEASED:
+ case GPIO_V2_LINE_CHANGED_CONFIG:
+ desc = data;
- memset(&chg, 0, sizeof(chg));
- chg.event_type = action;
- chg.timestamp_ns = ktime_get_ns();
- gpio_desc_to_lineinfo(desc, &chg.info);
+ if (!test_bit(gpio_chip_hwgpio(desc), cdev->watched_lines))
+ return NOTIFY_DONE;
- ret = kfifo_in_spinlocked(&cdev->events, &chg, 1, &cdev->wait.lock);
- if (ret)
- wake_up_poll(&cdev->wait, EPOLLIN);
- else
- pr_debug_ratelimited("lineinfo event FIFO is full - event dropped\n");
+ memset(&chg, 0, sizeof(chg));
+ chg.event_type = action;
+ chg.timestamp_ns = ktime_get_ns();
+ gpio_desc_to_lineinfo(desc, &chg.info);
+
+ ret = kfifo_in_spinlocked(&cdev->events, &chg, 1,
+ &cdev->wait.lock);
+ if (ret)
+ wake_up_poll(&cdev->wait, EPOLLIN);
+ else
+ pr_debug_ratelimited("lineinfo event FIFO is full - event dropped\n");
+ break;
+ default:
+ return NOTIFY_DONE;
+ }
return NOTIFY_OK;
}
@@ -38,8 +38,7 @@
* or name of the IP component in a System on Chip.
* @data: per-instance data assigned by the driver
* @list: links gpio_device:s together for traversal
- * @notifier: used to notify subscribers about lines being requested, released
- * or reconfigured
+ * @notifier: used to notify subscribers about gpio_device events
* @sem: protects the structure from a NULL-pointer dereference of @chip by
* user-space operations when the device gets unregistered during
* a hot-unplug event