From patchwork Fri Aug 10 23:39:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 10563219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEB5D1804 for ; Fri, 10 Aug 2018 23:40:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93CA42B25E for ; Fri, 10 Aug 2018 23:40:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83C102B2B9; Fri, 10 Aug 2018 23:40:19 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 26C6B2B25E for ; Fri, 10 Aug 2018 23:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=nYAl1jZLJHWJA93suWbUbKwHpq2pBqKhz4ZSxPNUa0M=; b=kbE5zokgNK+XKe C+qW2S8eVM0CjoPRiZo4J780hTljZUIMDcQOYgm69CCmIVBLNp4X2j0ILktNNKdotR8UxFYHVsTKT LtfSXFHQG6pxMbhpOeR9rG/8cEmW0GR41CDX5dhukOVoh5dBnKLhk127IZFu5f8U8hYRyhvYXmr3s rMcqMKlhR8xU0w7958FmJMx2vZxmnTYcLML/i2H1r7COlMxwzgtMefPgeLDvoJNhvVnnKB9U8dfYK +Y702q0JLaMu57DPPIIjb2rfB1PFY0ImmWF8P3rGY28FTbG3HSs2a+uXsKnavgxfnj8QqUqrcGbNA 9oCfRoPsja6OZNjgtgVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1foH0p-0007wZ-Nr; Fri, 10 Aug 2018 23:40:07 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1foH0m-0006yQ-Hq for ath10k@lists.infradead.org; Fri, 10 Aug 2018 23:40:06 +0000 Received: by mail-pl0-x243.google.com with SMTP id d5-v6so4644786pll.4 for ; Fri, 10 Aug 2018 16:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SHkDb6qaKxPT3RKCwWTlK162HxGfwzC3DwW8Inu+HKk=; b=QyQ+jWboymP+kH1M8h+mDOk+EuHT0IQANJmMmzwTKJaJ3fxH9ag4EqOiXcQTc7aSbR pi46WirGbtb8a+6eOORZ5bcUys6xC0xqbUMxfGT6grh8RhSrAvUR6QdfLUEB+ysUrOk/ QPU9J+NCJ3jnXpAOuEqa2FbRfolJCNTcIsZmQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SHkDb6qaKxPT3RKCwWTlK162HxGfwzC3DwW8Inu+HKk=; b=Obmrh2HraGUjg69bCHT2qfOQryaA1uqHt7iuCOT1velDRq3U096dBJLksge05DnkXg Xf3Bc3VmvQyUP904+7DNeyyJvOPl2xz/cgMFw35KjeZpme6BEc3N9UC+6+dIs3C5NCDz J9pd6dQLSfLgY6B1ZCEU4wz/64i1V/16a+svDLJk59OaxWdDba2qiEcqUnMQUlmBTYye cjN8TsG6JOQYDBtDk87XuR2TYxLLJZGyk/OnwFxSXT2lnlXw4pRSTN+dN2I52RNtQRu+ RYQdmltkZ83Z84r98JtaABv4sfL/ClzgJofzQz3A5JxlRkHw77hH+lgBs2wrgGGfQx9v 27Pw== X-Gm-Message-State: AOUpUlGy08se2mrXv8BEN1M/rmDuUX7tG/VtbOCyrqxkQ3lnuhK8D8Ia 4mjFR/7Im2aFufW5cdGTeBnamKOX+34= X-Google-Smtp-Source: AA+uWPwIebREHfzipAAji/gNIqAwhcDRpKSeN9BR7Bf1oFbAPKC7VCriFDmtKbBqJiG23KAhpKnAMg== X-Received: by 2002:a17:902:e85:: with SMTP id 5-v6mr7798101plx.73.1533944393185; Fri, 10 Aug 2018 16:39:53 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:299d:6b87:5478:d28a]) by smtp.gmail.com with ESMTPSA id 75-v6sm20985577pfr.115.2018.08.10.16.39.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 16:39:51 -0700 (PDT) From: Brian Norris To: Kalle Valo Subject: [PATCH] ath10k: retrieve MAC address from firmware if provided Date: Fri, 10 Aug 2018 16:39:48 -0700 Message-Id: <20180810233948.144792-1-briannorris@chromium.org> X-Mailer: git-send-email 2.18.0.597.ga71716f1ad-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180810_164004_604830_B48B01F8 X-CRM114-Status: GOOD ( 12.26 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brian Norris , Govind Singh , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Devices may provide their own MAC address via system firmware (e.g., device tree), especially in the case where the device doesn't have a useful EEPROM on which to store its MAC address (e.g., for integrated Wifi). Use the generic device helper to retrieve the MAC address, and (if present) honor it above the MAC address advertised by the card. Signed-off-by: Brian Norris --- drivers/net/wireless/ath/ath10k/core.c | 3 +++ drivers/net/wireless/ath/ath10k/wmi.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index c40cd129afe7..840c1f039098 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -2602,6 +2603,8 @@ static int ath10k_core_probe_fw(struct ath10k *ar) ath10k_debug_print_board_info(ar); } + device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); + ret = ath10k_core_init_firmware_features(ar); if (ret) { ath10k_err(ar, "fatal problem with firmware features: %d\n", diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index fd612d2905b0..3cfd98de8ad2 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -5449,7 +5449,8 @@ int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb) arg.mac_addr, __le32_to_cpu(arg.status)); - ether_addr_copy(ar->mac_addr, arg.mac_addr); + if (is_zero_ether_addr(ar->mac_addr)) + ether_addr_copy(ar->mac_addr, arg.mac_addr); complete(&ar->wmi.unified_ready); return 0; }