Commit Graph

5458 Commits

Author SHA1 Message Date
Linus Torvalds
2a770b49b1 hid-for-linus-2024120501
-----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEoEVH9lhNrxiMPSyI7MXwXhnZSjYFAmdRfk0THGJlbnRpc3NA
 a2VybmVsLm9yZwAKCRDsxfBeGdlKNs2rD/9j0VelBG1kCnNOPWYSgPY5loVs/KJQ
 DwqTD5fXClhOqq4veqO1GN/n9RHGvetSdUjO1zlzbGX/BbFvacbGrKFNyphO+ySx
 mdC0PzrKHE2+nznpRCIvIzxfngfKJTWyzYVm14N/TXktVIwPlIwwIbuZF9YGeI00
 Rk2kfdmBc6t5P3PPy+iVBbP2Jcc4oOO4gUgRa7+ch13bp5BHpgbhOBvSkHF+67SU
 V3OMjx+OoGWzOGDkL3JJXR4w33YgkCaI3iYjE4qdPrNhZWgIUZM0xMEjsEVHKNG3
 RH6Ck87TD2txh+maFRHXVE8SldZ25keEwT3lGgUPKZWLvQmVWcLoydx47u84pkex
 slR4YXYl7osrgguePmXHilQBi9ycuFfFf2BUZI5t3DXXwvq1l+KcmKdZfyhE7tgU
 KlyNrwQSAZrVLTZSOs+Cyxn4DMbLRXmRxipJgwARf6mQIuW9qfoCeT+2MIaYKjGG
 5cckcKMPParZgaoQ8nlhF6wP51rP4Ew1pYIW9W+olYoJWr1c6CouKYmFjV1XpRxP
 aKcoydt1aWy1OYLVxPmu+E/Hlqb8WYyNm+SROm/pP19lKUJViUMUz9Ksp+WXTMCs
 7mzgTeZ4ViVzI/OTAWvafTvIkress40WgZe59qwl9pRq/C6iKZneAVudrfbV4VMJ
 33hdt6a1eBtAfw==
 =9aQY
 -----END PGP SIGNATURE-----

Merge tag 'hid-for-linus-2024120501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fixes from Benjamin Tissoires:

 - regression fix in suspend/resume for i2c-hid (Kenny Levinsen)

 - fix wacom driver assuming a name can not be null (WangYuli)

 - a couple of constify changes/fixes (Thomas Weißschuh)

 - a couple of selftests/hid fixes (Maximilian Heyne & Benjamin
   Tissoires)

* tag 'hid-for-linus-2024120501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  selftests/hid: fix kfunc inclusions with newer bpftool
  HID: bpf: drop unneeded casts discarding const
  HID: bpf: constify hid_ops
  selftests: hid: fix typo and exit code
  HID: wacom: fix when get product name maybe null pointer
  HID: i2c-hid: Revert to using power commands to wake on resume
2024-12-05 10:06:47 -08:00
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Linus Torvalds
e70140ba0d Get rid of 'remove_new' relic from platform driver struct
The continual trickle of small conversion patches is grating on me, and
is really not helping.  Just get rid of the 'remove_new' member
function, which is just an alias for the plain 'remove', and had a
comment to that effect:

  /*
   * .remove_new() is a relic from a prototype conversion of .remove().
   * New drivers are supposed to implement .remove(). Once all drivers are
   * converted to not use .remove_new any more, it will be dropped.
   */

This was just a tree-wide 'sed' script that replaced '.remove_new' with
'.remove', with some care taken to turn a subsequent tab into two tabs
to make things line up.

I did do some minimal manual whitespace adjustment for places that used
spaces to line things up.

Then I just removed the old (sic) .remove_new member function, and this
is the end result.  No more unnecessary conversion noise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-01 15:12:43 -08:00
Thomas Weißschuh
0b1b0c1124 HID: bpf: drop unneeded casts discarding const
In commit 33c0fb85b5 ("HID: bpf: make part of struct hid_device writable")
the const qualifier was dropped from struct hid_bpf_ctx::hid.
The casts are now unnecessary.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20241127-hid-bpf-cast-v1-1-f26424960e84@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-11-28 14:49:51 +01:00
Thomas Weißschuh
f9a11da1d9 HID: bpf: constify hid_ops
The hid_ops struct is never modified. Mark it as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20241127-hid-bpf-ops-v1-1-f9e41bfa3afd@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-11-28 14:49:28 +01:00
WangYuli
59548215b7 HID: wacom: fix when get product name maybe null pointer
Due to incorrect dev->product reporting by certain devices, null
pointer dereferences occur when dev->product is empty, leading to
potential system crashes.

This issue was found on EXCELSIOR DL37-D05 device with
Loongson-LS3A6000-7A2000-DL37 motherboard.

Kernel logs:
[   56.470885] usb 4-3: new full-speed USB device number 4 using ohci-pci
[   56.671638] usb 4-3: string descriptor 0 read error: -22
[   56.671644] usb 4-3: New USB device found, idVendor=056a, idProduct=0374, bcdDevice= 1.07
[   56.671647] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   56.678839] hid-generic 0003:056A:0374.0004: hiddev0,hidraw3: USB HID v1.10 Device [HID 056a:0374] on usb-0000:00:05.0-3/input0
[   56.697719] CPU 2 Unable to handle kernel paging request at virtual address 0000000000000000, era == 90000000066e35c8, ra == ffff800004f98a80
[   56.697732] Oops[#1]:
[   56.697734] CPU: 2 PID: 2742 Comm: (udev-worker) Tainted: G           OE      6.6.0-loong64-desktop #25.00.2000.015
[   56.697737] Hardware name: Inspur CE520L2/C09901N000000000, BIOS 2.09.00 10/11/2024
[   56.697739] pc 90000000066e35c8 ra ffff800004f98a80 tp 9000000125478000 sp 900000012547b8a0
[   56.697741] a0 0000000000000000 a1 ffff800004818b28 a2 0000000000000000 a3 0000000000000000
[   56.697743] a4 900000012547b8f0 a5 0000000000000000 a6 0000000000000000 a7 0000000000000000
[   56.697745] t0 ffff800004818b2d t1 0000000000000000 t2 0000000000000003 t3 0000000000000005
[   56.697747] t4 0000000000000000 t5 0000000000000000 t6 0000000000000000 t7 0000000000000000
[   56.697748] t8 0000000000000000 u0 0000000000000000 s9 0000000000000000 s0 900000011aa48028
[   56.697750] s1 0000000000000000 s2 0000000000000000 s3 ffff800004818e80 s4 ffff800004810000
[   56.697751] s5 90000001000b98d0 s6 ffff800004811f88 s7 ffff800005470440 s8 0000000000000000
[   56.697753]    ra: ffff800004f98a80 wacom_update_name+0xe0/0x300 [wacom]
[   56.697802]   ERA: 90000000066e35c8 strstr+0x28/0x120
[   56.697806]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
[   56.697816]  PRMD: 0000000c (PPLV0 +PIE +PWE)
[   56.697821]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
[   56.697827]  ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)
[   56.697831] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
[   56.697835]  BADV: 0000000000000000
[   56.697836]  PRID: 0014d000 (Loongson-64bit, Loongson-3A6000)
[   56.697838] Modules linked in: wacom(+) bnep bluetooth rfkill qrtr nls_iso8859_1 nls_cp437 snd_hda_codec_conexant snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore input_leds mousedev led_class joydev deepin_netmonitor(OE) fuse nfnetlink dmi_sysfs ip_tables x_tables overlay amdgpu amdxcp drm_exec gpu_sched drm_buddy radeon drm_suballoc_helper i2c_algo_bit drm_ttm_helper r8169 ttm drm_display_helper spi_loongson_pci xhci_pci cec xhci_pci_renesas spi_loongson_core hid_generic realtek gpio_loongson_64bit
[   56.697887] Process (udev-worker) (pid: 2742, threadinfo=00000000aee0d8b4, task=00000000a9eff1f3)
[   56.697890] Stack : 0000000000000000 ffff800004817e00 0000000000000000 0000251c00000000
[   56.697896]         0000000000000000 00000011fffffffd 0000000000000000 0000000000000000
[   56.697901]         0000000000000000 1b67a968695184b9 0000000000000000 90000001000b98d0
[   56.697906]         90000001000bb8d0 900000011aa48028 0000000000000000 ffff800004f9d74c
[   56.697911]         90000001000ba000 ffff800004f9ce58 0000000000000000 ffff800005470440
[   56.697916]         ffff800004811f88 90000001000b98d0 9000000100da2aa8 90000001000bb8d0
[   56.697921]         0000000000000000 90000001000ba000 900000011aa48028 ffff800004f9d74c
[   56.697926]         ffff8000054704e8 90000001000bb8b8 90000001000ba000 0000000000000000
[   56.697931]         90000001000bb8d0 9000000006307564 9000000005e666e0 90000001752359b8
[   56.697936]         9000000008cbe400 900000000804d000 9000000005e666e0 0000000000000000
[   56.697941]         ...
[   56.697944] Call Trace:
[   56.697945] [<90000000066e35c8>] strstr+0x28/0x120
[   56.697950] [<ffff800004f98a80>] wacom_update_name+0xe0/0x300 [wacom]
[   56.698000] [<ffff800004f9ce58>] wacom_parse_and_register+0x338/0x900 [wacom]
[   56.698050] [<ffff800004f9d74c>] wacom_probe+0x32c/0x420 [wacom]
[   56.698099] [<9000000006307564>] hid_device_probe+0x144/0x260
[   56.698103] [<9000000005e65d68>] really_probe+0x208/0x540
[   56.698109] [<9000000005e661dc>] __driver_probe_device+0x13c/0x1e0
[   56.698112] [<9000000005e66620>] driver_probe_device+0x40/0x100
[   56.698116] [<9000000005e6680c>] __device_attach_driver+0x12c/0x180
[   56.698119] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160
[   56.698123] [<9000000005e66468>] __device_attach+0x108/0x260
[   56.698126] [<9000000005e63918>] device_reprobe+0x78/0x100
[   56.698129] [<9000000005e62a68>] bus_for_each_dev+0x88/0x160
[   56.698132] [<9000000006304e54>] __hid_bus_driver_added+0x34/0x80
[   56.698134] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160
[   56.698137] [<9000000006304df0>] __hid_register_driver+0x70/0xa0
[   56.698142] [<9000000004e10fe4>] do_one_initcall+0x104/0x320
[   56.698146] [<9000000004f38150>] do_init_module+0x90/0x2c0
[   56.698151] [<9000000004f3a3d8>] init_module_from_file+0xb8/0x120
[   56.698155] [<9000000004f3a590>] idempotent_init_module+0x150/0x3a0
[   56.698159] [<9000000004f3a890>] sys_finit_module+0xb0/0x140
[   56.698163] [<900000000671e4e8>] do_syscall+0x88/0xc0
[   56.698166] [<9000000004e12404>] handle_syscall+0xc4/0x160
[   56.698171] Code: 0011958f  00150224  5800cd85 <2a00022c> 00150004  4000c180  0015022c  03400000  03400000
[   56.698192] ---[ end trace 0000000000000000 ]---

Fixes: 09dc28acae ("HID: wacom: Improve generic name generation")
Reported-by: Zhenxing Chen <chenzhenxing@uniontech.com>
Co-developed-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
Link: https://patch.msgid.link/B31757FE8E1544CF+20241125052616.18261-1-wangyuli@uniontech.com
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-11-28 14:40:42 +01:00
Kenny Levinsen
34851431ce HID: i2c-hid: Revert to using power commands to wake on resume
commit 7d6f065de3 ("HID: i2c-hid: Use address probe to wake on resume")
replaced the retry of power commands with the dummy read "bus probe" we
use on boot which accounts for a necessary delay before retry.

This made at least one Weida device (2575:0910 in an ASUS Vivobook S14)
very unhappy, as the bus probe despite being successful somehow lead to
the following power command failing so hard that the device never lets
go of the bus. This means that even retries of the power command would
fail on a timeout as the bus remains busy.

Remove the bus probe on resume and instead reintroduce retry of the
power command for wake-up purposes while respecting the newly
established wake-up retry timings.

Fixes: 7d6f065de3 ("HID: i2c-hid: Use address probe to wake on resume")
Cc: stable@vger.kernel.org
Reported-by: Michael <auslands-kv@gmx.de>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219440
Link: https://lore.kernel.org/r/d5acb485-7377-4139-826d-4df04d21b5ed@leemhuis.info/
Signed-off-by: Kenny Levinsen <kl@kl.wtf>
Link: https://patch.msgid.link/20241119235615.23902-1-kl@kl.wtf
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-11-28 11:18:14 +01:00
Linus Torvalds
919464deec Revert "HID: bpf: allow write access to quirks field in struct hid_device"
This reverts commit 6fd47effe9, and the related self-test update
commit e14e0eaeb0 ("selftests/hid: add test for assigning a given
device to hid-generic").

It results in things like the scroll wheel on Logitech mice not working
after a reboot due to the kernel being confused about the state of the
high-resolution mode.

Quoting Benjamin Tissoires:
 "The idea of 6fd47effe9 was to be able to call hid_bpf_rdesc_fixup()
  once per reprobe of the device.

  However, because the bpf filter can now change the quirk value, the
  call had to be moved before the driver gets bound (which was
  previously ensuring the unicity of the call).

  The net effect is that now, in the case hid-generic gets loaded first
  and then the specific driver gets loaded once the disk is available,
  the value of ->quirks is not reset, but kept to the value that was set
  by hid-generic (HID_QUIRK_INPUT_PER_APP).

  Once hid-logitech-hidpp kicks in, that quirk is now set, which creates
  two inputs for the single mouse: one keyboard for fancy shortcuts, and
  one mouse node.

  However, hid-logitech-hidpp expects only one input node to be attached
  (it stores it into hidpp->input), and when a wheel event is received,
  because there is some processing with high-resolution wheel events,
  the wheel event is injected into hidpp->input.

  And of course, when HID_QUIRK_INPUT_PER_APP is set, hidpp->input gets
  the keyboard node, which doesn't have wheel event type, and the events
  are ignored"

Reported-and-bisected-by: Mike Galbraith <efault@gmx.de>
Link: https://lore.kernel.org/all/CAHk-=wiUkQM3uheit2cNM0Y0OOY5qqspJgC8LkmOkJ2p2LDxcw@mail.gmail.com/
Acked-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-11-25 09:21:47 -08:00
Linus Torvalds
2fb7eb3d7e - Improved handling of LCD power states and interactions with the fbdev subsystem.
- Introduced new LCD_POWER_ constants to decouple the LCD subsystem from fbdev.
 - Several drivers were updated to use the new LCD_POWER_ constants.
 - Clarified the semantics of the lcd_ops.controls_device callback.
 - Removed unnecessary includes and dependencies.
 - Removed unused notifier functionality.
 - Simplified code with scoped for-each loops.
 - Fixed module autoloading for the ktz8866 driver.
 - Updated device tree bindings to yaml format.
 - Minor cleanups and improvements in various drivers.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmc/KTkACgkQUa+KL4f8
 d2HzWA//QtnboEtMOOt5hlY/MyGnwDG2nWWwbnlEVQ1zN3lQut4WWOocuyqIu6Wr
 tfRyLKOsiAWdjFi7NBQlV3ylNyyD4XU9/qNduOAMPe3VGj/lZB70coH+RL4L4JvX
 cSiue8vF9StX7gB7qxh1uVBastlCu9ofVZV4dFMD4hX+hA3SgBX5itmOfue9AMkm
 LXdA1DeDvigH5DMPIStHuQS0HVOxv06TJd1syzVBesa8G3raTwluTc16uPJkIwHd
 MnDqdvevaiW1ZnE3+8o2CmkLfFsB27iltwutXn9MbrUKBz0S7/ruNTib+RguFOaP
 Eo+ls0KIaiPH4xi0FuHlSiXKwszIvZ3GGeu3fO66k9m+vM2/IesBGgf0GR3Y8Lxr
 fwl4iNkLguKsBnLHBxhDnrQ3ltQiBw4q8Q2m/zQ4OoaW/sMX+514D3jOZmx3snE1
 ODE22bhoznRLyEAHisv4wA9snoAyvEItejczGC7HLJ0SbWUGBbqzHgvhjwMkh6R6
 0+6dJ22DTlSwZsyXcSkzA85ayiuxFLhwvD0nfxyGwUD//swg8L7ymnpVLOqpdJcc
 EgdVQeuaTij0UH9NutMDoIC1Z0SUMvpli1Wk0/Y1Hmg0vICZUUjewcli6VEbZGFu
 PKkkAeTPJaxfYWW64VHk6flSaW67VjqfiQ01F4oLlRwONcihpxM=
 =9n4l
 -----END PGP SIGNATURE-----

Merge tag 'backlight-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

Pull backlight updates from Lee Jones:

 - Improve handling of LCD power states and interactions with the fbdev
   subsystem

 - Introduce new LCD_POWER_ constants to decouple the LCD subsystem from
   fbdev

 - Update several drivers to use the new LCD_POWER_ constants

 - Clarify the semantics of the lcd_ops.controls_device callback

 - Remove unnecessary includes and dependencies

 - Remove unused notifier functionality

 - Simplify code with scoped for-each loops

 - Fix module autoloading for the ktz8866 driver

 - Update device tree bindings to yaml format

 - Minor cleanups and improvements in various drivers

* tag 'backlight-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (33 commits)
  MAINTAINERS: Use Daniel Thompson's korg address for Backlight work
  dt-bindings: backlight: Convert zii,rave-sp-backlight.txt to yaml
  backlight: Remove notifier
  backlight: ktz8866: Fix module autoloading
  backlight: 88pm860x_bl: Simplify with scoped for each OF child loop
  backlight: lcd: Do not include <linux/fb.h> in lcd header
  backlight: lcd: Remove struct fb_videomode from set_mode callback
  backlight: lcd: Replace check_fb with controls_device
  HID: picoLCD: Replace check_fb in favor of struct fb_info.lcd_dev
  fbdev: omap: Use lcd power constants
  fbdev: imxfb: Use lcd power constants
  fbdev: imxfb: Replace check_fb in favor of struct fb_info.lcd_dev
  fbdev: clps711x-fb: Use lcd power constants
  fbdev: clps711x-fb: Replace check_fb in favor of struct fb_info.lcd_dev
  backlight: tdo24m: Use lcd power constants
  backlight: platform_lcd: Use lcd power constants
  backlight: platform_lcd: Remove match_fb from struct plat_lcd_data
  backlight: platform_lcd: Remove include statement for <linux/backlight.h>
  backlight: otm3225a: Use lcd power constants
  backlight: ltv350qv: Use lcd power constants
  ...
2024-11-22 16:29:57 -08:00
Jiri Kosina
903796855b Merge branch 'for-6.13/bpf' into for-linus
- improvement of the way hid-bpf coexists with specific drivers (others than
  hid-generic) that are already bound to devices (Benjamin Tissoires)
2024-11-18 22:02:17 +01:00
Jiri Kosina
ffca1be9b4 Merge branch 'for-6.13/bug-on-to-warn-on' into for-linus
- removal of three way-too-aggressive BUG_ON()s from HID drivers (He Lugang)
2024-11-18 22:00:08 +01:00
Jiri Kosina
22380b5f03 Merge branch 'for-6.13/core' into for-linus
- assorted cleanups and small code fixes (Dmitry Torokhov, Yan Zhen,
  Nathan Chancellor, Andy Shevchenko)
2024-11-18 21:58:55 +01:00
Jiri Kosina
359bfdc3c9 Merge branch 'for-6.13/corsair' into for-linus
- support for Corsair Void headset family (Stuart Hayhurst)
2024-11-18 21:58:24 +01:00
Jiri Kosina
390b059ac7 Merge branch 'for-6.13/goodix' into for-linus
- Support for Goodix GT7986U SPI (Charles Wang)
- assorted code cleanups and fixes (Charles Wang)
2024-11-18 21:57:27 +01:00
Jiri Kosina
d273b820f7 Merge branch 'for-6.13/i2c-hid' into for-linus
- code cleanup (Uwe Kleine-König)
2024-11-18 21:56:39 +01:00
Jiri Kosina
9411aacd72 Merge branch 'for-6.13/intel-ish' into for-linus
- exposing firmware versions for Intel-ISH devices that load
  firmware from the host (Zhang Lixu)
- switch to flex-array members (Erick Archer)
2024-11-18 21:55:04 +01:00
Jiri Kosina
b14927b330 Merge branch 'for-6.13/kysona' into for-linus
- initial vendor-specific driver for Kysona, currently adding support for
  Kysona M600 (Lode Willems)
2024-11-18 21:53:30 +01:00
Jiri Kosina
a737d9d62d Merge branch 'for-6.13/logitech' into for-linus
- unused variable removal in hidpp_root_get_feature() (Bastien Nocera)
2024-11-18 21:52:49 +01:00
Jiri Kosina
65578513c3 Merge branch 'for-6.13/multitouch-v2' into for-linus
- code cleanup for mt_set_mode() (Dmitry Torokhov)
2024-11-18 21:51:47 +01:00
Dmitry Torokhov
e8a0581914 HID: multitouch: make mt_set_mode() less cryptic
mt_set_mode() accepts 2 boolean switches indicating whether the device
(if it follows Windows Precision Touchpad specification) should report
hardware buttons and/or surface contacts. For a casual reader it is
completely not clear, as they look at the call site, which exact mode
is being requested.

Define report_mode enum and change mt_set_mode() to accept is as
an argument instead. This allows to write:

	mt_set_modes(hdev, HID_LATENCY_NORMAL, TOUCHPAD_REPORT_ALL);

or

	mt_set_modes(hdev, HID_LATENCY_HIGH, TOUCHPAD_REPORT_BUTTONS);

which makes intent much more clear.

Reviewed-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/Zx_hBvg5Qa3KU3ta@google.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-11-18 21:49:47 +01:00
Jiri Kosina
873c578324 Merge branch 'for-6.13/steelseries' into for-linus
- bugfixes for Steelseries Arctis 1 battery level handling (Bastien Nocera)
2024-11-18 21:31:09 +01:00
Jiri Kosina
f33e46a0c6 Merge branch 'for-6.13/wacom' into for-linus
- Sanitization of BTN_TOOL_RUBBER handling (Jason Gerecke)
2024-11-18 21:29:33 +01:00
Charles Wang
c8eb2faef1 HID: hid-goodix-spi: Add OF supports
This patch introduces the following changes:
- Adds OF match table.
- Hardcodes hid-report-addr in the driver rather than fetching it
  from the device property.

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-13 10:56:37 +01:00
Vitaly Kuznetsov
66ef47faa9 HID: hyperv: streamline driver probe to avoid devres issues
It was found that unloading 'hid_hyperv' module results in a devres
complaint:

 ...
 hv_vmbus: unregistering driver hid_hyperv
 ------------[ cut here ]------------
 WARNING: CPU: 2 PID: 3983 at drivers/base/devres.c:691 devres_release_group+0x1f2/0x2c0
 ...
 Call Trace:
  <TASK>
  ? devres_release_group+0x1f2/0x2c0
  ? __warn+0xd1/0x1c0
  ? devres_release_group+0x1f2/0x2c0
  ? report_bug+0x32a/0x3c0
  ? handle_bug+0x53/0xa0
  ? exc_invalid_op+0x18/0x50
  ? asm_exc_invalid_op+0x1a/0x20
  ? devres_release_group+0x1f2/0x2c0
  ? devres_release_group+0x90/0x2c0
  ? rcu_is_watching+0x15/0xb0
  ? __pfx_devres_release_group+0x10/0x10
  hid_device_remove+0xf5/0x220
  device_release_driver_internal+0x371/0x540
  ? klist_put+0xf3/0x170
  bus_remove_device+0x1f1/0x3f0
  device_del+0x33f/0x8c0
  ? __pfx_device_del+0x10/0x10
  ? cleanup_srcu_struct+0x337/0x500
  hid_destroy_device+0xc8/0x130
  mousevsc_remove+0xd2/0x1d0 [hid_hyperv]
  device_release_driver_internal+0x371/0x540
  driver_detach+0xc5/0x180
  bus_remove_driver+0x11e/0x2a0
  ? __mutex_unlock_slowpath+0x160/0x5e0
  vmbus_driver_unregister+0x62/0x2b0 [hv_vmbus]
  ...

And the issue seems to be that the corresponding devres group is not
allocated. Normally, devres_open_group() is called from
__hid_device_probe() but Hyper-V HID driver overrides 'hid_dev->driver'
with 'mousevsc_hid_driver' stub and basically re-implements
__hid_device_probe() by calling hid_parse() and hid_hw_start() but not
devres_open_group(). hid_device_probe() does not call __hid_device_probe()
for it. Later, when the driver is removed, hid_device_remove() calls
devres_release_group() as it doesn't check whether hdev->driver was
initially overridden or not.

The issue seems to be related to the commit 62c68e7cee ("HID: ensure
timely release of driver-allocated resources") but the commit itself seems
to be correct.

Fix the issue by dropping the 'hid_dev->driver' override and using
hid_register_driver()/hid_unregister_driver() instead. Alternatively, it
would have been possible to rely on the default handling but
HID_CONNECT_DEFAULT implies HID_CONNECT_HIDRAW and it doesn't seem to work
for mousevsc as-is.

Fixes: 62c68e7cee ("HID: ensure timely release of driver-allocated resources")
Suggested-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-12 10:15:30 +01:00
Callahan Kovacs
87a2f10395 HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support
Adds driver support for the USB-C model of Apple's Magic Trackpad 2.

The 2024 USB-C model is compatible with the existing Magic Trackpad 2
driver but has a different hardware ID.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=219470
Signed-off-by: Callahan Kovacs <callahankovacs@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-11 22:49:28 +01:00
Linus Torvalds
0951fede4e hid-for-linus-20241105
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIUAwUAZyoK7KZi849r7WBJAQLkfQ/4j0xsITMeQyb7/rLVuYXcYwY6AANuxF26
 fn8At/VQoBWv4SQamyo1iWvc79mhG0I8hk4CojegpodsxurFYpjgSsDQbZGJk/ug
 bbBkIOchI1j2R564QFunDY4EtxlqJI4FaTKvIEmDKGlQ09saGieKskrPh1Gl/VXF
 M0t3EHgzV8snO5i7rD5/QlYp8fDpeqej5JQcaG68uP6L2PYxIw5mNqADQmXWT1v8
 D3D65rbABBxkSe0Z+nqgzle9tQgiK3HuAWJmGcXPOk5q+KlvZK4wSws7XgJiIJEB
 E6O7LVBRvd6izZdq0aNBmde4ggqN78ORNzfTrzVCVbDmEZvLnpBi1It3RStkZjKq
 59rVbo5WUoGUzQc/hr9coYkW0eBPVLGHHWzx6DhlK3stxzPi+YRoJdZpzqIpQMXN
 4wuykQcPRYDE94uTFhVL3w7WGzG6IGLdufZJW49C/PknXaxue1fakd0mc1VrHfhE
 g6Oy4u4CuACCowUGruRPCUV88czsIS+apRwNYDvjxZBUmVvbXUjuDhlnzIkvO1wb
 ZCk7ZpeedIu6rTa38OI7wKHyhunJtVjd520bW07bUchGqWp+MGcCexM0+oQA5owF
 vTCOx9vOnRPnyng9+9LNPvKdNzfrO4q/5sDxKaJkrg0mpQlFOssq7AUJ2BwmRHBF
 /zC+TjdCnw==
 =q7n/
 -----END PGP SIGNATURE-----

Merge tag 'hid-for-linus-20241105' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fix from Jiri Kosina:

 - report buffer sanitization fix for HID core (Jiri Kosina)

* tag 'hid-for-linus-20241105' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: core: zero-initialize the report buffer
2024-11-06 07:49:54 -10:00
Vincent Huang
ae117e622a HID: rmi: Add select RMI4_F3A in Kconfig
Add `select RMI4_F3A` under `HID_RMI` in Kconfig to support buttons and GPIOs
on newer Synaptics HID RMI devices. Future devices will use F3A instead of F30,
but F30 is still selected for backward compatibility.

Signed-off-by: Vincent Huang <vincenth@synaptics.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-06 17:23:54 +01:00
Jason Gerecke
49a397ad24 HID: wacom: Interpret tilt data from Intuos Pro BT as signed values
The tilt data contained in the Bluetooth packets of an Intuos Pro are
supposed to be interpreted as signed values. Simply casting the values
to type `char` is not guaranteed to work since it is implementation-
defined whether it is signed or unsigned. At least one user has noticed
the data being reported incorrectly on their system. To ensure that the
data is interpreted properly, we specifically cast to `signed char`
instead.

Link: https://github.com/linuxwacom/input-wacom/issues/445
Fixes: 4922cd26f0 ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface")
CC: stable@vger.kernel.org # 4.11+
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-06 15:56:35 +01:00
Bastien Nocera
8ee0f23e26 HID: steelseries: Add capacity_level mapping
The capacity level mappings are taken from:
https://support.steelseries.com/hc/en-us/articles/360049205612-How-do-I-know-the-Arctis-battery-level-how-do-I-charge-the-Arctis

Even if we have a percentage, exporting a capacity_level that matches
with the hardware warning levels means that upower can show warnings at
the same time as the hardware. So the headset starts beeping at the same
time as the critical warning notification appears :eyeroll:

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-06 15:10:32 +01:00
Bastien Nocera
138a339e39 HID: steelseries: Fix battery requests stopping after some time
In some cases, the headset receiver will answer one of our requests with
garbage, or not at all. This is a problem when we only request battery
information once we've received a battery response, as we might never
get to request battery information again.

If the data from the receiver could not be parsed, and there's no
pending battery requests, schedule a new request.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-06 15:10:32 +01:00
Charles Wang
253ed2740b HID: hid-goodix: Fix HID get/set feature operation overwritten problem
Implement the hid get/set feature report function using a separate
address, rather than sharing an address with coordinate reporting, to
prevent feature events from being overwritten by coordinate events.

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-06 15:08:31 +01:00
Charles Wang
be8f7f2281 HID: hid-goodix: Return 0 when receiving an empty HID feature package
Align with the i2c-hid driver by returning 0 instead of -EINVAL when
an empty response is received, ensuring that userspace programs utilizing
the hidraw node receive consistent return values.

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-11-06 15:08:31 +01:00
Jiri Kosina
177f25d129 HID: core: zero-initialize the report buffer
Since the report buffer is used by all kinds of drivers in various ways, let's
zero-initialize it during allocation to make sure that it can't be ever used
to leak kernel memory via specially-crafted report.

Fixes: 27ce405039 ("HID: fix data access in implement()")
Reported-by: Benoît Sevens <bsevens@google.com>
Acked-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-29 15:44:42 +01:00
Linus Torvalds
c9a50b9090 hid-for-linus-20241024
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIVAwUAZxq4J6Zi849r7WBJAQKPXA//UcjmEV+wEiRwFw/YNx4MvDSbiVYCsLO9
 v2ZhPuiikZOyKzgUxT8+E6b4VHl6YXvkbUrPMjCEDno5VVST+1p78ifJbm0CFh35
 r3OWFbtC/GGBznmZM1p7fuNYS6ORQOfyegHrtvR60Y7S39EdJplpQ0qtsrQlugJw
 GiSLtzUAMM1Zx84g/AlSXERvAnu1aYYNlbk3DCQOagAPj1/uoo707ec7xp2rG6Rq
 F5+rQG5NpZddQX6jeYYjmW3bcE7NWEEt0rOVEjwnWWR1Q9dDRE0rq7EgrLR8rJnP
 5V1KFK7vXYci8zxcvFRWTO/0l4FMi6mVud/fc6FaflQueuj8ZRL8vSjP8EjtTYFl
 H2b2HLfeqdQgjCEErzQWW/5E67ViIfGQp7Qvtwkb8e6rz3ayzV0+mExXrOT0V0K4
 dG8NhwV0ZFVZrLVEO0oDmy8JZBfEigRNobHP3lCBDNhtNUQL/qarKD+xbIDtm0oX
 6pXBHQ1PJ1kidqCcyx3IkY0gnKgj1mtUeOSstGcj+yR4AomhLCexGNVM8nh7znE3
 NpVY6ohj2Zci4uCWuw2tUXFXi7hA8A0QzVd5WUKYGP9FxPf5dZCakfOaLVvdSeuo
 bYnMFgbFwxE+7yzB7UcMfEP0q+wDM643TZehI+6mYRO6DPONBIrBNm/1EoabasU5
 T5gVUmde2a0=
 =JyBC
 -----END PGP SIGNATURE-----

Merge tag 'hid-for-linus-20241024' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fixes from Jiri Kosina:
 "Device-specific functionality quirks for Thinkpad X1 Gen3, Logitech
  Bolt and some Goodix touchpads (Bartłomiej Maryńczak, Hans de Goede
  and Kenneth Albanowski)"

* tag 'hid-for-linus-20241024' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: lenovo: Add support for Thinkpad X1 Tablet Gen 3 keyboard
  HID: multitouch: Add quirk for Logitech Bolt receiver w/ Casa touchpad
  HID: i2c-hid: Delayed i2c resume wakeup for 0x0d42 Goodix touchpad
2024-10-24 16:31:58 -07:00
Benjamin Tissoires
b6d8c474e2 HID: bpf: drop use of Logical|Physical|UsageRange
Replace with individual Minimum/Maximum calls to match the HID report
descriptor - HID doesn't have a Range field. Abstracting this is good
for hand-written descriptors but almost all tools will output min/max
instead so let's stick with that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jiri Kosina <jkosina@suse.com>
Link: https://patch.msgid.link/20241017-import_bpf_6-13-v2-3-6a7acb89a97f@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-10-18 14:37:33 +02:00
Benjamin Tissoires
cee9faff2f HID: bpf: Fix Rapoo M50 Plus Silent side buttons
The Rapoo M50 Plus Silent mouse has 2 side buttons in addition to the
left, right and middles buttons. However, its original HID descriptor
has a Usage Maximum of 3, preventing the side buttons to work.

This HID-BPF driver changes that usage to 5.

Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1015
Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/116
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.com>
Link: https://patch.msgid.link/20241017-import_bpf_6-13-v2-2-6a7acb89a97f@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-10-18 14:37:33 +02:00
Benjamin Tissoires
9bc089307e HID: bpf: Fix NKRO on Mistel MD770
Mistel MD770 keyboard (using Holtek Semiconductor, Inc. controller) has
a quirk in report descriptor in one of its interfaces (more detail in
the source file). Fix up the descriptor to allow NKRO to work again.

Tested by loading the BPF program and confirming that 8 simultaneous
keypresses work.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=218495
Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/122
Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.com>
Link: https://patch.msgid.link/20241017-import_bpf_6-13-v2-1-6a7acb89a97f@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-10-18 14:37:33 +02:00
He Lugang
2e592244c4 HID: replace BUG_ON() with WARN_ON()
There is no need to kill the system entirely in HID with BUG_ON,
use WARN_ON to handle fault more gracefully which allow the system
to keep running.

Signed-off-by: He Lugang <helugang@uniontech.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:50:08 +02:00
Jason Gerecke
a025b0dbd8 HID: wacom: Set eraser status when either 'Eraser' or 'Invert' usage is set
Microsoft defines two slightly different behaviors for pens that are
being used to erase. The first one, for pens that can be used while
inverted specifies that both 'Invert' and 'Eraser' usages should be
set while the pen is in contact and erasing. For pens that use an
eraser button though, they specify that only the 'Eraser' usage should
be set (while hovering, only the 'Invert' usage is to be set).

We used our internal 'invert_state' flag to determine if a pen has an
intent to erase (whether hovering or not). That flag was previously
only depending on the 'Invert' usage, which was sufficient for the
first type of pen (EMR) but not the second type (AES). This commit
makes the flag depend on either usage being set, and also renames it
to make its function more clear.

This change should not normally have an impact on userspace due to
both the existing driver and firmware design. The driver already only
determines tool type based on the first event in an interaction (e.g.
it will see the 'Invert' bit set when the eraser comes into prox and
then report BTN_TOOL_RUBBER for the rest of the interaction, even if
'Invert' is cleared). AES firmware is also careful to send reports
that work through a set of defined state transitions, even in the
corner-case where the eraser button is pressed when the pen is already
in contact with the display (Prox|Tip -> Prox -> 0 -> Invert -> Eraser).
Regardless, it seems reasonable to ensure the driver's state variables
match programmer expectation.

Link: https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:48:35 +02:00
Hans de Goede
51268879eb HID: lenovo: Add support for Thinkpad X1 Tablet Gen 3 keyboard
The Thinkpad X1 Tablet Gen 3 keyboard has the same Lenovo specific quirks
as the original  Thinkpad X1 Tablet keyboard.

Add the PID for the "Thinkpad X1 Tablet Gen 3 keyboard" to the hid-lenovo
driver to fix the FnLock, Mute and media buttons not working.

Suggested-by: Izhar Firdaus <izhar@fedoraproject.org>
Closes https://bugzilla.redhat.com/show_bug.cgi?id=2315395
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:36:11 +02:00
Kenneth Albanowski
526748b925 HID: multitouch: Add quirk for Logitech Bolt receiver w/ Casa touchpad
The Logitech Casa Touchpad does not reliably send touch release signals
when communicating through the Logitech Bolt wireless-to-USB receiver.

Adjusting the device class to add MT_QUIRK_NOT_SEEN_MEANS_UP to make
sure that no touches become stuck, MT_QUIRK_FORCE_MULTI_INPUT is not
needed, but harmless.

Linux does not have information on which devices are connected to the
Bolt receiver, so we have to enable this for the entire device.

Signed-off-by: Kenneth Albanowski <kenalba@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:33:47 +02:00
Bartłomiej Maryńczak
293c485cba HID: i2c-hid: Delayed i2c resume wakeup for 0x0d42 Goodix touchpad
Patch for Goodix 27c6:0d42 touchpads found in Inspiron 5515 laptops.

After resume from suspend, one can communicate with this device just fine.
We can read data from it or request a reset,
but for some reason the interrupt line will not go up
when new events are available.
(it can correctly respond to a reset with an interrupt tho)

The only way I found to wake this device up
is to send anything to it after ~1.5s mark,
for example a simple read request, or power mode change.

In this patch, I simply delay the resume steps with msleep,
this will cause the set_power request to happen after
the ~1.5s barrier causing the device to resume its event interrupts.

Sleep was used rather than delayed_work
to make this workaround as non-invasive as possible.

[jkosina@suse.com: shortlog update]
Signed-off-by: Bartłomiej Maryńczak <marynczakbartlomiej@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:32:06 +02:00
Lode Willems
9372b6c4ed HID: Kysona: add basic online status
Wait for a response to the battery status request to set the device as
online. This prevent wrong power info when the dongle is connected but
the mouse is turned off.

Signed-off-by: Lode Willems <me@lodewillems.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:28:40 +02:00
Lode Willems
94ec1cd82f HID: Kysona: check battery status every 5s using a workqueue
Use a workqueue to periodically check the battery status

Signed-off-by: Lode Willems <me@lodewillems.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:28:40 +02:00
Lode Willems
30c32d0529 HID: Kysona: Add basic battery reporting for Kysona M600
In this initial the battery is only probed once, a following patch will add
periodic checking.

Signed-off-by: Lode Willems <me@lodewillems.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:28:40 +02:00
Lode Willems
ff39b0bbc2 HID: Add IDs for Kysona
Add the vendor ID for Kysona and the product IDs for the M600 mouse
(both the dongle and the mouse itself)

Signed-off-by: Lode Willems <me@lodewillems.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:28:40 +02:00
Andy Shevchenko
7b2daa648e HID: debug: Remove duplicates from 'keys'
Duplicates in 'keys prevents kernel builds with clang, `make W=1` and
CONFIG_WERROR=y, for example:

drivers/hid/hid-debug.c:3443:18: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
 3443 |         [KEY_HANGEUL] = "HanGeul",              [KEY_HANGUP_PHONE] = "HangUpPhone",
      |                         ^~~~~~~~~
drivers/hid/hid-debug.c:3217:18: note: previous initialization is here
 3217 |         [KEY_HANGUEL] = "Hangeul",              [KEY_HANJA] = "Hanja",
      |                         ^~~~~~~~~

Fix this by removing them.

The logic of removal is that, remove...
1) if there is a constant that uses another defined constant, OR
2) the one that appears later in the list.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-18 12:24:52 +02:00
Nathan Chancellor
b2b8a75e1d HID: Remove default case statement in fetch_item()
A default case statement with a bare unreachable() was recently added to
fetch_item(), which by itself introduces undefined behavior. objtool
points this out with a few different warnings, depending on
configuration and compiler:

  vmlinux.o: warning: objtool: fetch_item() falls through to next function ...

  vmlinux.o: warning: objtool: hid_open_report() falls through to next function hid_parser_main()
  vmlinux.o: warning: objtool: hid_scan_report() falls through to next function hid_allocate_device()

  vmlinux.o: warning: objtool: hid_open_report+0x21b: can't find jump dest instruction at .text.hid_open_report+0x40f

Replacing unreachable() with BUG() is a typical fix to eliminate the
undefined behavior and make the default case well defined. However, in
this case, all possible values are enumerated in the switch statement,
so the default case can never actually happen, as proven with the
comment next to the item->size assignment. Just remove the default case
altogether, as the return statement would still be valid if the switch
statement were ever to be skipped.

Fixes: 61595012f2 ("HID: simplify code in fetch_item()")
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Closes: https://lore.kernel.org/20241010222451.GA3571761@thelio-3990X/
Reported-by: Paul E. McKenney <paulmck@kernel.org>
Closes: https://lore.kernel.org/fe8c909e-bf02-4466-b3eb-0a4747df32e3@paulmck-laptop/
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-16 10:15:50 +02:00
Linus Torvalds
6485cf5ea2 hid-for-linus-2024101301
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIVAwUAZww7rKZi849r7WBJAQI63g/+MJwCtLFv+kDZtmzrmf3jJKtyzxW5JNh4
 ZjfJwp2EGhpbb7ei8PSIyMU2UBXbS285uMz6/LQBE8Y73OuTN90Y5YRHDsxAL3kB
 8itEUkA+HmHDmDEUvVa0Xu9MAZRQN8u7uQEwTZ/PeqMEgKr5eVZ1jPw7qupthxO4
 5QPVyONYuQv8HutJ+BqeRu33z3c/DX044lDec/V2dHpPJ1oxI59z1dUwEWLLKvNb
 hgvbbYdzITyR5SiFTZWYES23S+YOU7/yabDmkOcWgTmLNPUfNYUxiyxqIUzvI6tp
 QU30PAyu5uKuBCDMry/7QNTsOWj7yuOtRMm1BlMwUzEsRYwwXFS64LUJnNY7IcRH
 siS1tikcrklrRdl8g5VkHRCV0knR7eo58l+luDExDH20xYwI8aa/122aU8uxueAe
 sct7Aqut2KD/VPOQkqnxUbEJ8x4Rh+jiLI3LwRGgyAmS9xXCu87T2BucyEKTfHYi
 ZRgwmDJTq5psc77FJybnAsqjChDh3xVK5TPHDWhWdyp5/Yp5u7LHVd2ZVcjbyK7E
 GcUasyu2PvKlgQMXMVqbEipLEbN9EaztQpb1N+OQnzxVt1yklJcR8taBqsA84jxO
 Seo1g1c2ttxnOh4AgcndQwgStfvj08YHIjDgNT2vMQ2V1PhxjLo0UzopMODWa77k
 lp1GNfHWLgk=
 =HKsr
 -----END PGP SIGNATURE-----

Merge tag 'hid-for-linus-2024101301' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fixes from Jiri Kosina:

 - fix for memory corruption regression in amd_sfh driver (Basavaraj
   Natikar)

 - fix for mis-reporting of BTN_TOOL_PEN and BTN_TOOL_RUBBER for AES
   sensors tools in Wacom driver (Jason Gerecke)

 - fix for unitialized variable use in intel-ish-hid driver
   (SurajSonawane2415)

 - a few device-specific quirks / device ID additions

* tag 'hid-for-linus-2024101301' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: wacom: Hardcode (non-inverted) AES pens as BTN_TOOL_PEN
  HID: amd_sfh: Switch to device-managed dmam_alloc_coherent()
  HID: multitouch: Add quirk for HONOR MagicBook Art 14 touchpad
  HID: multitouch: Add support for B2402FVA track point
  HID: plantronics: Workaround for an unexcepted opposite volume key
  hid: intel-ish-hid: Fix uninitialized variable 'rv' in ish_fw_xfer_direct_dma
2024-10-13 16:35:20 -07:00
Zhang Lixu
ac0cba6837 HID: intel-ish-hid: Add firmware version sysfs attributes
Introduce sysfs attributes to the intel-ish-ipc driver to expose the base
and project firmware versions for ISH devices that load firmware from the
host.

The build tool embeds these versions into the ISH global manifest within
the firmware binary during the firmware build process. The driver, upon
loading the firmware, extracts this version information from the manifest
and makes it accessible via sysfs. The base version corresponds to the
firmware version provided in Intel's Firmware Development Kit (FDK), while
the project version reflects the vendor-customized firmware derived from
the FDK.

These attributes provide userspace tools and applications with the
ability to easily query the firmware versions, which is essential for
firmware validation and troubleshooting.

Example usages:
  $ cat /sys/devices/pci0000\:00/0000\:00\:12.0/firmware/base_version
  5.8.0.7716

  $ cat /sys/devices/pci0000\:00/0000\:00\:12.0/firmware/project_version
  5.8.0.12472

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-10-11 13:17:01 +02:00