lkml.org 
[lkml]   [2015]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6.1 1/1] Input: Add userio module
On Wed, Sep 23, 2015 at 01:54:59PM -0400, cpaul@redhat.com wrote:
> +static int userio_device_write(struct serio *id, unsigned char val)
> +{
> + struct userio_device *userio = id->port_data;
> + unsigned long flags;
> +
> + if (!userio)
> + return -1;

I still have the same question: how can this happen? Where do we reset
port data to NULL? What happens if we set to NULL after checking?

> +
> + spin_lock_irqsave(&userio->buf_lock, flags);
> +
> + userio->buf[userio->head] = val;
> + userio->head = (userio->head + 1) % USERIO_BUFSIZE;
> +
> + if (userio->head == userio->tail)
> + dev_warn(userio_misc.this_device,
> + "Buffer overflowed, userio client isn't keeping up");
> +
> + spin_unlock_irqrestore(&userio->buf_lock, flags);
> +
> + wake_up_interruptible(&userio->waitq);
> +
> + return 0;
> +}

Thanks.

--
Dmitry


\
 
 \ /
  Last update: 2015-10-02 20:01    [W:0.315 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site