summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-04-30 18:57:51 +0200
committerHans de Goede <hdegoede@redhat.com>2023-05-09 12:29:50 +0200
commit711bcc0cb34e96a60e88d7b0260862781de3e530 (patch)
tree731abb5cd029a658353a606f072ca29b6e7d3728 /drivers/platform
parentplatform/x86: lenovo-yogabook: Fix work race on remove() (diff)
downloadlinux-711bcc0cb34e96a60e88d7b0260862781de3e530.tar.xz
linux-711bcc0cb34e96a60e88d7b0260862781de3e530.zip
platform/x86: lenovo-yogabook: Reprobe devices on remove()
Ensure that both the keyboard touchscreen and the digitizer have their driver bound after remove(). Without this modprobing lenovo-yogabook-wmi after a rmmod fails because lenovo-yogabook-wmi defers probing until both devices have their driver bound. Fixes: c0549b72d99d ("platform/x86: lenovo-yogabook-wmi: Add driver for Lenovo Yoga Book") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230430165807.472798-4-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/lenovo-yogabook-wmi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/platform/x86/lenovo-yogabook-wmi.c b/drivers/platform/x86/lenovo-yogabook-wmi.c
index 3a6de4ab74a4..5948ffa74acd 100644
--- a/drivers/platform/x86/lenovo-yogabook-wmi.c
+++ b/drivers/platform/x86/lenovo-yogabook-wmi.c
@@ -332,9 +332,20 @@ error_put_devs:
static void yogabook_wmi_remove(struct wmi_device *wdev)
{
struct yogabook_wmi *data = dev_get_drvdata(&wdev->dev);
+ int r = 0;
free_irq(data->backside_hall_irq, data);
cancel_work_sync(&data->work);
+
+ if (!test_bit(YB_KBD_IS_ON, &data->flags))
+ r |= device_reprobe(data->kbd_dev);
+
+ if (!test_bit(YB_DIGITIZER_IS_ON, &data->flags))
+ r |= device_reprobe(data->dig_dev);
+
+ if (r)
+ dev_warn(&wdev->dev, "Reprobe of devices failed\n");
+
put_device(data->dig_dev);
put_device(data->kbd_dev);
acpi_dev_put(data->dig_adev);