From: David Gow <davidgow@google.com>
To: Shuah Khan <skhan@linuxfoundation.org>,
Brendan Higgins <brendanhiggins@google.com>
Cc: David Gow <davidgow@google.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-usb@vger.kernel.org, kunit-dev@googlegroups.com,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel test robot <lkp@intel.com>
Subject: [PATCH kunit-next] thunderbolt: test: Reinstate a few casts of bitfields
Date: Thu, 24 Jun 2021 01:48:23 -0700 [thread overview]
Message-ID: <20210624084823.15031-1-davidgow@google.com> (raw)
Partially revert "thunderbolt: test: Remove some casts which are no
longer required". It turns out that typeof() doesn't support bitfields,
so these still need to be cast to the appropriate enum.
The only mention of typeof() and bitfields I can find is in the proposal
to standardise them:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2619.htm
This was caught by the kernel test robot:
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/FDKBHAV7QNLNFU5NBI2RKV56DWDSOLGM/
Fixes: 8f0877c26e ("thunderbolt: test: Remove some casts which are no longer required")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: David Gow <davidgow@google.com>
---
Whoops: I didn't notice this was broken earlier. If it's easier to just
revert the broken patch, that's fine, too.
Cheers,
-- David
drivers/thunderbolt/test.c | 66 +++++++++++++++++++++++++-------------
1 file changed, 44 insertions(+), 22 deletions(-)
diff --git a/drivers/thunderbolt/test.c b/drivers/thunderbolt/test.c
index 247dc9f4757e..3cc36ef639f3 100644
--- a/drivers/thunderbolt/test.c
+++ b/drivers/thunderbolt/test.c
@@ -384,7 +384,8 @@ static void tb_test_path_single_hop_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i++;
}
@@ -395,7 +396,8 @@ static void tb_test_path_single_hop_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i--;
}
@@ -441,7 +443,8 @@ static void tb_test_path_daisy_chain_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i++;
}
@@ -452,7 +455,8 @@ static void tb_test_path_daisy_chain_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i--;
}
@@ -502,7 +506,8 @@ static void tb_test_path_simple_tree_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i++;
}
@@ -513,7 +518,8 @@ static void tb_test_path_simple_tree_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i--;
}
@@ -584,7 +590,8 @@ static void tb_test_path_complex_tree_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i++;
}
@@ -595,7 +602,8 @@ static void tb_test_path_complex_tree_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i--;
}
@@ -685,7 +693,8 @@ static void tb_test_path_max_length_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i++;
}
@@ -696,7 +705,8 @@ static void tb_test_path_max_length_walk(struct kunit *test)
KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data));
KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, p->port, test_data[i].port);
- KUNIT_EXPECT_EQ(test, p->config.type, test_data[i].type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type,
+ test_data[i].type);
i--;
}
@@ -779,10 +789,12 @@ static void tb_test_path_not_bonded_lane0(struct kunit *test)
KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port);
- KUNIT_EXPECT_EQ(test, in_port->config.type, test_data[i].in_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type,
+ test_data[i].in_type);
KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port);
- KUNIT_EXPECT_EQ(test, out_port->config.type, test_data[i].out_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type,
+ test_data[i].out_type);
}
tb_path_free(path);
}
@@ -839,10 +851,12 @@ static void tb_test_path_not_bonded_lane1(struct kunit *test)
KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port);
- KUNIT_EXPECT_EQ(test, in_port->config.type, test_data[i].in_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type,
+ test_data[i].in_type);
KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port);
- KUNIT_EXPECT_EQ(test, out_port->config.type, test_data[i].out_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type,
+ test_data[i].out_type);
}
tb_path_free(path);
}
@@ -917,10 +931,12 @@ static void tb_test_path_not_bonded_lane1_chain(struct kunit *test)
KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port);
- KUNIT_EXPECT_EQ(test, in_port->config.type, test_data[i].in_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type,
+ test_data[i].in_type);
KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port);
- KUNIT_EXPECT_EQ(test, out_port->config.type, test_data[i].out_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type,
+ test_data[i].out_type);
}
tb_path_free(path);
}
@@ -995,10 +1011,12 @@ static void tb_test_path_not_bonded_lane1_chain_reverse(struct kunit *test)
KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port);
- KUNIT_EXPECT_EQ(test, in_port->config.type, test_data[i].in_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type,
+ test_data[i].in_type);
KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port);
- KUNIT_EXPECT_EQ(test, out_port->config.type, test_data[i].out_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type,
+ test_data[i].out_type);
}
tb_path_free(path);
}
@@ -1085,10 +1103,12 @@ static void tb_test_path_mixed_chain(struct kunit *test)
KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port);
- KUNIT_EXPECT_EQ(test, in_port->config.type, test_data[i].in_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type,
+ test_data[i].in_type);
KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port);
- KUNIT_EXPECT_EQ(test, out_port->config.type, test_data[i].out_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type,
+ test_data[i].out_type);
}
tb_path_free(path);
}
@@ -1175,10 +1195,12 @@ static void tb_test_path_mixed_chain_reverse(struct kunit *test)
KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port);
- KUNIT_EXPECT_EQ(test, in_port->config.type, test_data[i].in_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type,
+ test_data[i].in_type);
KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route);
KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port);
- KUNIT_EXPECT_EQ(test, out_port->config.type, test_data[i].out_type);
+ KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type,
+ test_data[i].out_type);
}
tb_path_free(path);
}
--
2.32.0.288.g62a8d224e6-goog
next reply other threads:[~2021-06-24 8:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 8:48 David Gow [this message]
2021-06-24 13:12 ` [PATCH kunit-next] thunderbolt: test: Reinstate a few casts of bitfields Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210624084823.15031-1-davidgow@google.com \
--to=davidgow@google.com \
--cc=brendanhiggins@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox