[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202406292107.TQKTW6ey-lkp@intel.com>
Date: Sat, 29 Jun 2024 21:41:30 +0800
From: kernel test robot <lkp@...el.com>
To: Daisuke Nojiri <dnojiri@...omium.org>
Cc: oe-kbuild-all@...ts.linux.dev, Benson Leung <bleung@...omium.org>,
Tzung-Bi Shih <tzungbi@...nel.org>,
Guenter Roeck <groeck@...omium.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Reka Norman <rekanorman@...omium.org>,
Hans Verkuil <hverkuil@...all.nl>,
Gwendal Grignou <gwendal@...omium.org>,
Pavan Holla <pholla@...omium.org>,
Lukasz Majczak <lma@...omium.org>,
Ching-Kang Yen <chingkang@...omium.org>,
Daisuke Nojiri <dnojiri@...omium.org>,
Stephen Boyd <swboyd@...omium.org>,
Prashant Malani <pmalani@...omium.org>,
chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-input@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v5 1/2] cros_ec_proto: Consolidate
ec_response_get_next_event
Hi Daisuke,
kernel test robot noticed the following build errors:
[auto build test ERROR on chrome-platform/for-firmware-next]
[also build test ERROR on dtor-input/next dtor-input/for-linus robh/for-next linus/master v6.10-rc5]
[cannot apply to chrome-platform/for-next next-20240628]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Daisuke-Nojiri/cros_ec_proto-Consolidate-ec_response_get_next_event/20240629-053834
base: https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-firmware-next
patch link: https://lore.kernel.org/r/fc251d6935c1cfc39d7a31d3cfe735d31a0371d1.1719531519.git.dnojiri%40chromium.org
patch subject: [PATCH v5 1/2] cros_ec_proto: Consolidate ec_response_get_next_event
config: i386-randconfig-141-20240629
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build):
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406292107.TQKTW6ey-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/platform/chrome/cros_ec_proto_test.c: In function 'cros_ec_proto_test_get_next_event_no_mkbp_event':
>> drivers/platform/chrome/cros_ec_proto_test.c:2065:64: error: invalid application of 'sizeof' to incomplete type 'union ec_response_get_next_data_v1'
2065 | mock = cros_kunit_ec_xfer_mock_add(test, sizeof(*data));
| ^
>> drivers/platform/chrome/cros_ec_proto_test.c:2069:21: error: invalid use of undefined type 'union ec_response_get_next_data_v1'
2069 | data->host_event = 0xbeef;
| ^~
In file included from drivers/platform/chrome/cros_ec_proto_test.c:6:
drivers/platform/chrome/cros_ec_proto_test.c:2073:43: error: invalid application of 'sizeof' to incomplete type 'union ec_response_get_next_data_v1'
2073 | KUNIT_EXPECT_EQ(test, ret, sizeof(union ec_response_get_next_data_v1));
| ^~~~~
include/kunit/test.h:708:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2073:9: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2073 | KUNIT_EXPECT_EQ(test, ret, sizeof(union ec_response_get_next_data_v1));
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2073:43: error: invalid application of 'sizeof' to incomplete type 'union ec_response_get_next_data_v1'
2073 | KUNIT_EXPECT_EQ(test, ret, sizeof(union ec_response_get_next_data_v1));
| ^~~~~
include/kunit/test.h:708:40: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2073:9: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2073 | KUNIT_EXPECT_EQ(test, ret, sizeof(union ec_response_get_next_data_v1));
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2088:64: error: invalid application of 'sizeof' to incomplete type 'union ec_response_get_next_data_v1'
2088 | KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(union ec_response_get_next_data_v1));
| ^~~~~
include/kunit/test.h:708:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2088:17: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2088 | KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(union ec_response_get_next_data_v1));
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2088:64: error: invalid application of 'sizeof' to incomplete type 'union ec_response_get_next_data_v1'
2088 | KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(union ec_response_get_next_data_v1));
| ^~~~~
include/kunit/test.h:708:40: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2088:17: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2088 | KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(union ec_response_get_next_data_v1));
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c: In function 'cros_ec_proto_test_get_next_event_mkbp_event_version2':
>> drivers/platform/chrome/cros_ec_proto_test.c:2175:64: error: invalid application of 'sizeof' to incomplete type 'struct ec_response_get_next_event_v1'
2175 | mock = cros_kunit_ec_xfer_mock_add(test, sizeof(*data));
| ^
>> drivers/platform/chrome/cros_ec_proto_test.c:2179:21: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2179 | data->event_type = EC_MKBP_EVENT_FINGERPRINT;
| ^~
drivers/platform/chrome/cros_ec_proto_test.c:2180:21: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2180 | data->data.sysrq = 0xbeef;
| ^~
drivers/platform/chrome/cros_ec_proto_test.c:2184:43: error: invalid application of 'sizeof' to incomplete type 'struct ec_response_get_next_event_v1'
2184 | KUNIT_EXPECT_EQ(test, ret, sizeof(struct ec_response_get_next_event_v1));
| ^~~~~~
include/kunit/test.h:708:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2184:9: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2184 | KUNIT_EXPECT_EQ(test, ret, sizeof(struct ec_response_get_next_event_v1));
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2184:43: error: invalid application of 'sizeof' to incomplete type 'struct ec_response_get_next_event_v1'
2184 | KUNIT_EXPECT_EQ(test, ret, sizeof(struct ec_response_get_next_event_v1));
| ^~~~~~
include/kunit/test.h:708:40: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2184:9: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2184 | KUNIT_EXPECT_EQ(test, ret, sizeof(struct ec_response_get_next_event_v1));
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2200:40: error: invalid application of 'sizeof' to incomplete type 'struct ec_response_get_next_event_v1'
2200 | sizeof(struct ec_response_get_next_event_v1));
| ^~~~~~
include/kunit/test.h:708:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2199:17: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2199 | KUNIT_EXPECT_EQ(test, mock->msg.insize,
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2200:40: error: invalid application of 'sizeof' to incomplete type 'struct ec_response_get_next_event_v1'
2200 | sizeof(struct ec_response_get_next_event_v1));
| ^~~~~~
include/kunit/test.h:708:40: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2199:17: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2199 | KUNIT_EXPECT_EQ(test, mock->msg.insize,
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c: In function 'cros_ec_proto_test_get_next_event_mkbp_event_host_event_rtc':
drivers/platform/chrome/cros_ec_proto_test.c:2225:63: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2225 | sizeof(data->event_type) +
| ^~
drivers/platform/chrome/cros_ec_proto_test.c:2226:63: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2226 | sizeof(data->data.host_event));
| ^~
drivers/platform/chrome/cros_ec_proto_test.c:2230:21: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2230 | data->event_type = EC_MKBP_EVENT_HOST_EVENT;
| ^~
drivers/platform/chrome/cros_ec_proto_test.c:2231:80: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2231 | put_unaligned_le32(EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC), &data->data.host_event);
| ^~
drivers/platform/chrome/cros_ec_proto_test.c:2235:47: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2235 | KUNIT_EXPECT_EQ(test, ret, sizeof(data->event_type) + sizeof(data->data.host_event));
| ^~
include/kunit/test.h:708:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
903 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:900:9: note: in expansion of macro 'KUNIT_EXPECT_EQ_MSG'
900 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2235:9: note: in expansion of macro 'KUNIT_EXPECT_EQ'
2235 | KUNIT_EXPECT_EQ(test, ret, sizeof(data->event_type) + sizeof(data->data.host_event));
| ^~~~~~~~~~~~~~~
drivers/platform/chrome/cros_ec_proto_test.c:2235:74: error: invalid use of undefined type 'struct ec_response_get_next_event_v1'
2235 | KUNIT_EXPECT_EQ(test, ret, sizeof(data->event_type) + sizeof(data->data.host_event));
| ^~
include/kunit/test.h:708:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
708 | const typeof(right) __right = (right); \
| ^~~~~
include/kunit/test.h:903:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
vim +2065 drivers/platform/chrome/cros_ec_proto_test.c
1242688fc2f0805 Tzung-Bi Shih 2022-06-22 2044
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2045 static void cros_ec_proto_test_get_next_event_no_mkbp_event(struct kunit *test)
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2046 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2047 struct cros_ec_proto_test_priv *priv = test->priv;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2048 struct cros_ec_device *ec_dev = &priv->ec_dev;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2049 struct ec_xfer_mock *mock;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2050 int ret;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2051 bool wake_event, more_events;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2052
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2053 ec_dev->max_request = 0xff;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2054 ec_dev->max_response = 0xee;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2055 ec_dev->mkbp_event_supported = 0;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2056
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2057 /* Set some garbage bytes. */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2058 wake_event = false;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2059 more_events = true;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2060
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2061 /* For get_keyboard_state_event(). */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2062 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2063 union ec_response_get_next_data_v1 *data;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2064
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 @2065 mock = cros_kunit_ec_xfer_mock_add(test, sizeof(*data));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2066 KUNIT_ASSERT_PTR_NE(test, mock, NULL);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2067
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2068 data = (union ec_response_get_next_data_v1 *)mock->o_data;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 @2069 data->host_event = 0xbeef;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2070 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2071
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2072 ret = cros_ec_get_next_event(ec_dev, &wake_event, &more_events);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2073 KUNIT_EXPECT_EQ(test, ret, sizeof(union ec_response_get_next_data_v1));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2074
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2075 KUNIT_EXPECT_EQ(test, ec_dev->event_data.event_type, EC_MKBP_EVENT_KEY_MATRIX);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2076 KUNIT_EXPECT_EQ(test, ec_dev->event_data.data.host_event, 0xbeef);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2077
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2078 KUNIT_EXPECT_TRUE(test, wake_event);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2079 KUNIT_EXPECT_FALSE(test, more_events);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2080
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2081 /* For get_keyboard_state_event(). */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2082 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2083 mock = cros_kunit_ec_xfer_mock_next();
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2084 KUNIT_EXPECT_PTR_NE(test, mock, NULL);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2085
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2086 KUNIT_EXPECT_EQ(test, mock->msg.version, 0);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2087 KUNIT_EXPECT_EQ(test, mock->msg.command, EC_CMD_MKBP_STATE);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 @2088 KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(union ec_response_get_next_data_v1));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2089 KUNIT_EXPECT_EQ(test, mock->msg.outsize, 0);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2090 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2091 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2092
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2093 static void cros_ec_proto_test_get_next_event_mkbp_event_ec_suspended(struct kunit *test)
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2094 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2095 struct cros_ec_proto_test_priv *priv = test->priv;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2096 struct cros_ec_device *ec_dev = &priv->ec_dev;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2097 int ret;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2098
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2099 ec_dev->mkbp_event_supported = 1;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2100 ec_dev->suspended = true;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2101
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2102 ret = cros_ec_get_next_event(ec_dev, NULL, NULL);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2103 KUNIT_EXPECT_EQ(test, ret, -EHOSTDOWN);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2104 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2105
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2106 static void cros_ec_proto_test_get_next_event_mkbp_event_version0(struct kunit *test)
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2107 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2108 struct cros_ec_proto_test_priv *priv = test->priv;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2109 struct cros_ec_device *ec_dev = &priv->ec_dev;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2110 struct ec_xfer_mock *mock;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2111 int ret;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2112 bool wake_event, more_events;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2113
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2114 ec_dev->max_request = 0xff;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2115 ec_dev->max_response = 0xee;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2116 ec_dev->mkbp_event_supported = 1;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2117
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2118 /* Set some garbage bytes. */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2119 wake_event = true;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2120 more_events = false;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2121
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2122 /* For get_next_event_xfer(). */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2123 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2124 struct ec_response_get_next_event *data;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2125
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2126 mock = cros_kunit_ec_xfer_mock_add(test, sizeof(*data));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2127 KUNIT_ASSERT_PTR_NE(test, mock, NULL);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2128
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2129 data = (struct ec_response_get_next_event *)mock->o_data;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2130 data->event_type = EC_MKBP_EVENT_SENSOR_FIFO | EC_MKBP_HAS_MORE_EVENTS;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2131 data->data.sysrq = 0xbeef;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2132 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2133
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2134 ret = cros_ec_get_next_event(ec_dev, &wake_event, &more_events);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2135 KUNIT_EXPECT_EQ(test, ret, sizeof(struct ec_response_get_next_event));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2136
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2137 KUNIT_EXPECT_EQ(test, ec_dev->event_data.event_type, EC_MKBP_EVENT_SENSOR_FIFO);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2138 KUNIT_EXPECT_EQ(test, ec_dev->event_data.data.sysrq, 0xbeef);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2139
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2140 KUNIT_EXPECT_FALSE(test, wake_event);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2141 KUNIT_EXPECT_TRUE(test, more_events);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2142
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2143 /* For get_next_event_xfer(). */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2144 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2145 mock = cros_kunit_ec_xfer_mock_next();
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2146 KUNIT_EXPECT_PTR_NE(test, mock, NULL);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2147
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2148 KUNIT_EXPECT_EQ(test, mock->msg.version, 0);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2149 KUNIT_EXPECT_EQ(test, mock->msg.command, EC_CMD_GET_NEXT_EVENT);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2150 KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(struct ec_response_get_next_event));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2151 KUNIT_EXPECT_EQ(test, mock->msg.outsize, 0);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2152 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2153 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2154
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2155 static void cros_ec_proto_test_get_next_event_mkbp_event_version2(struct kunit *test)
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2156 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2157 struct cros_ec_proto_test_priv *priv = test->priv;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2158 struct cros_ec_device *ec_dev = &priv->ec_dev;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2159 struct ec_xfer_mock *mock;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2160 int ret;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2161 bool wake_event, more_events;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2162
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2163 ec_dev->max_request = 0xff;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2164 ec_dev->max_response = 0xee;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2165 ec_dev->mkbp_event_supported = 3;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2166
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2167 /* Set some garbage bytes. */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2168 wake_event = false;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2169 more_events = true;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2170
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2171 /* For get_next_event_xfer(). */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2172 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2173 struct ec_response_get_next_event_v1 *data;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2174
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 @2175 mock = cros_kunit_ec_xfer_mock_add(test, sizeof(*data));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2176 KUNIT_ASSERT_PTR_NE(test, mock, NULL);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2177
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2178 data = (struct ec_response_get_next_event_v1 *)mock->o_data;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 @2179 data->event_type = EC_MKBP_EVENT_FINGERPRINT;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2180 data->data.sysrq = 0xbeef;
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2181 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2182
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2183 ret = cros_ec_get_next_event(ec_dev, &wake_event, &more_events);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2184 KUNIT_EXPECT_EQ(test, ret, sizeof(struct ec_response_get_next_event_v1));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2185
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2186 KUNIT_EXPECT_EQ(test, ec_dev->event_data.event_type, EC_MKBP_EVENT_FINGERPRINT);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2187 KUNIT_EXPECT_EQ(test, ec_dev->event_data.data.sysrq, 0xbeef);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2188
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2189 KUNIT_EXPECT_TRUE(test, wake_event);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2190 KUNIT_EXPECT_FALSE(test, more_events);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2191
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2192 /* For get_next_event_xfer(). */
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2193 {
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2194 mock = cros_kunit_ec_xfer_mock_next();
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2195 KUNIT_EXPECT_PTR_NE(test, mock, NULL);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2196
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2197 KUNIT_EXPECT_EQ(test, mock->msg.version, 2);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2198 KUNIT_EXPECT_EQ(test, mock->msg.command, EC_CMD_GET_NEXT_EVENT);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2199 KUNIT_EXPECT_EQ(test, mock->msg.insize,
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2200 sizeof(struct ec_response_get_next_event_v1));
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2201 KUNIT_EXPECT_EQ(test, mock->msg.outsize, 0);
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2202 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2203 }
2b7ed927953f30e Tzung-Bi Shih 2022-06-22 2204
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
View attachment "reproduce" of type "text/plain" (592 bytes)
View attachment "config" of type "text/plain" (140244 bytes)
Powered by blists - more mailing lists