[PATCH v1 2/4] platform/x86/intel/hid: Stop creating a platform device

Rafael J. Wysocki posted 1 patch 1 month, 3 weeks ago
drivers/platform/x86/intel/hid.c |   41 ---------------------------------------
1 file changed, 1 insertion(+), 40 deletions(-)
[PATCH v1 2/4] platform/x86/intel/hid: Stop creating a platform device
Posted by Rafael J. Wysocki 1 month, 3 weeks ago
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Now that "system" devices are represented as platform devices, they
are not claimed by the PNP ACPI scan handler any more and the Intel
HID platform devices should be created by the ACPI core, so the
driver does not need to attempt to create a platform device by
itself.

Accordingly, make it stop doing so.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/intel/hid.c |   41 ---------------------------------------
 1 file changed, 1 insertion(+), 40 deletions(-)

--- a/drivers/platform/x86/intel/hid.c
+++ b/drivers/platform/x86/intel/hid.c
@@ -767,43 +767,4 @@ static struct platform_driver intel_hid_
 	.remove = intel_hid_remove,
 };
 
-/*
- * Unfortunately, some laptops provide a _HID="INT33D5" device with
- * _CID="PNP0C02".  This causes the pnpacpi scan driver to claim the
- * ACPI node, so no platform device will be created.  The pnpacpi
- * driver rejects this device in subsequent processing, so no physical
- * node is created at all.
- *
- * As a workaround until the ACPI core figures out how to handle
- * this corner case, manually ask the ACPI platform device code to
- * claim the ACPI node.
- */
-static acpi_status __init
-check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
-{
-	const struct acpi_device_id *ids = context;
-	struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
-
-	if (dev && acpi_match_device_ids(dev, ids) == 0)
-		if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
-			dev_info(&dev->dev,
-				 "intel-hid: created platform device\n");
-
-	return AE_OK;
-}
-
-static int __init intel_hid_init(void)
-{
-	acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-			    ACPI_UINT32_MAX, check_acpi_dev, NULL,
-			    (void *)intel_hid_ids, NULL);
-
-	return platform_driver_register(&intel_hid_pl_driver);
-}
-module_init(intel_hid_init);
-
-static void __exit intel_hid_exit(void)
-{
-	platform_driver_unregister(&intel_hid_pl_driver);
-}
-module_exit(intel_hid_exit);
+module_platform_driver(intel_hid_pl_driver);
Re: [PATCH v1 2/4] platform/x86/intel/hid: Stop creating a platform device
Posted by Andy Shevchenko 1 month, 1 week ago
On Mon, Dec 15, 2025 at 02:35:05PM +0100, Rafael J. Wysocki wrote:
> 
> Now that "system" devices are represented as platform devices, they
> are not claimed by the PNP ACPI scan handler any more and the Intel
> HID platform devices should be created by the ACPI core, so the
> driver does not need to attempt to create a platform device by
> itself.
> 
> Accordingly, make it stop doing so.
> 
> No intentional functional impact.

...

>  	.remove = intel_hid_remove,
>  };

>  

This blank line now can also be removed as the module_platform_driver() coupled
with the above structure initialiser.

> -/*
> - * Unfortunately, some laptops provide a _HID="INT33D5" device with
> - * _CID="PNP0C02".  This causes the pnpacpi scan driver to claim the
> - * ACPI node, so no platform device will be created.  The pnpacpi
> - * driver rejects this device in subsequent processing, so no physical
> - * node is created at all.
> - *
> - * As a workaround until the ACPI core figures out how to handle
> - * this corner case, manually ask the ACPI platform device code to
> - * claim the ACPI node.
> - */
> -static acpi_status __init
> -check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
> -{
> -	const struct acpi_device_id *ids = context;
> -	struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
> -
> -	if (dev && acpi_match_device_ids(dev, ids) == 0)
> -		if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
> -			dev_info(&dev->dev,
> -				 "intel-hid: created platform device\n");
> -
> -	return AE_OK;
> -}
> -
> -static int __init intel_hid_init(void)
> -{
> -	acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
> -			    ACPI_UINT32_MAX, check_acpi_dev, NULL,
> -			    (void *)intel_hid_ids, NULL);
> -
> -	return platform_driver_register(&intel_hid_pl_driver);
> -}
> -module_init(intel_hid_init);
> -
> -static void __exit intel_hid_exit(void)
> -{
> -	platform_driver_unregister(&intel_hid_pl_driver);
> -}
> -module_exit(intel_hid_exit);
> +module_platform_driver(intel_hid_pl_driver);

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v1 2/4] platform/x86/intel/hid: Stop creating a platform device
Posted by Rafael J. Wysocki 1 month, 1 week ago
On Sun, Dec 28, 2025 at 8:13 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Dec 15, 2025 at 02:35:05PM +0100, Rafael J. Wysocki wrote:
> >
> > Now that "system" devices are represented as platform devices, they
> > are not claimed by the PNP ACPI scan handler any more and the Intel
> > HID platform devices should be created by the ACPI core, so the
> > driver does not need to attempt to create a platform device by
> > itself.
> >
> > Accordingly, make it stop doing so.
> >
> > No intentional functional impact.
>
> ...
>
> >       .remove = intel_hid_remove,
> >  };
>
> >
>
> This blank line now can also be removed as the module_platform_driver() coupled
> with the above structure initialiser.
>
> > -/*
> > - * Unfortunately, some laptops provide a _HID="INT33D5" device with
> > - * _CID="PNP0C02".  This causes the pnpacpi scan driver to claim the
> > - * ACPI node, so no platform device will be created.  The pnpacpi
> > - * driver rejects this device in subsequent processing, so no physical
> > - * node is created at all.
> > - *
> > - * As a workaround until the ACPI core figures out how to handle
> > - * this corner case, manually ask the ACPI platform device code to
> > - * claim the ACPI node.
> > - */
> > -static acpi_status __init
> > -check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
> > -{
> > -     const struct acpi_device_id *ids = context;
> > -     struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
> > -
> > -     if (dev && acpi_match_device_ids(dev, ids) == 0)
> > -             if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
> > -                     dev_info(&dev->dev,
> > -                              "intel-hid: created platform device\n");
> > -
> > -     return AE_OK;
> > -}
> > -
> > -static int __init intel_hid_init(void)
> > -{
> > -     acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
> > -                         ACPI_UINT32_MAX, check_acpi_dev, NULL,
> > -                         (void *)intel_hid_ids, NULL);
> > -
> > -     return platform_driver_register(&intel_hid_pl_driver);
> > -}
> > -module_init(intel_hid_init);
> > -
> > -static void __exit intel_hid_exit(void)
> > -{
> > -     platform_driver_unregister(&intel_hid_pl_driver);
> > -}
> > -module_exit(intel_hid_exit);
> > +module_platform_driver(intel_hid_pl_driver);

Feel free to send a patch to remove it then, perhaps along with the
one in the other driver.
Re: [PATCH v1 2/4] platform/x86/intel/hid: Stop creating a platform device
Posted by Andy Shevchenko 1 month, 1 week ago
On Mon, Dec 29, 2025 at 02:07:23PM +0100, Rafael J. Wysocki wrote:
> On Sun, Dec 28, 2025 at 8:13 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Dec 15, 2025 at 02:35:05PM +0100, Rafael J. Wysocki wrote:

...

> > >       .remove = intel_hid_remove,
> > >  };
> >
> > This blank line now can also be removed as the module_platform_driver() coupled
> > with the above structure initialiser.

> Feel free to send a patch to remove it then, perhaps along with the
> one in the other driver.

If it's already applied the mention change would be just a churn, no need to
bother with it.

-- 
With Best Regards,
Andy Shevchenko