Re: [PATCH 1/3] input: ps2-gpio: use ktime for IRQ timekeeping

From: Danilo Krummrich
Date: Tue Feb 15 2022 - 07:09:50 EST


Hi Dmitry,

On Mon, Feb 14, 2022 at 10:14:24PM -0800, Dmitry Torokhov wrote:
> Hi Danilo,
>
> On Fri, Feb 11, 2022 at 10:22:56PM +0100, Danilo Krummrich wrote:
> > @@ -128,20 +155,33 @@ static irqreturn_t ps2_gpio_irq_rx(struct ps2_gpio_data *drvdata)
> > unsigned char byte, cnt;
> > int data;
> > int rxflags = 0;
> > - static unsigned long old_jiffies;
> > + static ktime_t t_last, t_now;
> > + s64 us_delta;
> >
> > byte = drvdata->rx_byte;
> > cnt = drvdata->rx_cnt;
> >
> > - if (old_jiffies == 0)
> > - old_jiffies = jiffies;
> > + t_now = ktime_get();
> > + if (t_last == 0)
>
> Instead of checking this every time, do you think we could seed the
> value in ps2_gpio_open() (and also make it per-port, not static)?
Oops! Sure, I'll send a v2.

I will also add another patch to refactor struct ps2_gpio_data to clearly
separate rx and tx state data, otherwise it might start to become a bit messy.
>
> Thanks.
>
> --
> Dmitry

- Danilo