platform/chrome: Random driver cleanups
cover platform/chrome: Random driver cleanups
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
Signature · 1 line
https://chromeos.dev
PATCH 1/4 platform/chrome: cros_ec_typec: Use semi-colons instead of commas
These should be semi-colons so that one statement is per line.
--- drivers/platform/chrome/cros_ec_typec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +5 -5
@@ -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);
Signature · 1 line
https://chromeos.dev
PATCH 2/4 platform/chrome: cros_ec_typec: Use dev_err_probe() more
In reply to Stephen BoydThere'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.
--- drivers/platform/chrome/cros_ec_typec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +4 -4
@@ -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; }
Signature · 1 line
https://chromeos.dev
PATCH 3/4 platform/chrome: cros_typec_vdm: Mark port_amode_ops const
In reply to Stephen BoydMark this struct of functions const so it moves to RO memory.
--- drivers/platform/chrome/cros_typec_vdm.c | 2 +- drivers/platform/chrome/cros_typec_vdm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_typec_vdm.c +1 -1
@@ -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, };
drivers/platform/chrome/cros_typec_vdm.h +1 -1
@@ -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);
Signature · 1 line
https://chromeos.dev
PATCH 4/4 platform/chrome: cros_ec_proto: Mark outdata as const
In reply to Stephen BoydThe '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.
--- drivers/platform/chrome/cros_ec_proto.c | 2 +- include/linux/platform_data/cros_ec_proto.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_proto.c +1 -1
@@ -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)
include/linux/platform_data/cros_ec_proto.h +1 -1
@@ -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);/**
Signature · 1 line
https://chromeos.dev
Hi Stephen,
Thanks for submitting the patch series.
Quoted 9 lines · Stephen Boyd
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: Usedev_err_probe()more platform/chrome:cros_typec_vdm: Markport_amode_opsconst platform/chrome:cros_ec_proto: Mark outdata as const
For the series:
BR,
-Prashant
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 11 lines · 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: Usedev_err_probe()more platform/chrome:cros_typec_vdm: Markport_amode_opsconst 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!
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 11 lines · 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: Usedev_err_probe()more platform/chrome:cros_typec_vdm: Markport_amode_opsconst 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html