* [PATCH 00/17] platform/chrome: Replace cros_ec_cmd_xfer_status @ 2020-01-30 20:30 Prashant Malani 2020-01-30 20:31 ` [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() Prashant Malani 0 siblings, 1 reply; 4+ messages in thread From: Prashant Malani @ 2020-01-30 20:30 UTC (permalink / raw) To: linux-kernel Cc: Prashant Malani, Akshu Agrawal, Alexandre Belloni, moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..., Benjamin Tissoires, Dmitry Torokhov, Enric Balletbo i Serra, Evan Green, Fabien Lahoudere, Guenter Roeck, Gwendal Grignou, Hans Verkuil, Hartmut Knaack, Jonathan Cameron, Lars-Peter Clausen, Lee Jones, open list:I2C SUBSYSTEM HOST DRIVERS, open list:IIO SUBSYSTEM AND DRIVERS, open list:HID CORE LAYER, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB), open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS, open list:PWM SUBSYSTEM, open list:REAL TIME CLOCK (RTC) SUBSYSTEM, Mauro Carvalho Chehab, Neil Armstrong, Nick Vaccaro, Peter Meerwald-Stadler, Raul E Rangel, Uwe Kleine-König, Wolfram Sang Many callers of cros_ec_cmd_xfer_status() use similar setup and cleanup code, including setting up the cros_ec_command message struct and copying the received buffer. This series introduces a replacement function cros_ec_send_cmd_msg() that performs this setup and teardown, and then updates all call sites that used xfer_status() to use the new function instead. The final patch in the series drops cros_ec_cmd_xfer_status() altogether. Prashant Malani (17): platform/chrome: Add EC command msg wrapper platform/chrome: chardev: Use send_cmd_msg() platform/chrome: proto: Use send_cmd_msg platform/chrome: usbpd_logger: Use cmd_send_msg() platform/chrome: sensorhub: Use send_cmd_msg() platform/chrome: debugfs: Use send_cmd_msg() platform/chrome: sysfs: Use send_cmd_msg() extcon: cros_ec: Use cros_ec_send_cmd_msg() hid: google-hammer: Use cros_ec_send_cmd_msg() iio: cros_ec: Use cros_ec_send_cmd_msg() ASoC: cros_ec_codec: Use cros_ec_send_cmd_msg() power: supply: cros: Use cros_ec_send_cmd_msg() pwm: cros-ec: Remove cros_ec_cmd_xfer_status() rtc: cros-ec: Use cros_ec_send_cmd_msg() media: cros-ec-cec: Use cros_ec_send_cmd_msg() i2c: cros-ec-tunnel: Use cros_ec_send_cmd_msg() platform/chrome: Drop cros_ec_cmd_xfer_status() drivers/extcon/extcon-usbc-cros-ec.c | 62 ++------ drivers/hid/hid-google-hammer.c | 23 +-- drivers/i2c/busses/i2c-cros-ec-tunnel.c | 23 ++- .../cros_ec_sensors/cros_ec_sensors_core.c | 43 +++--- .../media/platform/cros-ec-cec/cros-ec-cec.c | 39 ++--- drivers/platform/chrome/cros_ec_chardev.c | 18 +-- drivers/platform/chrome/cros_ec_debugfs.c | 135 ++++++------------ drivers/platform/chrome/cros_ec_proto.c | 75 ++++++---- drivers/platform/chrome/cros_ec_sensorhub.c | 29 ++-- drivers/platform/chrome/cros_ec_sysfs.c | 106 ++++++-------- drivers/platform/chrome/cros_usbpd_logger.c | 13 +- drivers/power/supply/cros_usbpd-charger.c | 63 ++------ drivers/pwm/pwm-cros-ec.c | 27 ++-- drivers/rtc/rtc-cros-ec.c | 27 ++-- include/linux/platform_data/cros_ec_proto.h | 6 +- sound/soc/codecs/cros_ec_codec.c | 71 +++------ 16 files changed, 276 insertions(+), 484 deletions(-) -- 2.25.0.341.g760bfbb309-goog ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() 2020-01-30 20:30 [PATCH 00/17] platform/chrome: Replace cros_ec_cmd_xfer_status Prashant Malani @ 2020-01-30 20:31 ` Prashant Malani 2020-02-02 22:08 ` kbuild test robot 2020-02-03 5:35 ` kbuild test robot 0 siblings, 2 replies; 4+ messages in thread From: Prashant Malani @ 2020-01-30 20:31 UTC (permalink / raw) To: linux-kernel Cc: Prashant Malani, Mauro Carvalho Chehab, Benson Leung, Enric Balletbo i Serra, Guenter Roeck, Hans Verkuil, Neil Armstrong, Gwendal Grignou, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB) Replace cros_ec_cmd_xfer_status() with cros_ec_send_cmd_msg() which does the message buffer setup and cleanup, but is located in platform/chrome and used by other drivers. Signed-off-by: Prashant Malani <pmalani@chromium.org> --- .../media/platform/cros-ec-cec/cros-ec-cec.c | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c index f048e89947850e..0ee7354dca9724 100644 --- a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c +++ b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c @@ -94,18 +94,14 @@ static int cros_ec_cec_set_log_addr(struct cec_adapter *adap, u8 logical_addr) { struct cros_ec_cec *cros_ec_cec = adap->priv; struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; - struct { - struct cros_ec_command msg; - struct ec_params_cec_set data; - } __packed msg = {}; + struct ec_params_cec_set data; int ret; - msg.msg.command = EC_CMD_CEC_SET; - msg.msg.outsize = sizeof(msg.data); - msg.data.cmd = CEC_CMD_LOGICAL_ADDRESS; - msg.data.val = logical_addr; + data.cmd = CEC_CMD_LOGICAL_ADDRESS; + data.val = logical_addr; - ret = cros_ec_cmd_xfer_status(cros_ec, &msg.msg); + ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_SET, &data, + sizeof(data), NULL, 0); if (ret < 0) { dev_err(cros_ec->dev, "error setting CEC logical address on EC: %d\n", ret); @@ -120,17 +116,14 @@ static int cros_ec_cec_transmit(struct cec_adapter *adap, u8 attempts, { struct cros_ec_cec *cros_ec_cec = adap->priv; struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; - struct { - struct cros_ec_command msg; - struct ec_params_cec_write data; - } __packed msg = {}; + struct ec_params_cec_write data = {}; int ret; - msg.msg.command = EC_CMD_CEC_WRITE_MSG; msg.msg.outsize = cec_msg->len; - memcpy(msg.data.msg, cec_msg->msg, cec_msg->len); + memcpy(data.msg, cec_msg->msg, cec_msg->len); - ret = cros_ec_cmd_xfer_status(cros_ec, &msg.msg); + ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_WRITE_MSG, + &data, sizeof(cec_msg->len), NULL, 0); if (ret < 0) { dev_err(cros_ec->dev, "error writing CEC msg on EC: %d\n", ret); @@ -144,18 +137,14 @@ static int cros_ec_cec_adap_enable(struct cec_adapter *adap, bool enable) { struct cros_ec_cec *cros_ec_cec = adap->priv; struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; - struct { - struct cros_ec_command msg; - struct ec_params_cec_set data; - } __packed msg = {}; + struct ec_params_cec_set data = {0}; int ret; - msg.msg.command = EC_CMD_CEC_SET; - msg.msg.outsize = sizeof(msg.data); - msg.data.cmd = CEC_CMD_ENABLE; - msg.data.val = enable; + data.cmd = CEC_CMD_ENABLE; + data.val = enable; - ret = cros_ec_cmd_xfer_status(cros_ec, &msg.msg); + ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_SET, &data, + sizeof(data), NULL, 0); if (ret < 0) { dev_err(cros_ec->dev, "error %sabling CEC on EC: %d\n", -- 2.25.0.341.g760bfbb309-goog ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() 2020-01-30 20:31 ` [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() Prashant Malani @ 2020-02-02 22:08 ` kbuild test robot 2020-02-03 5:35 ` kbuild test robot 1 sibling, 0 replies; 4+ messages in thread From: kbuild test robot @ 2020-02-02 22:08 UTC (permalink / raw) To: Prashant Malani Cc: kbuild-all, linux-kernel, Prashant Malani, Mauro Carvalho Chehab, Benson Leung, Enric Balletbo i Serra, Guenter Roeck, Hans Verkuil, Neil Armstrong, Gwendal Grignou, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB) [-- Attachment #1: Type: text/plain, Size: 3602 bytes --] Hi Prashant, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [cannot apply to chrome-platform-linux/for-next abelloni/rtc-next linux/master v5.5 next-20200130] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Prashant-Malani/platform-chrome-Replace-cros_ec_cmd_xfer_status/20200203-022935 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 94f2630b18975bb56eee5d1a36371db967643479 config: x86_64-randconfig-b002-20200202 (attached as .config) compiler: gcc-7 (Debian 7.5.0-3) 7.5.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/media/platform/cros-ec-cec/cros-ec-cec.c: In function 'cros_ec_cec_transmit': >> drivers/media/platform/cros-ec-cec/cros-ec-cec.c:122:2: error: 'msg' undeclared (first use in this function); did you mean 'msr'? msg.msg.outsize = cec_msg->len; ^~~ msr drivers/media/platform/cros-ec-cec/cros-ec-cec.c:122:2: note: each undeclared identifier is reported only once for each function it appears in vim +122 drivers/media/platform/cros-ec-cec/cros-ec-cec.c cd70de2d356ee6 Neil Armstrong 2018-07-04 113 cd70de2d356ee6 Neil Armstrong 2018-07-04 114 static int cros_ec_cec_transmit(struct cec_adapter *adap, u8 attempts, cd70de2d356ee6 Neil Armstrong 2018-07-04 115 u32 signal_free_time, struct cec_msg *cec_msg) cd70de2d356ee6 Neil Armstrong 2018-07-04 116 { cd70de2d356ee6 Neil Armstrong 2018-07-04 117 struct cros_ec_cec *cros_ec_cec = adap->priv; cd70de2d356ee6 Neil Armstrong 2018-07-04 118 struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; bd6054aba6ffe7 Prashant Malani 2020-01-30 119 struct ec_params_cec_write data = {}; cd70de2d356ee6 Neil Armstrong 2018-07-04 120 int ret; cd70de2d356ee6 Neil Armstrong 2018-07-04 121 cd70de2d356ee6 Neil Armstrong 2018-07-04 @122 msg.msg.outsize = cec_msg->len; bd6054aba6ffe7 Prashant Malani 2020-01-30 123 memcpy(data.msg, cec_msg->msg, cec_msg->len); cd70de2d356ee6 Neil Armstrong 2018-07-04 124 bd6054aba6ffe7 Prashant Malani 2020-01-30 125 ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_WRITE_MSG, bd6054aba6ffe7 Prashant Malani 2020-01-30 126 &data, sizeof(cec_msg->len), NULL, 0); cd70de2d356ee6 Neil Armstrong 2018-07-04 127 if (ret < 0) { cd70de2d356ee6 Neil Armstrong 2018-07-04 128 dev_err(cros_ec->dev, cd70de2d356ee6 Neil Armstrong 2018-07-04 129 "error writing CEC msg on EC: %d\n", ret); cd70de2d356ee6 Neil Armstrong 2018-07-04 130 return ret; cd70de2d356ee6 Neil Armstrong 2018-07-04 131 } cd70de2d356ee6 Neil Armstrong 2018-07-04 132 cd70de2d356ee6 Neil Armstrong 2018-07-04 133 return 0; cd70de2d356ee6 Neil Armstrong 2018-07-04 134 } cd70de2d356ee6 Neil Armstrong 2018-07-04 135 :::::: The code at line 122 was first introduced by commit :::::: cd70de2d356ee692477276bd5d6bc88c71a48733 media: platform: Add ChromeOS EC CEC driver :::::: TO: Neil Armstrong <narmstrong@baylibre.com> :::::: CC: Lee Jones <lee.jones@linaro.org> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 35108 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() 2020-01-30 20:31 ` [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() Prashant Malani 2020-02-02 22:08 ` kbuild test robot @ 2020-02-03 5:35 ` kbuild test robot 1 sibling, 0 replies; 4+ messages in thread From: kbuild test robot @ 2020-02-03 5:35 UTC (permalink / raw) To: Prashant Malani Cc: kbuild-all, linux-kernel, Prashant Malani, Mauro Carvalho Chehab, Benson Leung, Enric Balletbo i Serra, Guenter Roeck, Hans Verkuil, Neil Armstrong, Gwendal Grignou, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB) [-- Attachment #1: Type: text/plain, Size: 3750 bytes --] Hi Prashant, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [cannot apply to chrome-platform-linux/for-next abelloni/rtc-next linux/master v5.5 next-20200131] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Prashant-Malani/platform-chrome-Replace-cros_ec_cmd_xfer_status/20200203-022935 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 94f2630b18975bb56eee5d1a36371db967643479 config: s390-allmodconfig (attached as .config) compiler: s390-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=s390 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/media/platform/cros-ec-cec/cros-ec-cec.c: In function 'cros_ec_cec_transmit': >> drivers/media/platform/cros-ec-cec/cros-ec-cec.c:122:2: error: 'msg' undeclared (first use in this function); did you mean 'cspg'? msg.msg.outsize = cec_msg->len; ^~~ cspg drivers/media/platform/cros-ec-cec/cros-ec-cec.c:122:2: note: each undeclared identifier is reported only once for each function it appears in vim +122 drivers/media/platform/cros-ec-cec/cros-ec-cec.c cd70de2d356ee6 Neil Armstrong 2018-07-04 113 cd70de2d356ee6 Neil Armstrong 2018-07-04 114 static int cros_ec_cec_transmit(struct cec_adapter *adap, u8 attempts, cd70de2d356ee6 Neil Armstrong 2018-07-04 115 u32 signal_free_time, struct cec_msg *cec_msg) cd70de2d356ee6 Neil Armstrong 2018-07-04 116 { cd70de2d356ee6 Neil Armstrong 2018-07-04 117 struct cros_ec_cec *cros_ec_cec = adap->priv; cd70de2d356ee6 Neil Armstrong 2018-07-04 118 struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; bd6054aba6ffe7 Prashant Malani 2020-01-30 119 struct ec_params_cec_write data = {}; cd70de2d356ee6 Neil Armstrong 2018-07-04 120 int ret; cd70de2d356ee6 Neil Armstrong 2018-07-04 121 cd70de2d356ee6 Neil Armstrong 2018-07-04 @122 msg.msg.outsize = cec_msg->len; bd6054aba6ffe7 Prashant Malani 2020-01-30 123 memcpy(data.msg, cec_msg->msg, cec_msg->len); cd70de2d356ee6 Neil Armstrong 2018-07-04 124 bd6054aba6ffe7 Prashant Malani 2020-01-30 125 ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_WRITE_MSG, bd6054aba6ffe7 Prashant Malani 2020-01-30 126 &data, sizeof(cec_msg->len), NULL, 0); cd70de2d356ee6 Neil Armstrong 2018-07-04 127 if (ret < 0) { cd70de2d356ee6 Neil Armstrong 2018-07-04 128 dev_err(cros_ec->dev, cd70de2d356ee6 Neil Armstrong 2018-07-04 129 "error writing CEC msg on EC: %d\n", ret); cd70de2d356ee6 Neil Armstrong 2018-07-04 130 return ret; cd70de2d356ee6 Neil Armstrong 2018-07-04 131 } cd70de2d356ee6 Neil Armstrong 2018-07-04 132 cd70de2d356ee6 Neil Armstrong 2018-07-04 133 return 0; cd70de2d356ee6 Neil Armstrong 2018-07-04 134 } cd70de2d356ee6 Neil Armstrong 2018-07-04 135 :::::: The code at line 122 was first introduced by commit :::::: cd70de2d356ee692477276bd5d6bc88c71a48733 media: platform: Add ChromeOS EC CEC driver :::::: TO: Neil Armstrong <narmstrong@baylibre.com> :::::: CC: Lee Jones <lee.jones@linaro.org> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 57998 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-03 5:37 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-01-30 20:30 [PATCH 00/17] platform/chrome: Replace cros_ec_cmd_xfer_status Prashant Malani 2020-01-30 20:31 ` [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() Prashant Malani 2020-02-02 22:08 ` kbuild test robot 2020-02-03 5:35 ` kbuild test robot
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).