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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 10 Feb 2023 12:05:13 +0000
From:   Aditya Garg <gargaditya08@...e.com>
To:     Thomas Weißschuh <thomas@...ch.de>
CC:     Jiri Kosina <jikos@...nel.org>,
        "jkosina@...e.cz" <jkosina@...e.cz>,
        "benjamin.tissoires@...hat.com" <benjamin.tissoires@...hat.com>,
        Andy Shevchenko <andy@...radead.org>,
        "andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        "linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
        "ronald@...ovation.ch" <ronald@...ovation.ch>,
        "kekrby@...il.com" <kekrby@...il.com>,
        Orlando Chamberlain <orlandoch.dev@...il.com>
Subject: Re: [PATCH 1/3] HID: apple-ibridge: Add Apple iBridge HID driver for
 T1 chip.



> On 10-Feb-2023, at 10:26 AM, Thomas Weißschuh <thomas@...ch.de> wrote:
> 
> Hi,
> 
> some comments inline.
> 
> On Fri, Feb 10, 2023 at 03:43:24AM +0000, Aditya Garg wrote:
> 
>> +
>> +static struct {
>> + unsigned int usage;
>> + struct hid_device_id *dev_id;
>> +} appleib_usage_map[] = {
>> + /* Default iBridge configuration, key inputs and mode settings */
>> + { 0x00010006, &appleib_sub_hid_ids[0] },
>> + /* OS X iBridge configuration, digitizer inputs */
>> + { 0x000D0005, &appleib_sub_hid_ids[0] },
>> + /* All iBridge configurations, display/DFR settings */
>> + { 0xFF120001, &appleib_sub_hid_ids[0] },
>> + /* All iBridge configurations, ALS */
>> + { 0x00200041, &appleib_sub_hid_ids[1] },
>> +};
> 
> const
> 

Constantifying this results in compiler giving warnings

drivers/hid/apple-ibridge.c:78:23: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   78 |         { 0x00200041, &appleib_sub_hid_ids[1] },
      |                       ^
drivers/hid/apple-ibridge.c: In function 'appleib_add_sub_dev':
drivers/hid/apple-ibridge.c:363:29: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  363 |         sub_hdev->ll_driver = &appleib_ll_driver;
      |                             ^
drivers/hid/apple-ibridge.c: In function 'appleib_hid_probe':
drivers/hid/apple-ibridge.c:436:12: error: expected '(' before 'hid_is_usb'
  436 |         if hid_is_usb(hdev)
      |            ^~~~~~~~~~
      |            (
In file included from drivers/hid/apple-ibridge.c:48:
drivers/hid/apple-ibridge.c: In function 'appleib_probe':
drivers/hid/apple-ibridge.c:544:35: warning: passing argument 1 of '__hid_register_driver' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  544 |         ret = hid_register_driver(&appleib_hid_driver);
      |                                   ^~~~~~~~~~~~~~~~~~~
./include/linux/hid.h:898:31: note: in definition of macro 'hid_register_driver'
  898 |         __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
      |                               ^~~~~~
./include/linux/hid.h:893:47: note: expected 'struct hid_driver *' but argument is of type 'const struct hid_driver *'
  893 | extern int __must_check __hid_register_driver(struct hid_driver *,
      |                                               ^~~~~~~~~~~~~~~~~~~
drivers/hid/apple-ibridge.c: In function 'appleib_remove':
drivers/hid/apple-ibridge.c:558:31: warning: passing argument 1 of 'hid_unregister_driver' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  558 |         hid_unregister_driver(&appleib_hid_driver);
      |                               ^~~~~~~~~~~~~~~~~~~
./include/linux/hid.h:900:35: note: expected 'struct hid_driver *' but argument is of type 'const struct hid_driver *'
  900 | extern void hid_unregister_driver(struct hid_driver *);
      |                                   ^~~~~~~~~~~~~~~~~~~
make[6]: *** [scripts/Makefile.build:250: drivers/hid/apple-ibridge.o] Error 1
make[5]: *** [scripts/Makefile.build:500: drivers/hid] Error 2
make[5]: *** Waiting for unfinished jobs….

Some warnings are also due to a typo in if and constantifying `static struct hid_driver`, although they probably can
be fixed.

In short, Thomas, do you really want me to constantify the structure I am talking about in this email, as well `static struct hid_driver`?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ