lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAN+gG=FObDG8zj0VqswXvjPCfNdFOt3oNcZhgaanSQ89a4_WGw@mail.gmail.com>
Date:	Wed, 30 Nov 2011 15:56:49 +0100
From:	Benjamin Tissoires <benjamin.tissoires@...c.fr>
To:	Jiri Kosina <jkosina@...e.cz>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Henrik Rydberg <rydberg@...omail.se>,
	Stephane Chatty <chatty@...c.fr>, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] HID: multitouch: use input_register callback

On Wed, Nov 30, 2011 at 15:37, Jiri Kosina <jkosina@...e.cz> wrote:
> On Tue, 29 Nov 2011, Benjamin Tissoires wrote:
>
>> Use the input_register mechanism to avoid a race in which the device
>> may emit events before the slots are ready.
>>
>> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@...il.com>
>> ---
>>  drivers/hid/hid-multitouch.c |   37 ++++++++++++++++++++++++-------------
>>  1 files changed, 24 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
>> index 91c13bc..bd6e410 100644
>> --- a/drivers/hid/hid-multitouch.c
>> +++ b/drivers/hid/hid-multitouch.c
>> @@ -574,6 +574,29 @@ static void mt_set_input_mode(struct hid_device *hdev)
>>       }
>>  }
>>
>> +static int mt_input_register(struct hid_device *hdev,
>> +             struct hid_input *hidinput)
>> +{
>> +     int ret;
>> +     struct mt_device *td = hid_get_drvdata(hdev);
>> +
>> +     td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
>> +                             GFP_KERNEL);
>> +     if (!td->slots) {
>> +             dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
>> +             return -ENOMEM;
>> +     }
>> +
>> +     ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
>> +     if (ret)
>> +             hid_warn(hdev,
>> +                      "can't create sysfs quirks attribute err: %d\n", ret);
>> +
>> +     mt_set_input_mode(hdev);
>> +
>> +     return 0;
>> +}
>> +
>>  static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
>>  {
>>       int ret, i;
>> @@ -610,19 +633,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
>>       if (ret)
>>               goto fail;
>>
>> -     td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
>> -                             GFP_KERNEL);
>> -     if (!td->slots) {
>> -             dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
>> -             hid_hw_stop(hdev);
>> -             ret = -ENOMEM;
>> -             goto fail;
>> -     }
>> -
>> -     ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
>> -
>> -     mt_set_input_mode(hdev);
>> -
>>       return 0;
>>
>>  fail:
>> @@ -843,6 +853,7 @@ static struct hid_driver mt_driver = {
>>       .input_mapping = mt_input_mapping,
>>       .input_mapped = mt_input_mapped,
>>       .feature_mapping = mt_feature_mapping,
>> +     .input_register = mt_input_register,
>
> Umm, where does this come from? My memory is famous for not being really
> excellent, but I don't immediately remember any patchset adding such
> callback to hid_driver struct.
>
> And it's not anywhere in my applied queue anyway.

Indeed, your memory is perfectly working: I had some hallucinations.
I was sure you accepted the following patch:
http://article.gmane.org/gmane.linux.kernel.input/21692

It was when Jaikumar Ganesh tried to fix a race in the init of hid-magicmouse.

As the input_register callback is not queued, you can drop this.

Cheers,
Benjamin

>
>>       .usage_table = mt_grabbed_usages,
>>       .event = mt_event,
>>  #ifdef CONFIG_PM
>> --
>> 1.7.4.4
>>
>
> --
> Jiri Kosina
> SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ