]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: portwell-ec: Move watchdog device under correct platform hierarchy
authorIvan Hu <ivan.hu@canonical.com>
Mon, 16 Jun 2025 07:48:19 +0000 (15:48 +0800)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 17 Jun 2025 12:31:40 +0000 (15:31 +0300)
Without explicitly setting a parent for the watchdog device, the device is
registered with a NULL parent. This causes device_add() (called internally
by devm_watchdog_register_device()) to register the device under
/sys/devices/virtual, since no parent is provided. The result is:

DEVPATH=/devices/virtual/watchdog/watchdog0

To fix this, assign &pdev->dev as the parent of the watchdog device before
calling devm_watchdog_register_device(). This ensures the device is
associated with the Portwell EC platform device and placed correctly in
sysfs as:

DEVPATH=/devices/platform/portwell-ec/watchdog/watchdog0

This aligns the device hierarchy with expectations and avoids misplacement
under the virtual class.

Fixes: 835796753310 ("platform/x86: portwell-ec: Add GPIO and WDT driver for Portwell EC")
Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
Link: https://lore.kernel.org/r/20250616074819.63547-1-ivan.hu@canonical.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/portwell-ec.c

index 8b788822237b0668d507b3654dc0bb80f2cc7a7e..3e019c51913e1d2a8919b60bba1c076b226db3d7 100644 (file)
@@ -236,6 +236,7 @@ static int pwec_probe(struct platform_device *pdev)
                return ret;
        }
 
+       ec_wdt_dev.parent = &pdev->dev;
        ret = devm_watchdog_register_device(&pdev->dev, &ec_wdt_dev);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to register Portwell EC Watchdog\n");