summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManikandan Mohan <manikand@codeaurora.org>2017-09-20 18:14:16 -0700
committersnandini <snandini@codeaurora.org>2017-11-16 05:03:15 -0800
commit6eeaedd0b633f100593abc3e9e0c45b53e45ce00 (patch)
tree77f819f44253d2766747326fc367bda1407cb36c
parent654364e44758f8c95f39bdaf25d9a9c247bef973 (diff)
downloadqcacld-6eeaedd0b633f100593abc3e9e0c45b53e45ce00.tar.gz
qcacld-3.0: Fix compilation for multiple driver module generation
Qcacld supports multiple driver modules instance generation with different file names and Kbuild options. Fix driver load time and compilation errors on this feature. Change-Id: I78f6771d1a215ac8193bfd51eefc6d8c5a2594a6 CRs-fixed: 2142715
-rw-r--r--core/pld/src/pld_pcie.c10
-rw-r--r--core/pld/src/pld_snoc.c8
-rw-r--r--core/utils/nlink/src/wlan_nlink_srv.c180
3 files changed, 116 insertions, 82 deletions
diff --git a/core/pld/src/pld_pcie.c b/core/pld/src/pld_pcie.c
index e0d30a5416..14c684d0f1 100644
--- a/core/pld/src/pld_pcie.c
+++ b/core/pld/src/pld_pcie.c
@@ -297,6 +297,12 @@ static struct pci_device_id pld_pcie_id_table[] = {
{ 0 }
};
+#ifdef MULTI_IF_NAME
+#define PLD_PCIE_OPS_NAME "pld_pcie_" MULTI_IF_NAME
+#else
+#define PLD_PCIE_OPS_NAME "pld_pcie"
+#endif
+
#ifdef CONFIG_PLD_PCIE_CNSS
#ifdef FEATURE_RUNTIME_PM
struct cnss_wlan_runtime_ops runtime_pm_ops = {
@@ -306,7 +312,7 @@ struct cnss_wlan_runtime_ops runtime_pm_ops = {
#endif
struct cnss_wlan_driver pld_pcie_ops = {
- .name = "pld_pcie",
+ .name = PLD_PCIE_OPS_NAME,
.id_table = pld_pcie_id_table,
.probe = pld_pcie_probe,
.remove = pld_pcie_remove,
@@ -345,7 +351,7 @@ void pld_pcie_unregister_driver(void)
}
#else
struct pci_driver pld_pcie_ops = {
- .name = "pld_pcie",
+ .name = PLD_PCIE_OPS_NAME,
.id_table = pld_pcie_id_table,
.probe = pld_pcie_probe,
.remove = pld_pcie_remove,
diff --git a/core/pld/src/pld_snoc.c b/core/pld/src/pld_snoc.c
index 9e252f957e..dfe8434188 100644
--- a/core/pld/src/pld_snoc.c
+++ b/core/pld/src/pld_snoc.c
@@ -275,8 +275,14 @@ static int pld_snoc_uevent(struct device *dev,
return 0;
}
+#ifdef MULTI_IF_NAME
+#define PLD_SNOC_OPS_NAME "pld_snoc_" MULTI_IF_NAME
+#else
+#define PLD_SNOC_OPS_NAME "pld_snoc"
+#endif
+
struct icnss_driver_ops pld_snoc_ops = {
- .name = "pld_snoc",
+ .name = PLD_SNOC_OPS_NAME,
.probe = pld_snoc_probe,
.remove = pld_snoc_remove,
.shutdown = pld_snoc_shutdown,
diff --git a/core/utils/nlink/src/wlan_nlink_srv.c b/core/utils/nlink/src/wlan_nlink_srv.c
index 25ff46ce85..1d3bb1b637 100644
--- a/core/utils/nlink/src/wlan_nlink_srv.c
+++ b/core/utils/nlink/src/wlan_nlink_srv.c
@@ -263,105 +263,38 @@ inline int nl_srv_is_initialized(void)
* and the diagnotics netlink socket will not be available since this
* diagnostics netlink socket can only be exposed by one instance of the driver.
*/
-#elif !defined(MULTI_IF_NAME)
-
-#ifdef CNSS_GENL
+#elif defined(CNSS_GENL)
#include <qdf_mem.h>
#include <wlan_nlink_common.h>
#include <net/genetlink.h>
#include <net/cnss_nl.h>
-#endif
-
-/* Global variables */
-static DEFINE_MUTEX(nl_srv_sem);
-static struct sock *nl_srv_sock;
-static nl_srv_msg_callback nl_srv_msg_handler[NLINK_MAX_CALLBACKS];
-
-/* Forward declaration */
-static void nl_srv_rcv(struct sk_buff *sk);
-static void nl_srv_rcv_skb(struct sk_buff *skb);
-static void nl_srv_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh);
-/*
- * Initialize the netlink service.
- * Netlink service is usable after this.
- */
+/* For CNSS_GENL netlink sockets will be initialized by CNSS Kernel Module */
int nl_srv_init(void *wiphy)
{
- int retcode = 0;
- struct netlink_kernel_cfg cfg = {
- .groups = WLAN_NLINK_MCAST_GRP_ID,
- .input = nl_srv_rcv
- };
-
- nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_PROTO_FAMILY,
- &cfg);
-
- if (nl_srv_sock != NULL) {
- memset(nl_srv_msg_handler, 0, sizeof(nl_srv_msg_handler));
- } else {
- QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
- "NLINK: netlink_kernel_create failed");
- retcode = -ECONNREFUSED;
- }
- return retcode;
+ return 0;
}
-/*
- * Deinit the netlink service.
- * Netlink service is unusable after this.
- */
void nl_srv_exit(void)
{
- if (nl_srv_is_initialized() == 0)
- netlink_kernel_release(nl_srv_sock);
+}
- nl_srv_sock = NULL;
+int nl_srv_is_initialized(void)
+{
+ return 0;
}
-/*
- * Register a message handler for a specified module.
- * Each module (e.g. WLAN_NL_MSG_BTC )will register a
- * handler to handle messages addressed to it.
- */
+/* Not implemented by CNSS kernel module */
int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler)
{
- int retcode = 0;
-
- if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) &&
- msg_handler != NULL) {
- nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = msg_handler;
- } else {
- QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
- "NLINK: nl_srv_register failed for msg_type %d",
- msg_type);
- retcode = -EINVAL;
- }
-
- return retcode;
+ return 0;
}
-/*
- * Unregister the message handler for a specified module.
- */
int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler)
{
- int retcode = 0;
-
- if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) &&
- (nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] == msg_handler)) {
- nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = NULL;
- } else {
- QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
- "NLINK: nl_srv_unregister failed for msg_type %d",
- msg_type);
- retcode = -EINVAL;
- }
-
- return retcode;
+ return 0;
}
-#ifdef CNSS_GENL
/**
* nl80211hdr_put() - API to fill genlmsg header
* @skb: Sk buffer
@@ -548,7 +481,97 @@ int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag,
dev_kfree_skb(skb);
return 0;
}
-#else
+
+#elif !defined(MULTI_IF_NAME)
+
+/* Global variables */
+static DEFINE_MUTEX(nl_srv_sem);
+static struct sock *nl_srv_sock;
+static nl_srv_msg_callback nl_srv_msg_handler[NLINK_MAX_CALLBACKS];
+
+/* Forward declaration */
+static void nl_srv_rcv(struct sk_buff *sk);
+static void nl_srv_rcv_skb(struct sk_buff *skb);
+static void nl_srv_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh);
+
+/*
+ * Initialize the netlink service.
+ * Netlink service is usable after this.
+ */
+int nl_srv_init(void *wiphy)
+{
+ int retcode = 0;
+ struct netlink_kernel_cfg cfg = {
+ .groups = WLAN_NLINK_MCAST_GRP_ID,
+ .input = nl_srv_rcv
+ };
+
+ nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_PROTO_FAMILY,
+ &cfg);
+
+ if (nl_srv_sock != NULL) {
+ memset(nl_srv_msg_handler, 0, sizeof(nl_srv_msg_handler));
+ } else {
+ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
+ "NLINK: netlink_kernel_create failed");
+ retcode = -ECONNREFUSED;
+ }
+ return retcode;
+}
+
+/*
+ * Deinit the netlink service.
+ * Netlink service is unusable after this.
+ */
+void nl_srv_exit(void)
+{
+ if (nl_srv_is_initialized() == 0)
+ netlink_kernel_release(nl_srv_sock);
+
+ nl_srv_sock = NULL;
+}
+
+/*
+ * Register a message handler for a specified module.
+ * Each module (e.g. WLAN_NL_MSG_BTC )will register a
+ * handler to handle messages addressed to it.
+ */
+int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler)
+{
+ int retcode = 0;
+
+ if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) &&
+ msg_handler != NULL) {
+ nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = msg_handler;
+ } else {
+ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
+ "NLINK: nl_srv_register failed for msg_type %d",
+ msg_type);
+ retcode = -EINVAL;
+ }
+
+ return retcode;
+}
+
+/*
+ * Unregister the message handler for a specified module.
+ */
+int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler)
+{
+ int retcode = 0;
+
+ if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) &&
+ (nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] == msg_handler)) {
+ nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = NULL;
+ } else {
+ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
+ "NLINK: nl_srv_unregister failed for msg_type %d",
+ msg_type);
+ retcode = -EINVAL;
+ }
+
+ return retcode;
+}
/*
* Unicast the message to the process in user space identfied
@@ -601,7 +624,6 @@ int nl_srv_bcast(struct sk_buff *skb)
dev_kfree_skb(skb);
return err;
}
-#endif
/*
* Processes the Netlink socket input queue.