From patchwork Wed May 17 14:46:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 99998 Delivered-To: patch@linaro.org Received: by 10.182.142.97 with SMTP id rv1csp254351obb; Wed, 17 May 2017 07:54:27 -0700 (PDT) X-Received: by 10.99.163.67 with SMTP id v3mr4420252pgn.210.1495032867324; Wed, 17 May 2017 07:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495032867; cv=none; d=google.com; s=arc-20160816; b=BGMnCQhP5gTcrvsGAhAixEgonUkSC2yRf4LPkCPXUwNfyzthPz+rWGlTVEVd2JaxR7 demnJEXcUaF97haSlW57cQ7i0hMcFyI8+NV5U23/E5VVbrzHT21g27nqTY37pJ3kpRLz WVzuOBVfInVTnQZ2EGUTWu3EWDzpA1Jv4+Q46rpHdMDd2K8muR2hc3kWuWMTTJCpCEpr 5+Oabmw1bbCbEluzztkwZkSL1u4Hy2t1CILkUm+BvK7mrAy3+yfsjirHad/Udd4m8Sow rhf9x1UgZR7JEmj0cjTnP+V3Jb0NcGOT08xRRAFRNjIVnjgvRN2JGtX+qYjQs6uslrnc qCWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=P/SXHXtpSNKmegsO3zZ6zNzqgxjr0cjgMVGHKFOUgcg=; b=whHmAxRJj/RIhPfLMvGq5XnrY1ZaQ07Jh4e+Wzb999DVFTObu+945UUsaVhlqfRhni SCaZUzN2P2dOiNS3IbRtujRAuRV6eqfnK19LlnjH+iZMBMZZ2Lz/qcpVRYE3u1ann2rQ iDb5Ykt3oJAaKmtBi5IT+dHY9+AQEFLLQUoWY3b1ZVanmL0NfgwNoCBz6qEgQoduwn0p O3dw2dKAUj8c8VBrUi/ou7ZkEcFMaX+f8uAg8zMXESAMPPNR2GksezuxFaPcIxwT2Yqj F1fFoqhZXlL+f2mqPI+N1kM90dt8faolc+1/1nKAnhBR3hcPKdLaQR50iChhBT3puAV6 NuOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 88si2494821plf.60.2017.05.17.07.54.27; Wed, 17 May 2017 07:54:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754898AbdEQOyL (ORCPT + 6 others); Wed, 17 May 2017 10:54:11 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:60775 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754468AbdEQOrv (ORCPT ); Wed, 17 May 2017 10:47:51 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0LnBK1-1dcwek0pqv-00hM7g; Wed, 17 May 2017 16:47:23 +0200 From: Arnd Bergmann To: linux-wireless Cc: Arnd Bergmann , Stanislaw Gruszka , David Miller , Helmut Schaa , Kalle Valo , Daniel Golle , Mathias Kresin , Johannes Berg , Serge Vasilugin , Roman Yeryomin , Networking , Linux Kernel Mailing List , Jes Sorensen , Tom Psyborg Subject: [PATCH v2 03/10] rt2x00: convert rt2x00_rf_read return type Date: Wed, 17 May 2017 16:46:55 +0200 Message-Id: <20170517144702.1381136-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170517144702.1381136-1-arnd@arndb.de> References: <20170517144702.1381136-1-arnd@arndb.de> X-Provags-ID: V03:K0:ooiFlY7mZMvfcVDfjOd2mtF147ZczWT6sJqHJ96um9qTB6nCVh7 djNHqFj/e/u9TnywTBB5OjcTZaEyae/yYaKTgxw3/1Qy0VbPlGCmUJ92ugkagiD3JffyXBz wcKA2ZPCHET4chmqO/o3i9ShAlDIj2TwRg6rSZoal3YwOj7G2HNg4Flbv81DzlHrfJhkFQH CaP/t44bppbDno7uGbuRg== X-UI-Out-Filterresults: notjunk:1; V01:K0:1jebCT/XWgQ=:urHG/eMQMUYKw4IWoYY9QY Fp+QMlGa7DFrVMgEQ8NhTmO6SphOtYm3rtdsJtx1FyRJ33yglsdtKkXutvxdP9YUQdFZWf1Pj iCV8XgGFQqSBbPAcesTsaST30NeNN0Qt4ygcgq0CJMsJvefPhLQIarNZ8Cbyx4Do7gRddNYFf kJoNgWeATi+5Eja6gNtOtgeYWeNJVJ0kTnsSZgihtKA05Hh09qLaKMUUpVqbOD6z5/6yG9o7E OQCSblonihgtoUiQh8ErMaTaEaAsTWTEaQn+dbTYlzMuOK8KjCLOe1nQBP4ZUrDPwPk1ktuLf KI6ZEHw+Dgu74tE0jbUqVcWiAwHdSFaKxFCKagp9jvCm1NDNsiAbX9psfdSbqONz19LPGg7Gg Owdc4ZvUZEforHEEhKMFB8WGDCcFMYGm6aeMQrGRmM0MCepOm4SLGp/Tha3+ViX4QsE9sZd0G bMOz2IENk8Xkpm7k7O9qUouAtdzKLttFyhP84YBIu2ChEuntfTcnATuk7tlpvdAYZH0NE8i5N N1YCtQm2qny4Q3z4xZCx5eLhor8uJAwldla7WEHSkezjETmpr6SoI0IBiQPxeSajo5lOfhMLU YfFwz8eyp+uA+O0FmODjhmPT1OQKp6sNLi6KYuTbL//bqIQgxOTo4NJcVKLGlfUGOmrzY6cH2 wIT0LBSDAt8IogAQRQiA9Jl9knwxeBI+LAy2a/yXn5W4Xqmaf9tYojaG3ILXeCKpQXig= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is a semi-automated conversion to change rt2x00_rf_read() to return the register contents instead of passing them by value, resulting in much better object code. The majority of the patch was done using: sed -i 's:\(\(.*, .*\), &\(.*\));:\2 = \1);:' \ drivers/net/wireless/ralink/rt2x00/rt* Signed-off-by: Arnd Bergmann --- drivers/net/wireless/ralink/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2500pci.c | 4 ++-- drivers/net/wireless/ralink/rt2x00/rt2500usb.c | 4 ++-- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 11 ++--------- drivers/net/wireless/ralink/rt2x00/rt61pci.c | 10 +++++----- drivers/net/wireless/ralink/rt2x00/rt73usb.c | 10 +++++----- 7 files changed, 18 insertions(+), 25 deletions(-) -- 2.9.0 diff --git a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c index 3ba9a1674e1d..d41832292db2 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c @@ -199,7 +199,7 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = { .word_count = BBP_SIZE / sizeof(u8), }, .rf = { - .read = _rt2x00_rf_read, + .read = rt2x00_rf_read, .write = rt2400pci_rf_write, .word_base = RF_BASE, .word_size = sizeof(u32), diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c index d9b061b73e83..232feba0773f 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c @@ -199,7 +199,7 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = { .word_count = BBP_SIZE / sizeof(u8), }, .rf = { - .read = _rt2x00_rf_read, + .read = rt2x00_rf_read, .write = rt2500pci_rf_write, .word_base = RF_BASE, .word_size = sizeof(u32), @@ -556,7 +556,7 @@ static void rt2500pci_config_txpower(struct rt2x00_dev *rt2x00dev, { u32 rf3; - rt2x00_rf_read(rt2x00dev, 3, &rf3); + rf3 = rt2x00_rf_read(rt2x00dev, 3); rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); rt2500pci_rf_write(rt2x00dev, 3, rf3); } diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c index 5bd160f732de..9cff9ddafb72 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c @@ -268,7 +268,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { .word_count = BBP_SIZE / sizeof(u8), }, .rf = { - .read = _rt2x00_rf_read, + .read = rt2x00_rf_read, .write = rt2500usb_rf_write, .word_base = RF_BASE, .word_size = sizeof(u32), @@ -639,7 +639,7 @@ static void rt2500usb_config_txpower(struct rt2x00_dev *rt2x00dev, { u32 rf3; - rt2x00_rf_read(rt2x00dev, 3, &rf3); + rf3 = rt2x00_rf_read(rt2x00dev, 3); rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); rt2500usb_rf_write(rt2x00dev, 3, rf3); } diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 9b8c19dcdb2c..fef53d6a888a 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -1265,7 +1265,7 @@ const struct rt2x00debug rt2800_rt2x00debug = { .word_count = BBP_SIZE / sizeof(u8), }, .rf = { - .read = _rt2x00_rf_read, + .read = rt2x00_rf_read, .write = rt2800_rf_write, .word_base = RF_BASE, .word_size = sizeof(u32), diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h index f2ae33bf2ef2..36791f7ae2ce 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h @@ -1049,15 +1049,8 @@ struct rt2x00_bar_list_entry { * Generic RF access. * The RF is being accessed by word index. */ -static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u32 *data) -{ - BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); - *data = rt2x00dev->rf[word - 1]; -} - -static inline u32 _rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word) +static inline u32 rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, + const unsigned int word) { BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); return rt2x00dev->rf[word - 1]; diff --git a/drivers/net/wireless/ralink/rt2x00/rt61pci.c b/drivers/net/wireless/ralink/rt2x00/rt61pci.c index efe8a766b251..147d1d2cc0a6 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c +++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c @@ -236,7 +236,7 @@ static const struct rt2x00debug rt61pci_rt2x00debug = { .word_count = BBP_SIZE / sizeof(u8), }, .rf = { - .read = _rt2x00_rf_read, + .read = rt2x00_rf_read, .write = rt61pci_rf_write, .word_base = RF_BASE, .word_size = sizeof(u32), @@ -922,10 +922,10 @@ static void rt61pci_config_txpower(struct rt2x00_dev *rt2x00dev, { struct rf_channel rf; - rt2x00_rf_read(rt2x00dev, 1, &rf.rf1); - rt2x00_rf_read(rt2x00dev, 2, &rf.rf2); - rt2x00_rf_read(rt2x00dev, 3, &rf.rf3); - rt2x00_rf_read(rt2x00dev, 4, &rf.rf4); + rf.rf1 = rt2x00_rf_read(rt2x00dev, 1); + rf.rf2 = rt2x00_rf_read(rt2x00dev, 2); + rf.rf3 = rt2x00_rf_read(rt2x00dev, 3); + rf.rf4 = rt2x00_rf_read(rt2x00dev, 4); rt61pci_config_channel(rt2x00dev, &rf, txpower); } diff --git a/drivers/net/wireless/ralink/rt2x00/rt73usb.c b/drivers/net/wireless/ralink/rt2x00/rt73usb.c index 5db174922120..a36dee1a4f20 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c @@ -181,7 +181,7 @@ static const struct rt2x00debug rt73usb_rt2x00debug = { .word_count = BBP_SIZE / sizeof(u8), }, .rf = { - .read = _rt2x00_rf_read, + .read = rt2x00_rf_read, .write = rt73usb_rf_write, .word_base = RF_BASE, .word_size = sizeof(u32), @@ -805,10 +805,10 @@ static void rt73usb_config_txpower(struct rt2x00_dev *rt2x00dev, { struct rf_channel rf; - rt2x00_rf_read(rt2x00dev, 1, &rf.rf1); - rt2x00_rf_read(rt2x00dev, 2, &rf.rf2); - rt2x00_rf_read(rt2x00dev, 3, &rf.rf3); - rt2x00_rf_read(rt2x00dev, 4, &rf.rf4); + rf.rf1 = rt2x00_rf_read(rt2x00dev, 1); + rf.rf2 = rt2x00_rf_read(rt2x00dev, 2); + rf.rf3 = rt2x00_rf_read(rt2x00dev, 3); + rf.rf4 = rt2x00_rf_read(rt2x00dev, 4); rt73usb_config_channel(rt2x00dev, &rf, txpower); }