diff mbox series

[1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check

Message ID 20230104060846.112216-1-pmalani@chromium.org (mailing list archive)
State Accepted
Commit ef9c00dbd383d2b68207cc996caa05c25c7894f5
Headers show
Series [1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check | expand

Commit Message

Prashant Malani Jan. 4, 2023, 6:08 a.m. UTC
Using device_property_present() multiple times on an ACPI device
leads to kernel panics on Chromebook systems. This happens when there
is > 1 boolean property in an ACPI device which is created dynamically
by the BIOS as part of SSDT[1] on Chromebook systems

Since fwnode_* can handle simple device tree properties equally
well, switch to using the fwnode_property_present() function
version. This will avoid panics and make the usage consistent
when we introduce a check for the 2nd property in a subsequent patch.

[1] https://wiki.osdev.org/SSDT

Signed-off-by: Prashant Malani <pmalani@chromium.org>
---
 drivers/platform/chrome/cros_typec_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Benson Leung Jan. 5, 2023, 6:44 p.m. UTC | #1
Hi Prashant,

On Tue, Jan 3, 2023 at 10:09 PM Prashant Malani <pmalani@chromium.org> wrote:
>
> Using device_property_present() multiple times on an ACPI device
> leads to kernel panics on Chromebook systems. This happens when there
> is > 1 boolean property in an ACPI device which is created dynamically
> by the BIOS as part of SSDT[1] on Chromebook systems
>
> Since fwnode_* can handle simple device tree properties equally
> well, switch to using the fwnode_property_present() function
> version. This will avoid panics and make the usage consistent
> when we introduce a check for the 2nd property in a subsequent patch.
>
> [1] https://wiki.osdev.org/SSDT
>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

Reviewed-by: Benson Leung <bleung@chromium.org>

Thanks,
Benson

> ---
>  drivers/platform/chrome/cros_typec_switch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
> index a26219e97c93..2536bda03bf3 100644
> --- a/drivers/platform/chrome/cros_typec_switch.c
> +++ b/drivers/platform/chrome/cros_typec_switch.c
> @@ -254,7 +254,7 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
>
>                 dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
>
> -               if (!device_property_present(fwnode->dev, "mode-switch"))
> +               if (!fwnode_property_present(fwnode, "mode-switch"))
>                         continue;
>
>                 ret = cros_typec_register_mode_switch(port, fwnode);
> --
> 2.39.0.314.g84b9a713c41-goog
>
>
patchwork-bot+chrome-platform@kernel.org Jan. 10, 2023, 8:50 p.m. UTC | #2
Hello:

This series was applied to chrome-platform/linux.git (for-kernelci)
by Prashant Malani <pmalani@chromium.org>:

On Wed,  4 Jan 2023 06:08:44 +0000 you wrote:
> Using device_property_present() multiple times on an ACPI device
> leads to kernel panics on Chromebook systems. This happens when there
> is > 1 boolean property in an ACPI device which is created dynamically
> by the BIOS as part of SSDT[1] on Chromebook systems
> 
> Since fwnode_* can handle simple device tree properties equally
> well, switch to using the fwnode_property_present() function
> version. This will avoid panics and make the usage consistent
> when we introduce a check for the 2nd property in a subsequent patch.
> 
> [...]

Here is the summary with links:
  - [1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check
    https://git.kernel.org/chrome-platform/c/ef9c00dbd383
  - [2/2] platform/chrome: cros_typec_switch: Check for retimer flag
    https://git.kernel.org/chrome-platform/c/441529bed41c

You are awesome, thank you!
patchwork-bot+chrome-platform@kernel.org Jan. 13, 2023, 9:20 p.m. UTC | #3
Hello:

This series was applied to chrome-platform/linux.git (for-next)
by Prashant Malani <pmalani@chromium.org>:

On Wed,  4 Jan 2023 06:08:44 +0000 you wrote:
> Using device_property_present() multiple times on an ACPI device
> leads to kernel panics on Chromebook systems. This happens when there
> is > 1 boolean property in an ACPI device which is created dynamically
> by the BIOS as part of SSDT[1] on Chromebook systems
> 
> Since fwnode_* can handle simple device tree properties equally
> well, switch to using the fwnode_property_present() function
> version. This will avoid panics and make the usage consistent
> when we introduce a check for the 2nd property in a subsequent patch.
> 
> [...]

Here is the summary with links:
  - [1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check
    https://git.kernel.org/chrome-platform/c/ef9c00dbd383
  - [2/2] platform/chrome: cros_typec_switch: Check for retimer flag
    https://git.kernel.org/chrome-platform/c/441529bed41c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index a26219e97c93..2536bda03bf3 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -254,7 +254,7 @@  static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
 
 		dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
 
-		if (!device_property_present(fwnode->dev, "mode-switch"))
+		if (!fwnode_property_present(fwnode, "mode-switch"))
 			continue;
 
 		ret = cros_typec_register_mode_switch(port, fwnode);