| From: |
| Dave Carey <carvsdriver-AT-gmail.com> |
| To: |
| platform-driver-x86-AT-vger.kernel.org |
| Subject: |
| [PATCH v8 0/2] platform/x86/lenovo: Yoga Book 9 keyboard dock detection |
| Date: |
| Wed, 10 Jun 2026 11:53:38 -0400 |
| Message-ID: |
| <20260610155340.342949-1-carvsdriver@gmail.com> |
| Cc: |
| ilpo.jarvinen-AT-linux.intel.com, hansg-AT-kernel.org |
| Archive-link: |
| Article |
Hi Ilpo,
Thank you for the v7 review. All nine items are addressed in v8.
One item needs a brief explanation: for the mutex lifecycle, I used
__MUTEX_INITIALIZER(yb9.lock) in the struct definition rather than
devm_mutex_init(). The yb9 struct is a module-level global with no
associated device at __init time, and since yb9_kbdock_block_probe()
acquires the lock and can run before yb9_kbdock_event_probe(), the
mutex must be valid before either probe runs. Static initialization
achieves the same goal (no manual init/destroy lifecycle) without
requiring a device pointer. If you'd prefer a different approach,
please let me know.
Changes in v8:
- Add #include <linux/bits.h> (required for GENMASK).
- Add #include <linux/dev_printk.h> (explicit include for dev_warn/dev_dbg).
- Use __MUTEX_INITIALIZER(yb9.lock) for static mutex initialization;
removes mutex_init() call and the need for mutex_destroy().
- Update wmidev_query_block() call to pass min_size=8; remove manual
length check now handled by the WMI core.
- Move u8 *data __free(kfree) declaration to immediately after the
successful wmidev_query_block() call (cleanup.h convention).
- Change data type from void * to u8 * to allow pointer arithmetic
without cast.
- Remove (int) cast from FIELD_GET() return value.
- Remove blank line between yb9_kbdock_query_locked() call and error
check in keyboard_position_show().
- Use %d format specifier in sysfs_emit(); remove (unsigned int) cast.
Patch 1/2 (lenovo-ymc) is unchanged from v7.
Tested on Lenovo Yoga Book 9 14IAH10 (model 83KJ), kernel 7.0.
Dave Carey (2):
platform/x86/lenovo: lenovo-ymc: Suppress probe on Yoga Book 9 14IAH10
platform/x86/lenovo: Add Yoga Book 9 keyboard dock detection driver
.../testing/sysfs-driver-lenovo-yb9-kbdock | 19 ++
MAINTAINERS | 7 +
drivers/platform/x86/lenovo/Kconfig | 14 +
drivers/platform/x86/lenovo/Makefile | 1 +
drivers/platform/x86/lenovo/yb9-kbdock.c | 312 ++++++++++++++++++
drivers/platform/x86/lenovo/ymc.c | 19 ++
6 files changed, 372 insertions(+)
--
2.54.0