public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check
@ 2023-01-04  6:08 Prashant Malani
  2023-01-04  6:08 ` [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag Prashant Malani
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Prashant Malani @ 2023-01-04  6:08 UTC (permalink / raw)
  To: linux-kernel, chrome-platform; +Cc: Prashant Malani, Benson Leung

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(-)

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag
  2023-01-04  6:08 [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Prashant Malani
@ 2023-01-04  6:08 ` Prashant Malani
  2023-01-05 18:46   ` Benson Leung
  2023-01-05 18:44 ` [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Benson Leung
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Prashant Malani @ 2023-01-04  6:08 UTC (permalink / raw)
  To: linux-kernel, chrome-platform; +Cc: Prashant Malani, Benson Leung

Not all ports have retimers. Only register a retimer switch if the
"retimer-switch" property is present for that port's mux
device.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
---
 drivers/platform/chrome/cros_typec_switch.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index 2536bda03bf3..9ed1605f4071 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -246,14 +246,16 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
 		port->port_num = index;
 		sdata->ports[index] = port;
 
-		ret = cros_typec_register_retimer(port, fwnode);
-		if (ret) {
-			dev_err(dev, "Retimer switch register failed\n");
-			goto err_switch;
+		if (fwnode_property_present(fwnode, "retimer-switch")) {
+			ret = cros_typec_register_retimer(port, fwnode);
+			if (ret) {
+				dev_err(dev, "Retimer switch register failed\n");
+				goto err_switch;
+			}
+
+			dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
 		}
 
-		dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
-
 		if (!fwnode_property_present(fwnode, "mode-switch"))
 			continue;
 
-- 
2.39.0.314.g84b9a713c41-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check
  2023-01-04  6:08 [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Prashant Malani
  2023-01-04  6:08 ` [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag Prashant Malani
@ 2023-01-05 18:44 ` Benson Leung
  2023-01-10 20:50 ` patchwork-bot+chrome-platform
  2023-01-13 21:20 ` patchwork-bot+chrome-platform
  3 siblings, 0 replies; 6+ messages in thread
From: Benson Leung @ 2023-01-05 18:44 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, chrome-platform

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
>
>


-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag
  2023-01-04  6:08 ` [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag Prashant Malani
@ 2023-01-05 18:46   ` Benson Leung
  0 siblings, 0 replies; 6+ messages in thread
From: Benson Leung @ 2023-01-05 18:46 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, chrome-platform

Hi Prashant,

On Tue, Jan 3, 2023 at 10:09 PM Prashant Malani <pmalani@chromium.org> wrote:
>
> Not all ports have retimers. Only register a retimer switch if the
> "retimer-switch" property is present for that port's mux
> device.
>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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

Thanks,
Benson

> ---
>  drivers/platform/chrome/cros_typec_switch.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
> index 2536bda03bf3..9ed1605f4071 100644
> --- a/drivers/platform/chrome/cros_typec_switch.c
> +++ b/drivers/platform/chrome/cros_typec_switch.c
> @@ -246,14 +246,16 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
>                 port->port_num = index;
>                 sdata->ports[index] = port;
>
> -               ret = cros_typec_register_retimer(port, fwnode);
> -               if (ret) {
> -                       dev_err(dev, "Retimer switch register failed\n");
> -                       goto err_switch;
> +               if (fwnode_property_present(fwnode, "retimer-switch")) {
> +                       ret = cros_typec_register_retimer(port, fwnode);
> +                       if (ret) {
> +                               dev_err(dev, "Retimer switch register failed\n");
> +                               goto err_switch;
> +                       }
> +
> +                       dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
>                 }
>
> -               dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
> -
>                 if (!fwnode_property_present(fwnode, "mode-switch"))
>                         continue;
>
> --
> 2.39.0.314.g84b9a713c41-goog
>


-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check
  2023-01-04  6:08 [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Prashant Malani
  2023-01-04  6:08 ` [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag Prashant Malani
  2023-01-05 18:44 ` [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Benson Leung
@ 2023-01-10 20:50 ` patchwork-bot+chrome-platform
  2023-01-13 21:20 ` patchwork-bot+chrome-platform
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-01-10 20:50 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, chrome-platform, bleung

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check
  2023-01-04  6:08 [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Prashant Malani
                   ` (2 preceding siblings ...)
  2023-01-10 20:50 ` patchwork-bot+chrome-platform
@ 2023-01-13 21:20 ` patchwork-bot+chrome-platform
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-01-13 21:20 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, chrome-platform, bleung

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-13 21:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04  6:08 [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Prashant Malani
2023-01-04  6:08 ` [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag Prashant Malani
2023-01-05 18:46   ` Benson Leung
2023-01-05 18:44 ` [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Benson Leung
2023-01-10 20:50 ` patchwork-bot+chrome-platform
2023-01-13 21:20 ` patchwork-bot+chrome-platform

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox