From patchwork Mon Oct 24 17:56:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 9392779 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1300060231 for ; Mon, 24 Oct 2016 17:57:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BA5529099 for ; Mon, 24 Oct 2016 17:57:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F300D29164; Mon, 24 Oct 2016 17:57:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E4629099 for ; Mon, 24 Oct 2016 17:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938781AbcJXR5R (ORCPT ); Mon, 24 Oct 2016 13:57:17 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:34000 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934597AbcJXR5N (ORCPT ); Mon, 24 Oct 2016 13:57:13 -0400 Received: by mail-pf0-f177.google.com with SMTP id r16so102813112pfg.1 for ; Mon, 24 Oct 2016 10:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VMxot+Z397PY9/tjEHQLPtEB6kLvAOYV/ayyQHr2x04=; b=ENzLc8tM8LUF12MPK/EtADbM8P13KkIGf905bJYaLAmiPPpny/Qpwe/eX5WavxRJ5R TOuBH264kRqbS3ZaYTsC/fCPiQU/EC4nQQ2J4HqrNSDTlUp+bNp88nedT+/a5g/ow8w9 xENAWCxgio8OB+6mT4GIjCBC2CxuNBdbQO6GnmXS+PLPB4PmEmpQ1fD+maUnUy07vAvO ZrwK82MljYdiNFJvj6r+odefAjXtd24TMz7ky0BVQLg2BNfSf6HyBeqctOS7iiHahFyl i1t1x3jlqytQT8cmMIr0zzPrbePE7axJNDmbTrhUnW/4DmrXHoNOD09QqdwqO+AXkxMo Hyhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VMxot+Z397PY9/tjEHQLPtEB6kLvAOYV/ayyQHr2x04=; b=IH47AVzUWManNjpz/HPylTCtkj7BGyuNGqPabKx2n3/pX6Qo/cvl7Khp3hiiQUez9G XUfOVaNdJvR1I/tmSYS7kWfMaGIZOdEb0f3jnzs77kG0BdBLsiQx3meisQIDHeBttuSw /Z6Wpq5egJJKI9Jrl9BVFDTKcLR5wdEH9v9HORi1Du06d1uVXclnLziDAMKo19IvGjmw 4/RoMbhUWCO7ZNJzkvQws5InI6b70qcbe50YXWUtDpAb/tZUYcCsMz73wj/PIDUVTMuS u6snX1U8Jxg+f7PHDc/m14os8GiiBpLOrHFc6V3hwU+XkvN/xxoG+yew7Bi8SoLw6Amy AjqA== X-Gm-Message-State: ABUngvcp0RSHov7g7jLSWiwZIzCn8pPsmjdGcOSx2nfCE9sQN/RS8pTw6iwPr5A7DSyabac1 X-Received: by 10.99.7.210 with SMTP id 201mr3090882pgh.51.1477331832819; Mon, 24 Oct 2016 10:57:12 -0700 (PDT) Received: from rajat.mtv.corp.google.com ([172.22.64.13]) by smtp.gmail.com with ESMTPSA id e74sm26996567pfk.13.2016.10.24.10.57.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 10:57:12 -0700 (PDT) From: Rajat Jain To: Amitkumar Karwar , Nishant Sarmukadam , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Xinming Hu Cc: Rajat Jain , Brian Norris , rajatxjain@gmail.com Subject: [PATCH 2/3] mwifiex: Introduce mwifiex_probe_of() to parse common properties Date: Mon, 24 Oct 2016 10:56:52 -0700 Message-Id: <1477331813-42151-3-git-send-email-rajatja@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1477331813-42151-1-git-send-email-rajatja@google.com> References: <1477331813-42151-1-git-send-email-rajatja@google.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce function mwifiex_probe_of() to parse common properties. Since the interface drivers get to decide whether or not the device tree node was a valid one (depending on the compatible property), let the interface drivers pass a flag to indicate whether the device tree node was a valid one. The function mwifiex_probe_of()nodetself is currently only a place holder with the next patch adding content to it. Signed-off-by: Rajat Jain --- drivers/net/wireless/marvell/mwifiex/main.c | 15 ++++++++++++++- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- drivers/net/wireless/marvell/mwifiex/pcie.c | 4 +++- drivers/net/wireless/marvell/mwifiex/sdio.c | 4 +++- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 5 +---- drivers/net/wireless/marvell/mwifiex/usb.c | 2 +- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index dcceab2..b2f3d96 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -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. * @@ -1568,7 +1578,7 @@ EXPORT_SYMBOL_GPL(mwifiex_do_flr); int mwifiex_add_card(void *card, struct semaphore *sem, struct mwifiex_if_ops *if_ops, u8 iface_type, - struct device *dev) + struct device *dev, bool of_node_valid) { struct mwifiex_adapter *adapter; @@ -1581,6 +1591,9 @@ mwifiex_add_card(void *card, struct semaphore *sem, } adapter->dev = dev; + if (of_node_valid) + mwifiex_probe_of(adapter); + adapter->iface_type = iface_type; adapter->card_sem = sem; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 91218a1..83e0776 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1412,7 +1412,7 @@ static inline u8 mwifiex_is_tdls_link_setup(u8 status) int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, u32 func_init_shutdown); int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8, - struct device *); + struct device *, bool); int mwifiex_remove_card(struct mwifiex_adapter *, struct semaphore *); void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version, diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 49b5835..ea423d5 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -194,6 +194,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct pcie_service_card *card; + bool valid_of_node = false; int ret; pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n", @@ -221,10 +222,11 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, ret = mwifiex_pcie_probe_of(&pdev->dev); if (ret) goto err_free; + valid_of_node = true; } ret = mwifiex_add_card(card, &add_remove_card_sem, &pcie_ops, - MWIFIEX_PCIE, &pdev->dev); + MWIFIEX_PCIE, &pdev->dev, valid_of_node); if (ret) { pr_err("%s failed\n", __func__); goto err_free; diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index c95f41f..558743a 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -156,6 +156,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { int ret; struct sdio_mmc_card *card = NULL; + bool valid_of_node = false; pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n", func->vendor, func->device, func->class, func->num); @@ -203,10 +204,11 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) dev_err(&func->dev, "SDIO dt node parse failed\n"); goto err_disable; } + valid_of_node = true; } ret = mwifiex_add_card(card, &add_remove_card_sem, &sdio_ops, - MWIFIEX_SDIO, &func->dev); + MWIFIEX_SDIO, &func->dev, valid_of_node); if (ret) { dev_err(&func->dev, "add card failed\n"); goto err_disable; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index c8dccf5..73e337e 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c @@ -2218,10 +2218,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) { diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index f847fff..11c9629 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -476,7 +476,7 @@ static int mwifiex_usb_probe(struct usb_interface *intf, usb_set_intfdata(intf, card); ret = mwifiex_add_card(card, &add_remove_card_sem, &usb_ops, - MWIFIEX_USB, &card->udev->dev); + MWIFIEX_USB, &card->udev->dev, false); if (ret) { pr_err("%s: mwifiex_add_card failed: %d\n", __func__, ret); usb_reset_device(udev);