struct gpio_v2_line_config *lc,
                                unsigned int line_idx, u64 edflags)
 {
+       u64 eflags;
+       int ret;
        u64 active_edflags = READ_ONCE(line->edflags);
        unsigned int debounce_period_us =
                        gpio_v2_line_config_debounce_period(lc, line_idx);
        /* sw debounced and still will be...*/
        if (debounce_period_us && READ_ONCE(line->sw_debounced)) {
                line_set_debounce_period(line, debounce_period_us);
+               /*
+                * ensure event fifo is initialised if edge detection
+                * is now enabled.
+                */
+               eflags = edflags & GPIO_V2_LINE_EDGE_FLAGS;
+               if (eflags && !kfifo_initialized(&line->req->events)) {
+                       ret = kfifo_alloc(&line->req->events,
+                                         line->req->event_buffer_size,
+                                         GFP_KERNEL);
+                       if (ret)
+                               return ret;
+               }
                return 0;
        }