platform/chrome: Check ACPI_COMPANION() against NULL at probe time
Subsystems (3)
Rafael J. Wysocki
maintainercover platform/chrome: Check ACPI_COMPANION() against NULL at probe time
Hi All,
This series fixes up three platform/chrome drivers recently converted to platform drivers to make them check the devices' ACPI companion objects at probe time.
Thanks!
Rafael J. Wysocki
maintainerPATCH 1/3 platform/chrome: chromeos_privacy_screen: Check ACPI_COMPANION()
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.
Accordingly, add a requisite ACPI_COMPANION() check against NULL to the chromeos_privacy_screen driver.
--- drivers/platform/chrome/chromeos_privacy_screen.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/chrome/chromeos_privacy_screen.c +3 -0
@@ -104,6 +104,9 @@ static const struct drm_privacy_screen_ostatic int chromeos_privacy_screen_probe (struct platform_device *pdev) { +if (!ACPI_COMPANION (&pdev->dev)) +return -ENODEV ; +struct drm_privacy_screen *drm_privacy_screen = drm_privacy_screen_register(&pdev->dev, &chromeos_privacy_screen_ops,
Rafael J. Wysocki
maintainerPATCH 2/3 platform/chrome: chromeos_tbmc: Check ACPI_COMPANION()
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.
Accordingly, add a requisite ACPI_COMPANION() check against NULL to the chromeos_tbmc driver.
--- drivers/platform/chrome/chromeos_tbmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/chrome/chromeos_tbmc.c +5 -1
@@ -69,9 +69,13 @@ static int chromeos_tbmc_probe(struct pl {struct input_dev *idev;struct device *dev = &pdev->dev; -struct acpi_device *adev =ACPI_COMPANION (dev); +struct acpi_device *adev;int ret; + adev =ACPI_COMPANION (dev); +if (!adev) +return -ENODEV ; + idev =devm_input_allocate_device (dev);if (!idev)return -ENOMEM ;
Rafael J. Wysocki
maintainerPATCH 3/3 platform/chrome: wilco_ec: event: Check ACPI_COMPANION()
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.
Accordingly, add a requisite ACPI_COMPANION() check against NULL to the wilco_ec event driver.
--- drivers/platform/chrome/wilco_ec/event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/platform/chrome/wilco_ec/event.c +6 -2
@@ -452,8 +452,13 @@ static void hangup_device(struct event_dstatic int event_device_probe (struct platform_device *pdev) {struct event_device_data *dev_data; +struct acpi_device *adev;int error, minor; + adev =ACPI_COMPANION (&pdev->dev); +if (!adev) +return -ENODEV ; + minor =ida_alloc_max (&event_ida,EVENT_MAX_DEV -1 ,GFP_KERNEL );if (minor <0 ) { error = minor;
@@ -494,8 +499,7 @@ static int event_device_probe(struct pla goto free_dev_data;/* Install an ACPI notify handler. */ - error =acpi_dev_install_notify_handler (ACPI_COMPANION (&pdev->dev), -ACPI_DEVICE_NOTIFY , + error =acpi_dev_install_notify_handler (adev,ACPI_DEVICE_NOTIFY , event_device_notify, &pdev->dev);if (error) goto free_cdev;
Tzung-Bi Shih
maintainerQuoted 8 lines · Rafael J. Wysocki
Hi All,
This series fixes up three platform/chrome drivers recently converted to platform drivers to make them check the devices' ACPI companion objects at probe time.
Thanks!
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next
[1/3] platform/chrome: chromeos_privacy_screen: Check ACPI_COMPANION()
commit: 8a4a217f617b1ac2f8c095f33efd67d947ddb2cf
[2/3] platform/chrome: chromeos_tbmc: Check ACPI_COMPANION()
commit: c15dbae7c856fb53cc6ffb86c6c64ebb816d07c8
[3/3] platform/chrome: wilco_ec: event: Check ACPI_COMPANION()
commit: 51dcff9796fd486d7abf01081ca62e4072789e9dThanks!