mwifiex: Introduce mwifiex_probe_of() to parse common properties
authorRajat Jain <rajatja@google.com>
Tue, 15 Nov 2016 13:36:03 +0000 (19:06 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 19 Nov 2016 07:13:11 +0000 (09:13 +0200)
Introduce function mwifiex_probe_of() to parse common properties.
Interface drivers get to decide whether or not the device tree node
was a valid one (depending on the compatible property),
Lets fill "adapter->dt_node" in mwifiex_add_card().

The function mwifiex_probe_of() is currently only a place holder with
the next patch adding content to it.

Signed-off-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/main.c
drivers/net/wireless/marvell/mwifiex/sta_cmd.c

index dcceab2899e53dd7a198621b4a81f36d6c57f3a3..835d330140862dd38b1e4d67aec13ca0675bcbc8 100644 (file)
@@ -1552,6 +1552,16 @@ void mwifiex_do_flr(struct mwifiex_adapter *adapter, bool prepare)
 }
 EXPORT_SYMBOL_GPL(mwifiex_do_flr);
 
+static void mwifiex_probe_of(struct mwifiex_adapter *adapter)
+{
+       struct device *dev = adapter->dev;
+
+       if (!dev->of_node)
+               return;
+
+       adapter->dt_node = dev->of_node;
+}
+
 /*
  * This function adds the card.
  *
@@ -1581,6 +1591,8 @@ mwifiex_add_card(void *card, struct semaphore *sem,
        }
 
        adapter->dev = dev;
+       mwifiex_probe_of(adapter);
+
        adapter->iface_type = iface_type;
        adapter->card_sem = sem;
 
index b697b61e8a1081cdecbc9919b7603cdd5a173732..bcd64081d4a8a67258eb0e80e1e178b9d07e2cc5 100644 (file)
@@ -2235,10 +2235,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
                 * The cal-data can be read from device tree and/or
                 * a configuration file and downloaded to firmware.
                 */
-               if ((priv->adapter->iface_type == MWIFIEX_SDIO ||
-                   priv->adapter->iface_type == MWIFIEX_PCIE) &&
-                   adapter->dev->of_node) {
-                       adapter->dt_node = adapter->dev->of_node;
+               if (adapter->dt_node) {
                        if (of_property_read_u32(adapter->dt_node,
                                                 "marvell,wakeup-pin",
                                                 &data) == 0) {