platform/chrome: Minor cleanups to cros_typec_switch
cover platform/chrome: Minor cleanups to cros_typec_switch
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
Signature · 1 line
https://chromeos.dev
PATCH 1/4 platform/chrome: cros_typec_switch: Add missing newline on printk
We need a newline here to ensure the next printk starts fresh.
--- drivers/platform/chrome/cros_typec_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/chrome/cros_typec_switch.c +1 -1
@@ -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; }
Signature · 1 line
https://chromeos.dev
Re: [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk
Quoted 7 lines · Stephen Boyd
We need a newline here to ensure the next printk starts fresh.
Cc Prashant Malani <[email protected]>Cc Tzung-Bi Shih <[email protected]>Fixes affc804c44c8 ("platform/chrome: cros_typec_switch: Add switch driver")Signed-off-by Stephen Boyd <[email protected]>
PATCH 2/4 platform/chrome: cros_typec_switch: Remove impossible condition
In reply to Stephen BoydThe type of 'index' is unsigned long long, which can't possibly be less than zero. Remove the impossible check.
--- drivers/platform/chrome/cros_typec_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/chrome/cros_typec_switch.c +1 -1
@@ -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;
Signature · 1 line
https://chromeos.dev
Re: [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition
Quoted 7 lines · Stephen Boyd
The type of 'index' is unsigned long long, which can't possibly be less than zero. Remove the impossible check.
Cc Prashant Malani <[email protected]>Cc Tzung-Bi Shih <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
PATCH 3/4 platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
In reply to Stephen BoydUse the standard error pointer macro to shorten the code and simplify.
--- drivers/platform/chrome/cros_typec_switch.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/platform/chrome/cros_typec_switch.c +2 -6
@@ -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)
Signature · 1 line
https://chromeos.dev
Re: [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
Quoted 6 lines · Stephen Boyd
Use the standard error pointer macro to shorten the code and simplify.
Cc Prashant Malani <[email protected]>Cc Tzung-Bi Shih <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
PATCH 4/4 platform/chrome: cros_typec_switch: Inline DRV_NAME
In reply to Stephen BoydThis macro is only used one place, let's inline it instead to save a line or two.
--- drivers/platform/chrome/cros_typec_switch.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/platform/chrome/cros_typec_switch.c +1 -3
@@ -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,
Signature · 1 line
https://chromeos.dev
Re: [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME
Thanks for the cleanups!
Quoted 7 lines · Stephen Boyd
This macro is only used one place, let's inline it instead to save a line or two.
Cc Prashant Malani <[email protected]>Cc Tzung-Bi Shih <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
This series was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:
Hello:
This series was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:
Quoted 9 lines · On Tue, 30 Aug 2022 15:58:27 -0700 you wrote:
A small cleanup patch pile for the new
cros_typec_switchdriver.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: UsePTR_ERR_OR_ZERO()to simplify platform/chrome:cros_typec_switch: InlineDRV_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
This series was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:
Hello:
This series was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:
Quoted 9 lines · On Tue, 30 Aug 2022 15:58:27 -0700 you wrote:
A small cleanup patch pile for the new
cros_typec_switchdriver.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: UsePTR_ERR_OR_ZERO()to simplify platform/chrome:cros_typec_switch: InlineDRV_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html