Commit 824945a5 authored by David Gow's avatar David Gow Committed by Shuah Khan

thunderbolt: test: Reinstate a few casts of bitfields

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: 8f0877c2 ("thunderbolt: test: Remove some casts which are no longer required")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarDavid Gow <davidgow@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent b29b14f1
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment