Re: [PATCH 1/2] Input: serio_raw - cosmetic fixes

From: Che-liang Chiou
Date: Tue Jan 10 2012 - 03:25:18 EST


On Mon, Jan 9, 2012 at 4:24 PM, Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> wrote:
> Hi Che-Liang,
>
> On Fri, Jan 06, 2012 at 07:03:14PM +0800, Che-Liang Chiou wrote:
>> Signed-off-by: Che-Liang Chiou <clchiou@xxxxxxxxxxxx>
>> ---
>> Âdrivers/input/serio/serio_raw.c | Â Â4 +---
>> Â1 files changed, 1 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
>> index 4d4cd14..a935c38 100644
>> --- a/drivers/input/serio/serio_raw.c
>> +++ b/drivers/input/serio/serio_raw.c
>> @@ -220,7 +220,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer,
>> Â Â Â Â Â Â Â Â Â Â Â goto out;
>> Â Â Â Â Â Â Â }
>> Â Â Â Â Â Â Â written++;
>> - Â Â };
>> + Â Â }
>>
>
> I applied this chunk, thanks.
>
>> Âout:
>> Â Â Â mutex_unlock(&serio_raw_mutex);
>> @@ -231,11 +231,9 @@ static unsigned int serio_raw_poll(struct file *file, poll_table *wait)
>> Â{
>> Â Â Â struct serio_raw_client *client = file->private_data;
>> Â Â Â struct serio_raw *serio_raw = client->serio_raw;
>> - Â Â unsigned int mask;
>>
>> Â Â Â poll_wait(file, &serio_raw->wait, wait);
>>
>> - Â Â mask = serio_raw->dead ? POLLHUP | POLLERR : POLLOUT | POLLWRNORM;
>> Â Â Â if (serio_raw->head != serio_raw->tail)
>> Â Â Â Â Â Â Â return POLLIN | POLLRDNORM;
>>
>
> This however is not quite correct. I will be applying the patch below
> instead.

Yeah I was wondering maybe you are going to make use of mask
somewhere. But still the patch below is quite strange. To my
understanding the mask is still not used; It is a local variable that
not does not make any side effect. Do you intend to use that mask on
any global state or return value?

> Thanks.
>
> --
> Dmitry
>
> Input: serio-raw - really signal HUP upon disconnect
>
> From: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
>
> Commit 8c1c10d5706bbb3b41cb4a5578339d67d3eeffc2 attempted to signal
> POLLHUP | POLLERR condition when polling disconnected device,
> unfortunately it did not do it quite correctly.
>
> Reported-by: Che-Liang Chiou <clchiou@xxxxxxxxxxxx>
> Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx>
> ---
>
> Âdrivers/input/serio/serio_raw.c | Â Â2 +-
> Â1 files changed, 1 insertions(+), 1 deletions(-)
>
>
> diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
> index ca78a89..c2c6ad8 100644
> --- a/drivers/input/serio/serio_raw.c
> +++ b/drivers/input/serio/serio_raw.c
> @@ -237,7 +237,7 @@ static unsigned int serio_raw_poll(struct file *file, poll_table *wait)
>
> Â Â Â Âmask = serio_raw->dead ? POLLHUP | POLLERR : POLLOUT | POLLWRNORM;
> Â Â Â Âif (serio_raw->head != serio_raw->tail)
> - Â Â Â Â Â Â Â return POLLIN | POLLRDNORM;
> + Â Â Â Â Â Â Â mask |= POLLIN | POLLRDNORM;

It seems that mask is a local variable that seems have no effect to
any global state?

> Â Â Â Âreturn 0;
> Â}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/