Commit b823369b authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jason Gunthorpe

RDMA/netlink: Simplify code of autoload modules

The request_module() call is internally wrapped by CONFIG_MODULE,
so there is no need to check it in our RDMA code too.

Refactor to simplify the code.
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 9ef77bd7
...@@ -81,15 +81,13 @@ static bool is_nl_valid(unsigned int type, unsigned int op) ...@@ -81,15 +81,13 @@ static bool is_nl_valid(unsigned int type, unsigned int op)
if (!is_nl_msg_valid(type, op)) if (!is_nl_msg_valid(type, op))
return false; return false;
cb_table = rdma_nl_types[type].cb_table; if (!rdma_nl_types[type].cb_table) {
#ifdef CONFIG_MODULES
if (!cb_table) {
mutex_unlock(&rdma_nl_mutex); mutex_unlock(&rdma_nl_mutex);
request_module("rdma-netlink-subsys-%d", type); request_module("rdma-netlink-subsys-%d", type);
mutex_lock(&rdma_nl_mutex); mutex_lock(&rdma_nl_mutex);
cb_table = rdma_nl_types[type].cb_table;
} }
#endif
cb_table = rdma_nl_types[type].cb_table;
if (!cb_table || (!cb_table[op].dump && !cb_table[op].doit)) if (!cb_table || (!cb_table[op].dump && !cb_table[op].doit))
return false; return false;
......
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