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
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]>
---
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
On Tue, Aug 30, 2022 at 3:58 PM Stephen Boyd <[email protected]> wrote:
>
> 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]>
Acked-by: Prashant Malani <[email protected]>
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]>
---
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
On Tue, Aug 30, 2022 at 3:58 PM Stephen Boyd <[email protected]> wrote:
>
> 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]>
Acked-by: Prashant Malani <[email protected]>
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]>
---
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
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]>
---
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
Hello:
This series was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <[email protected]>:
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
Hello:
This series was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <[email protected]>:
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