From patchwork Thu Jun 23 14:57:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 9195401 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 081786075F for ; Thu, 23 Jun 2016 14:57:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED3412843A for ; Thu, 23 Jun 2016 14:57:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E20112845B; Thu, 23 Jun 2016 14:57:46 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 700DD2843A for ; Thu, 23 Jun 2016 14:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbcFWO5p (ORCPT ); Thu, 23 Jun 2016 10:57:45 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33647 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750960AbcFWO5o (ORCPT ); Thu, 23 Jun 2016 10:57:44 -0400 Received: by mail-wm0-f66.google.com with SMTP id r201so11649795wme.0 for ; Thu, 23 Jun 2016 07:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K6XItbXNRrX8Fn2Ync3ru7745qZnJEzyDznlN4YiF/8=; b=rRHlwa6bhGhvVFMml8fLlcbtX7+giL7avhu8EgZCAMP68xJuyBD6yOjztpKpSRezDm GyMGVgpjzVwHQC8Tl7HdqjSI8RUoSDIixbizEZOIePM2ZOtAB6HqRRyUW7s/l4VBt4kB cwrgVvzd6dfZPc2jZB1IVQlsTryt8oULmAPJDYFLFnMJIWtwDPWrTNU/0U0Eos3tyF9I G+JW1NfwW06qK85IzDRVBB4vuglq1MkAZlOYHu7ZFghLlS5S5pejGVcnzQkc/JI9Kj9y 7ZD0lpZp7HbwVbCTAWzq1i0pgchSNzgSXSnnoHHUTZ1lxhHLfeB6MBjn7+spluTx4NgQ sz1w== 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=K6XItbXNRrX8Fn2Ync3ru7745qZnJEzyDznlN4YiF/8=; b=I4+bO3ImGBdjIbI258cWDew8nbuCJmrepb9tuNEa59Ab5wyN+N2fg01BGqQ7I+FTtY aRNOXZpQWtFEvD06ds5A+rHHEET/ICV0+F4kBKTCF9InQeuMURiY7mDzwLhcVgzvjfVq EOq/ZgauEWXeW+N/rom+bwBmqShTnnJzKPvnNisLI1ZlwGVy8/6y1dqTzgdppvp5az/D /GBGZ0QxELJL01+NLZA0Oy+NrkMgfOOI8F9HiJ/iDHBHm69rnJHzexuhJXO8XG0lK1z6 RhzQi1oLcXBrJykrNklwnsw+a0aRr3kZTi1AOnzIGNaga+NrgKnYhWJmIphIRo1MD9sd IUZQ== X-Gm-Message-State: ALyK8tK95lZ/+KMjaUNoeThnP55IsgpGaY61AZ9s95Y2aM+501ijZWb9V9KAZkn2wVUeKQ== X-Received: by 10.194.179.131 with SMTP id dg3mr32475464wjc.143.1466693862541; Thu, 23 Jun 2016 07:57:42 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD3CD1B0478F6703992958538.dip0.t-ipconnect.de. [2003:dc:d3cd:1b04:78f6:7039:9295:8538]) by smtp.googlemail.com with ESMTPSA id yr4sm535503wjc.18.2016.06.23.07.57.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2016 07:57:41 -0700 (PDT) From: Martin Blumenstingl To: ath9k-devel@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org Cc: nbd@nbd.name, Martin Blumenstingl Subject: [PATCH 5/6] ath9k: move all ath9k_platform_data initialization into one function Date: Thu, 23 Jun 2016 16:57:13 +0200 Message-Id: <20160623145714.20576-6-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160623145714.20576-1-martin.blumenstingl@googlemail.com> References: <20160623145714.20576-1-martin.blumenstingl@googlemail.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 No functional changes, this simply makes the code easier to understand because all initialization based on ath9k_platform_data is now within one function. Signed-off-by: Martin Blumenstingl --- drivers/net/wireless/ath/ath9k/init.c | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 384929d..a0f4a52 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -512,15 +512,31 @@ static void ath9k_eeprom_release(struct ath_softc *sc) release_firmware(sc->sc_ah->eeprom_blob); } -static int ath9k_init_soc_platform(struct ath_softc *sc) +static int ath9k_init_platform(struct ath_softc *sc) { struct ath9k_platform_data *pdata = sc->dev->platform_data; struct ath_hw *ah = sc->sc_ah; - int ret = 0; + struct ath_common *common = ath9k_hw_common(ah); + int ret; if (!pdata) return 0; + if (!pdata->use_eeprom) { + ah->ah_flags &= ~AH_USE_EEPROM; + ah->gpio_mask = pdata->gpio_mask; + ah->gpio_val = pdata->gpio_val; + ah->led_pin = pdata->led_pin; + ah->is_clk_25mhz = pdata->is_clk_25mhz; + ah->get_mac_revision = pdata->get_mac_revision; + ah->external_reset = pdata->external_reset; + ah->disable_2ghz = pdata->disable_2ghz; + ah->disable_5ghz = pdata->disable_5ghz; + + if (!pdata->endian_check) + ah->ah_flags |= AH_NO_EEP_SWAP; + } + if (pdata->eeprom_name) { ret = ath9k_eeprom_request(sc, pdata->eeprom_name); if (ret) @@ -533,13 +549,15 @@ static int ath9k_init_soc_platform(struct ath_softc *sc) if (pdata->tx_gain_buffalo) ah->config.tx_gain_buffalo = true; - return ret; + if (pdata->macaddr) + ether_addr_copy(common->macaddr, pdata->macaddr); + + return 0; } static int ath9k_init_softc(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { - struct ath9k_platform_data *pdata = sc->dev->platform_data; struct ath_hw *ah = NULL; struct ath9k_hw_capabilities *pCap; struct ath_common *common; @@ -553,6 +571,8 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, ah->dev = sc->dev; ah->hw = sc->hw; ah->hw_version.devid = devid; + ah->ah_flags |= AH_USE_EEPROM; + ah->led_pin = -1; ah->reg_ops.read = ath9k_ioread32; ah->reg_ops.multi_read = ath9k_multi_ioread32; ah->reg_ops.write = ath9k_iowrite32; @@ -572,22 +592,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, if (!ath9k_is_chanctx_enabled()) sc->cur_chan->hw_queue_base = 0; - if (!pdata || pdata->use_eeprom) { - ah->ah_flags |= AH_USE_EEPROM; - sc->sc_ah->led_pin = -1; - } else { - sc->sc_ah->gpio_mask = pdata->gpio_mask; - sc->sc_ah->gpio_val = pdata->gpio_val; - sc->sc_ah->led_pin = pdata->led_pin; - ah->is_clk_25mhz = pdata->is_clk_25mhz; - ah->get_mac_revision = pdata->get_mac_revision; - ah->external_reset = pdata->external_reset; - ah->disable_2ghz = pdata->disable_2ghz; - ah->disable_5ghz = pdata->disable_5ghz; - if (!pdata->endian_check) - ah->ah_flags |= AH_NO_EEP_SWAP; - } - common->ops = &ah->reg_ops; common->bus_ops = bus_ops; common->ps_ops = &ath9k_ps_ops; @@ -603,7 +607,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, */ ath9k_init_pcoem_platform(sc); - ret = ath9k_init_soc_platform(sc); + ret = ath9k_init_platform(sc); if (ret) return ret; @@ -649,9 +653,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, if (ret) goto err_hw; - if (pdata && pdata->macaddr) - memcpy(common->macaddr, pdata->macaddr, ETH_ALEN); - ret = ath9k_init_queues(sc); if (ret) goto err_queues;