All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch
@ 2022-08-30 22:58 Stephen Boyd
  2022-08-30 22:58 ` [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk Stephen Boyd
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Stephen Boyd @ 2022-08-30 22:58 UTC (permalink / raw)
  To: Prashant Malani, Benson Leung
  Cc: linux-kernel, patches, chrome-platform, Tzung-Bi Shih

A small cleanup patch pile for the new cros_typec_switch driver.

Stephen Boyd (4):
  platform/chrome: cros_typec_switch: Add missing newline on printk
  platform/chrome: cros_typec_switch: Remove impossible condition
  platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
  platform/chrome: cros_typec_switch: Inline DRV_NAME

 drivers/platform/chrome/cros_typec_switch.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)


base-commit: 1a8912caba02522f612d465a4849ce98915b96ad
-- 
https://chromeos.dev


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

* [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk
  2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
@ 2022-08-30 22:58 ` Stephen Boyd
  2022-08-30 23:04   ` Prashant Malani
  2022-08-30 22:58 ` [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition Stephen Boyd
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Stephen Boyd @ 2022-08-30 22:58 UTC (permalink / raw)
  To: Prashant Malani, Benson Leung
  Cc: linux-kernel, patches, chrome-platform, Tzung-Bi Shih

We need a newline here to ensure the next printk starts fresh.

Cc: Prashant Malani <pmalani@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Fixes: affc804c44c8 ("platform/chrome: cros_typec_switch: Add switch driver")
Signed-off-by: Stephen Boyd <swboyd@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 f85687adb594..383daf2c66b7 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -244,7 +244,7 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
 		}
 
 		if (index < 0 || index >= EC_USB_PD_MAX_PORTS) {
-			dev_err(fwnode->dev, "Invalid port index number: %llu", index);
+			dev_err(fwnode->dev, "Invalid port index number: %llu\n", index);
 			ret = -EINVAL;
 			goto err_switch;
 		}
-- 
https://chromeos.dev


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

* [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition
  2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
  2022-08-30 22:58 ` [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk Stephen Boyd
@ 2022-08-30 22:58 ` Stephen Boyd
  2022-08-30 23:05   ` Prashant Malani
  2022-08-30 22:58 ` [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify Stephen Boyd
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Stephen Boyd @ 2022-08-30 22:58 UTC (permalink / raw)
  To: Prashant Malani, Benson Leung
  Cc: linux-kernel, patches, chrome-platform, Tzung-Bi Shih

The type of 'index' is unsigned long long, which can't possibly be less
than zero. Remove the impossible check.

Cc: Prashant Malani <pmalani@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@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 383daf2c66b7..3381d842c307 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -243,7 +243,7 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
 			goto err_switch;
 		}
 
-		if (index < 0 || index >= EC_USB_PD_MAX_PORTS) {
+		if (index >= EC_USB_PD_MAX_PORTS) {
 			dev_err(fwnode->dev, "Invalid port index number: %llu\n", index);
 			ret = -EINVAL;
 			goto err_switch;
-- 
https://chromeos.dev


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

* [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
  2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
  2022-08-30 22:58 ` [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk Stephen Boyd
  2022-08-30 22:58 ` [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition Stephen Boyd
@ 2022-08-30 22:58 ` Stephen Boyd
  2022-08-30 23:05   ` Prashant Malani
  2022-08-30 22:58 ` [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME Stephen Boyd
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Stephen Boyd @ 2022-08-30 22:58 UTC (permalink / raw)
  To: Prashant Malani, Benson Leung
  Cc: linux-kernel, patches, chrome-platform, Tzung-Bi Shih

Use the standard error pointer macro to shorten the code and simplify.

Cc: Prashant Malani <pmalani@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_typec_switch.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index 3381d842c307..09ad0d268f4b 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -185,10 +185,8 @@ static int cros_typec_register_mode_switch(struct cros_typec_port *port,
 	};
 
 	port->mode_switch = typec_mux_register(port->sdata->dev, &mode_switch_desc);
-	if (IS_ERR(port->mode_switch))
-		return PTR_ERR(port->mode_switch);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(port->mode_switch);
 }
 
 static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwnode_handle *fwnode)
@@ -201,10 +199,8 @@ static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwno
 	};
 
 	port->retimer = typec_retimer_register(port->sdata->dev, &retimer_desc);
-	if (IS_ERR(port->retimer))
-		return PTR_ERR(port->retimer);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(port->retimer);
 }
 
 static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
-- 
https://chromeos.dev


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

* [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME
  2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
                   ` (2 preceding siblings ...)
  2022-08-30 22:58 ` [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify Stephen Boyd
@ 2022-08-30 22:58 ` Stephen Boyd
  2022-08-30 23:06   ` Prashant Malani
  2022-09-01  2:20 ` [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch patchwork-bot+chrome-platform
  2022-09-08  0:40 ` patchwork-bot+chrome-platform
  5 siblings, 1 reply; 11+ messages in thread
From: Stephen Boyd @ 2022-08-30 22:58 UTC (permalink / raw)
  To: Prashant Malani, Benson Leung
  Cc: linux-kernel, patches, chrome-platform, Tzung-Bi Shih

This macro is only used one place, let's inline it instead to save a
line or two.

Cc: Prashant Malani <pmalani@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_typec_switch.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index 09ad0d268f4b..a26219e97c93 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -18,8 +18,6 @@
 #include <linux/usb/typec_mux.h>
 #include <linux/usb/typec_retimer.h>
 
-#define DRV_NAME "cros-typec-switch"
-
 /* Handles and other relevant data required for each port's switches. */
 struct cros_typec_port {
 	int port_num;
@@ -309,7 +307,7 @@ MODULE_DEVICE_TABLE(acpi, cros_typec_switch_acpi_id);
 
 static struct platform_driver cros_typec_switch_driver = {
 	.driver	= {
-		.name = DRV_NAME,
+		.name = "cros-typec-switch",
 		.acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id),
 	},
 	.probe = cros_typec_switch_probe,
-- 
https://chromeos.dev


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

* Re: [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk
  2022-08-30 22:58 ` [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk Stephen Boyd
@ 2022-08-30 23:04   ` Prashant Malani
  0 siblings, 0 replies; 11+ messages in thread
From: Prashant Malani @ 2022-08-30 23:04 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Benson Leung, linux-kernel, patches, chrome-platform, Tzung-Bi Shih

On Tue, Aug 30, 2022 at 3:58 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> We need a newline here to ensure the next printk starts fresh.
>
> Cc: Prashant Malani <pmalani@chromium.org>
> Cc: Tzung-Bi Shih <tzungbi@kernel.org>
> Fixes: affc804c44c8 ("platform/chrome: cros_typec_switch: Add switch driver")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Prashant Malani <pmalani@chromium.org>

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

* Re: [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition
  2022-08-30 22:58 ` [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition Stephen Boyd
@ 2022-08-30 23:05   ` Prashant Malani
  0 siblings, 0 replies; 11+ messages in thread
From: Prashant Malani @ 2022-08-30 23:05 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Benson Leung, linux-kernel, patches, chrome-platform, Tzung-Bi Shih

On Tue, Aug 30, 2022 at 3:58 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> The type of 'index' is unsigned long long, which can't possibly be less
> than zero. Remove the impossible check.
>
> Cc: Prashant Malani <pmalani@chromium.org>
> Cc: Tzung-Bi Shih <tzungbi@kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Prashant Malani <pmalani@chromium.org>

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

* Re: [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
  2022-08-30 22:58 ` [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify Stephen Boyd
@ 2022-08-30 23:05   ` Prashant Malani
  0 siblings, 0 replies; 11+ messages in thread
From: Prashant Malani @ 2022-08-30 23:05 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Benson Leung, linux-kernel, patches, chrome-platform, Tzung-Bi Shih

On Tue, Aug 30, 2022 at 3:58 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Use the standard error pointer macro to shorten the code and simplify.
>
> Cc: Prashant Malani <pmalani@chromium.org>
> Cc: Tzung-Bi Shih <tzungbi@kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Prashant Malani <pmalani@chromium.org>

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

* Re: [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME
  2022-08-30 22:58 ` [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME Stephen Boyd
@ 2022-08-30 23:06   ` Prashant Malani
  0 siblings, 0 replies; 11+ messages in thread
From: Prashant Malani @ 2022-08-30 23:06 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Benson Leung, linux-kernel, patches, chrome-platform, Tzung-Bi Shih

Thanks for the cleanups!

On Tue, Aug 30, 2022 at 3:58 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> This macro is only used one place, let's inline it instead to save a
> line or two.
>
> Cc: Prashant Malani <pmalani@chromium.org>
> Cc: Tzung-Bi Shih <tzungbi@kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Prashant Malani <pmalani@chromium.org>

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

* Re: [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch
  2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
                   ` (3 preceding siblings ...)
  2022-08-30 22:58 ` [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME Stephen Boyd
@ 2022-09-01  2:20 ` patchwork-bot+chrome-platform
  2022-09-08  0:40 ` patchwork-bot+chrome-platform
  5 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+chrome-platform @ 2022-09-01  2:20 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: pmalani, bleung, linux-kernel, patches, chrome-platform, tzungbi

Hello:

This series was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Tue, 30 Aug 2022 15:58:27 -0700 you wrote:
> A small cleanup patch pile for the new cros_typec_switch driver.
> 
> Stephen Boyd (4):
>   platform/chrome: cros_typec_switch: Add missing newline on printk
>   platform/chrome: cros_typec_switch: Remove impossible condition
>   platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
>   platform/chrome: cros_typec_switch: Inline DRV_NAME
> 
> [...]

Here is the summary with links:
  - [1/4] platform/chrome: cros_typec_switch: Add missing newline on printk
    https://git.kernel.org/chrome-platform/c/8dab6a593919
  - [2/4] platform/chrome: cros_typec_switch: Remove impossible condition
    https://git.kernel.org/chrome-platform/c/bbb5fb85cf48
  - [3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
    https://git.kernel.org/chrome-platform/c/dc22a33e3585
  - [4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME
    https://git.kernel.org/chrome-platform/c/20dfb7478309

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] 11+ messages in thread

* Re: [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch
  2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
                   ` (4 preceding siblings ...)
  2022-09-01  2:20 ` [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch patchwork-bot+chrome-platform
@ 2022-09-08  0:40 ` patchwork-bot+chrome-platform
  5 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+chrome-platform @ 2022-09-08  0:40 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: pmalani, bleung, linux-kernel, patches, chrome-platform, tzungbi

Hello:

This series was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Tue, 30 Aug 2022 15:58:27 -0700 you wrote:
> A small cleanup patch pile for the new cros_typec_switch driver.
> 
> Stephen Boyd (4):
>   platform/chrome: cros_typec_switch: Add missing newline on printk
>   platform/chrome: cros_typec_switch: Remove impossible condition
>   platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
>   platform/chrome: cros_typec_switch: Inline DRV_NAME
> 
> [...]

Here is the summary with links:
  - [1/4] platform/chrome: cros_typec_switch: Add missing newline on printk
    https://git.kernel.org/chrome-platform/c/8dab6a593919
  - [2/4] platform/chrome: cros_typec_switch: Remove impossible condition
    https://git.kernel.org/chrome-platform/c/bbb5fb85cf48
  - [3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
    https://git.kernel.org/chrome-platform/c/dc22a33e3585
  - [4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME
    https://git.kernel.org/chrome-platform/c/20dfb7478309

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] 11+ messages in thread

end of thread, other threads:[~2022-09-08  0:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
2022-08-30 22:58 ` [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk Stephen Boyd
2022-08-30 23:04   ` Prashant Malani
2022-08-30 22:58 ` [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition Stephen Boyd
2022-08-30 23:05   ` Prashant Malani
2022-08-30 22:58 ` [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify Stephen Boyd
2022-08-30 23:05   ` Prashant Malani
2022-08-30 22:58 ` [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME Stephen Boyd
2022-08-30 23:06   ` Prashant Malani
2022-09-01  2:20 ` [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch patchwork-bot+chrome-platform
2022-09-08  0:40 ` patchwork-bot+chrome-platform

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.