patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] platform/chrome: Random driver cleanups
@ 2023-10-03  0:34 Stephen Boyd
  2023-10-03  0:34 ` [PATCH 1/4] platform/chrome: cros_ec_typec: Use semi-colons instead of commas Stephen Boyd
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-10-03  0:34 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih; +Cc: linux-kernel, patches, chrome-platform

Here's some random chromeos driver cleanups that have been sitting in my
tree. I've noticed them while browsing the code for something I'm
working on.

Stephen Boyd (4):
  platform/chrome: cros_ec_typec: Use semi-colons instead of commas
  platform/chrome: cros_ec_typec: Use dev_err_probe() more
  platform/chrome: cros_typec_vdm: Mark port_amode_ops const
  platform/chrome: cros_ec_proto: Mark outdata as const

 drivers/platform/chrome/cros_ec_proto.c     |  2 +-
 drivers/platform/chrome/cros_ec_typec.c     | 18 +++++++++---------
 drivers/platform/chrome/cros_typec_vdm.c    |  2 +-
 drivers/platform/chrome/cros_typec_vdm.h    |  2 +-
 include/linux/platform_data/cros_ec_proto.h |  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)


base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
-- 
https://chromeos.dev


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

* [PATCH 1/4] platform/chrome: cros_ec_typec: Use semi-colons instead of commas
  2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
@ 2023-10-03  0:34 ` Stephen Boyd
  2023-10-03  0:34 ` [PATCH 2/4] platform/chrome: cros_ec_typec: Use dev_err_probe() more Stephen Boyd
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-10-03  0:34 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih
  Cc: linux-kernel, patches, chrome-platform, Prashant Malani

These should be semi-colons so that one statement is per line.

Cc:  Prashant Malani <pmalani@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_ec_typec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index d0b4d3fc40ed..82e7d08b52c7 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -271,9 +271,9 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
 	struct typec_altmode *amode;
 
 	/* All PD capable CrOS devices are assumed to support DP altmode. */
-	desc.svid = USB_TYPEC_DP_SID,
-	desc.mode = USB_TYPEC_DP_MODE,
-	desc.vdo = DP_PORT_VDO,
+	desc.svid = USB_TYPEC_DP_SID;
+	desc.mode = USB_TYPEC_DP_MODE;
+	desc.vdo = DP_PORT_VDO;
 	amode = typec_port_register_altmode(port->port, &desc);
 	if (IS_ERR(amode))
 		return PTR_ERR(amode);
@@ -287,8 +287,8 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
 	 * here for now.
 	 */
 	memset(&desc, 0, sizeof(desc));
-	desc.svid = USB_TYPEC_TBT_SID,
-	desc.mode = TYPEC_ANY_MODE,
+	desc.svid = USB_TYPEC_TBT_SID;
+	desc.mode = TYPEC_ANY_MODE;
 	amode = typec_port_register_altmode(port->port, &desc);
 	if (IS_ERR(amode))
 		return PTR_ERR(amode);
-- 
https://chromeos.dev


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

* [PATCH 2/4] platform/chrome: cros_ec_typec: Use dev_err_probe() more
  2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
  2023-10-03  0:34 ` [PATCH 1/4] platform/chrome: cros_ec_typec: Use semi-colons instead of commas Stephen Boyd
@ 2023-10-03  0:34 ` Stephen Boyd
  2023-10-03  0:34 ` [PATCH 3/4] platform/chrome: cros_typec_vdm: Mark port_amode_ops const Stephen Boyd
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-10-03  0:34 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih
  Cc: linux-kernel, patches, chrome-platform, Prashant Malani

There's some debug prints here that can be upgraded to dev_err_probe()
so that we don't have to fish out the error messages when a true error
happens. If they're simply probe defers then the kernel will keep silent
but if they're true errors we'll see the errors in the logs.

Cc: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_ec_typec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 82e7d08b52c7..67000e4a8082 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -80,28 +80,28 @@ static int cros_typec_get_switch_handles(struct cros_typec_port *port,
 	port->mux = fwnode_typec_mux_get(fwnode);
 	if (IS_ERR(port->mux)) {
 		ret = PTR_ERR(port->mux);
-		dev_dbg(dev, "Mux handle not found: %d.\n", ret);
+		dev_err_probe(dev, ret, "Mux handle not found\n");
 		goto mux_err;
 	}
 
 	port->retimer = fwnode_typec_retimer_get(fwnode);
 	if (IS_ERR(port->retimer)) {
 		ret = PTR_ERR(port->retimer);
-		dev_dbg(dev, "Retimer handle not found: %d.\n", ret);
+		dev_err_probe(dev, ret, "Retimer handle not found\n");
 		goto retimer_sw_err;
 	}
 
 	port->ori_sw = fwnode_typec_switch_get(fwnode);
 	if (IS_ERR(port->ori_sw)) {
 		ret = PTR_ERR(port->ori_sw);
-		dev_dbg(dev, "Orientation switch handle not found: %d\n", ret);
+		dev_err_probe(dev, ret, "Orientation switch handle not found\n");
 		goto ori_sw_err;
 	}
 
 	port->role_sw = fwnode_usb_role_switch_get(fwnode);
 	if (IS_ERR(port->role_sw)) {
 		ret = PTR_ERR(port->role_sw);
-		dev_dbg(dev, "USB role switch handle not found: %d\n", ret);
+		dev_err_probe(dev, ret, "USB role switch handle not found\n");
 		goto role_sw_err;
 	}
 
-- 
https://chromeos.dev


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

* [PATCH 3/4] platform/chrome: cros_typec_vdm: Mark port_amode_ops const
  2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
  2023-10-03  0:34 ` [PATCH 1/4] platform/chrome: cros_ec_typec: Use semi-colons instead of commas Stephen Boyd
  2023-10-03  0:34 ` [PATCH 2/4] platform/chrome: cros_ec_typec: Use dev_err_probe() more Stephen Boyd
@ 2023-10-03  0:34 ` Stephen Boyd
  2023-10-03  0:34 ` [PATCH 4/4] platform/chrome: cros_ec_proto: Mark outdata as const Stephen Boyd
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-10-03  0:34 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih
  Cc: linux-kernel, patches, chrome-platform, Prashant Malani

Mark this struct of functions const so it moves to RO memory.

Cc: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_typec_vdm.c | 2 +-
 drivers/platform/chrome/cros_typec_vdm.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_typec_vdm.c b/drivers/platform/chrome/cros_typec_vdm.c
index 20515ee0a20e..3f632fd35000 100644
--- a/drivers/platform/chrome/cros_typec_vdm.c
+++ b/drivers/platform/chrome/cros_typec_vdm.c
@@ -142,7 +142,7 @@ static int cros_typec_port_amode_vdm(struct typec_altmode *amode, const u32 hdr,
 			   sizeof(req), NULL, 0);
 }
 
-struct typec_altmode_ops port_amode_ops = {
+const struct typec_altmode_ops port_amode_ops = {
 	.enter = cros_typec_port_amode_enter,
 	.vdm = cros_typec_port_amode_vdm,
 };
diff --git a/drivers/platform/chrome/cros_typec_vdm.h b/drivers/platform/chrome/cros_typec_vdm.h
index 95a6a75d32b6..631bd2ce4b00 100644
--- a/drivers/platform/chrome/cros_typec_vdm.h
+++ b/drivers/platform/chrome/cros_typec_vdm.h
@@ -5,7 +5,7 @@
 
 #include <linux/usb/typec_altmode.h>
 
-extern struct typec_altmode_ops port_amode_ops;
+extern const struct typec_altmode_ops port_amode_ops;
 
 void cros_typec_handle_vdm_attention(struct cros_typec_data *typec, int port_num);
 void cros_typec_handle_vdm_response(struct cros_typec_data *typec, int port_num);
-- 
https://chromeos.dev


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

* [PATCH 4/4] platform/chrome: cros_ec_proto: Mark outdata as const
  2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
                   ` (2 preceding siblings ...)
  2023-10-03  0:34 ` [PATCH 3/4] platform/chrome: cros_typec_vdm: Mark port_amode_ops const Stephen Boyd
@ 2023-10-03  0:34 ` Stephen Boyd
  2023-10-03 22:11 ` [PATCH 0/4] platform/chrome: Random driver cleanups Prashant Malani
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-10-03  0:34 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih
  Cc: linux-kernel, patches, chrome-platform, Prashant Malani

The 'outdata' is copied to the data buffer in cros_ec_cmd() before being
sent over to the EC. Mark the argument as const so that callers can pass
const pointers to this function and so that callers know the data won't
be modified.

Cc: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_ec_proto.c     | 2 +-
 include/linux/platform_data/cros_ec_proto.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 475a6dd72db6..945b1b15a04c 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count);
 int cros_ec_cmd(struct cros_ec_device *ec_dev,
 		unsigned int version,
 		int command,
-		void *outdata,
+		const void *outdata,
 		size_t outsize,
 		void *indata,
 		size_t insize)
diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
index 4f9f756bc17c..8865e350c12a 100644
--- a/include/linux/platform_data/cros_ec_proto.h
+++ b/include/linux/platform_data/cros_ec_proto.h
@@ -258,7 +258,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int feature);
 
 int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
 
-int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, void *outdata,
+int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, const void *outdata,
 		    size_t outsize, void *indata, size_t insize);
 
 /**
-- 
https://chromeos.dev


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

* Re: [PATCH 0/4] platform/chrome: Random driver cleanups
  2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
                   ` (3 preceding siblings ...)
  2023-10-03  0:34 ` [PATCH 4/4] platform/chrome: cros_ec_proto: Mark outdata as const Stephen Boyd
@ 2023-10-03 22:11 ` Prashant Malani
  2023-10-04  3:50 ` patchwork-bot+chrome-platform
  2023-10-05  1:56 ` patchwork-bot+chrome-platform
  6 siblings, 0 replies; 8+ messages in thread
From: Prashant Malani @ 2023-10-03 22:11 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Benson Leung, Tzung-Bi Shih, linux-kernel, patches,
	chrome-platform

Hi Stephen,

Thanks for submitting the patch series.

On Oct 02 17:34, Stephen Boyd wrote:
> Here's some random chromeos driver cleanups that have been sitting in my
> tree. I've noticed them while browsing the code for something I'm
> working on.
> 
> Stephen Boyd (4):
>   platform/chrome: cros_ec_typec: Use semi-colons instead of commas
>   platform/chrome: cros_ec_typec: Use dev_err_probe() more
>   platform/chrome: cros_typec_vdm: Mark port_amode_ops const
>   platform/chrome: cros_ec_proto: Mark outdata as const

For the series:

Acked-by: Prashant Malani <pmalani@chromium.org>

BR,

-Prashant

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

* Re: [PATCH 0/4] platform/chrome: Random driver cleanups
  2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
                   ` (4 preceding siblings ...)
  2023-10-03 22:11 ` [PATCH 0/4] platform/chrome: Random driver cleanups Prashant Malani
@ 2023-10-04  3:50 ` patchwork-bot+chrome-platform
  2023-10-05  1:56 ` patchwork-bot+chrome-platform
  6 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-10-04  3:50 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: bleung, tzungbi, linux-kernel, patches, chrome-platform

Hello:

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

On Mon,  2 Oct 2023 17:34:24 -0700 you wrote:
> Here's some random chromeos driver cleanups that have been sitting in my
> tree. I've noticed them while browsing the code for something I'm
> working on.
> 
> Stephen Boyd (4):
>   platform/chrome: cros_ec_typec: Use semi-colons instead of commas
>   platform/chrome: cros_ec_typec: Use dev_err_probe() more
>   platform/chrome: cros_typec_vdm: Mark port_amode_ops const
>   platform/chrome: cros_ec_proto: Mark outdata as const
> 
> [...]

Here is the summary with links:
  - [1/4] platform/chrome: cros_ec_typec: Use semi-colons instead of commas
    https://git.kernel.org/chrome-platform/c/a88f6ef67957
  - [2/4] platform/chrome: cros_ec_typec: Use dev_err_probe() more
    https://git.kernel.org/chrome-platform/c/2b055bf8ac84
  - [3/4] platform/chrome: cros_typec_vdm: Mark port_amode_ops const
    https://git.kernel.org/chrome-platform/c/14e7c01cc349
  - [4/4] platform/chrome: cros_ec_proto: Mark outdata as const
    https://git.kernel.org/chrome-platform/c/2f3dd39e2b49

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

* Re: [PATCH 0/4] platform/chrome: Random driver cleanups
  2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
                   ` (5 preceding siblings ...)
  2023-10-04  3:50 ` patchwork-bot+chrome-platform
@ 2023-10-05  1:56 ` patchwork-bot+chrome-platform
  6 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-10-05  1:56 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: bleung, tzungbi, linux-kernel, patches, chrome-platform

Hello:

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

On Mon,  2 Oct 2023 17:34:24 -0700 you wrote:
> Here's some random chromeos driver cleanups that have been sitting in my
> tree. I've noticed them while browsing the code for something I'm
> working on.
> 
> Stephen Boyd (4):
>   platform/chrome: cros_ec_typec: Use semi-colons instead of commas
>   platform/chrome: cros_ec_typec: Use dev_err_probe() more
>   platform/chrome: cros_typec_vdm: Mark port_amode_ops const
>   platform/chrome: cros_ec_proto: Mark outdata as const
> 
> [...]

Here is the summary with links:
  - [1/4] platform/chrome: cros_ec_typec: Use semi-colons instead of commas
    https://git.kernel.org/chrome-platform/c/a88f6ef67957
  - [2/4] platform/chrome: cros_ec_typec: Use dev_err_probe() more
    https://git.kernel.org/chrome-platform/c/2b055bf8ac84
  - [3/4] platform/chrome: cros_typec_vdm: Mark port_amode_ops const
    https://git.kernel.org/chrome-platform/c/14e7c01cc349
  - [4/4] platform/chrome: cros_ec_proto: Mark outdata as const
    https://git.kernel.org/chrome-platform/c/2f3dd39e2b49

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

end of thread, other threads:[~2023-10-05  1:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03  0:34 [PATCH 0/4] platform/chrome: Random driver cleanups Stephen Boyd
2023-10-03  0:34 ` [PATCH 1/4] platform/chrome: cros_ec_typec: Use semi-colons instead of commas Stephen Boyd
2023-10-03  0:34 ` [PATCH 2/4] platform/chrome: cros_ec_typec: Use dev_err_probe() more Stephen Boyd
2023-10-03  0:34 ` [PATCH 3/4] platform/chrome: cros_typec_vdm: Mark port_amode_ops const Stephen Boyd
2023-10-03  0:34 ` [PATCH 4/4] platform/chrome: cros_ec_proto: Mark outdata as const Stephen Boyd
2023-10-03 22:11 ` [PATCH 0/4] platform/chrome: Random driver cleanups Prashant Malani
2023-10-04  3:50 ` patchwork-bot+chrome-platform
2023-10-05  1:56 ` 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;
as well as URLs for NNTP newsgroup(s).