From patchwork Wed Dec 19 15:56:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Whitten X-Patchwork-Id: 10737537 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 BE28814DE for ; Wed, 19 Dec 2018 15:56:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA1DE2B48D for ; Wed, 19 Dec 2018 15:56:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A09D2B554; Wed, 19 Dec 2018 15:56:59 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 EDB012B48D for ; Wed, 19 Dec 2018 15:56:58 +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:References:In-Reply-To: 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: List-Owner; bh=tV0ydjFXY+08IeuvU6JIFD66bBL6DB93tOX0YHn9Ek4=; b=N73p3WV+CKq3a8 dp3FogbwsNxrQpRZ7YDd1sy36YkEyZ4EYhNcS/95voAIVCDIe8hqF1vpljrG2mkQLngS8vE3JkdMD d5yEVhyohKpgD62+xfiUEoEoYUZOiphfpT2aT1pZ2rbKAdvqR/3FxXk+EmBb/oRVQevGRroTRzVOa ymRxBz1hoNpLjXqyVzk8SsUUlTLJhPGceVwqAOF7Iaik4txdnbIi8wCBFWP/cB9N4bkkUb6L+JTS4 WrFa5drXEjDJKq9SQUptl8QH5MRMg1vyX9sQxU8+8hLrRO5bYzKUGZhp/4XAo5sEEYlDmEJTRgoDU oo7Xesjl7yOWdQF/9kiQ==; 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 1gZeDP-0005f3-KI; Wed, 19 Dec 2018 15:56:55 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gZeD8-0005Ng-Lb; Wed, 19 Dec 2018 15:56:40 +0000 Received: by mail-wr1-x441.google.com with SMTP id c14so20065056wrr.0; Wed, 19 Dec 2018 07:56:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i25TBhQL7o6CHJnnqUQpts9IplaeJoYk7okEUv8SLCY=; b=cd/5I+wvqr4dRJG8VPC/swkl7I15HMcU7aC7EHf51CGe6xhnShdzhGUCp7d3vxDjJK AEpnk8ff7bElUFzsO0z4sQhWHCcxdWUnC/DwfWqkx1ZvP3/Sx5SRVi0oqNUXg7+8Ffae 3itgb8oOqv3qAPSUU0U4BG5lun+hwaITnhTx4OxHlGwBUxO11bEnbDTgGj5kq/O6PJZg 389Ljn8JTCWhQ+mOpyj7IJoESv5ZBeqIDGcAB6+yfsGHjuKl49yXx8OObnWolzI3XjAm l0sr9W4NHhG6WUSCoWLaASjblV2zMMcSaNNxhw4LejCYJEOIsPyc8Z+5euEfD2ivs4CM d8tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=i25TBhQL7o6CHJnnqUQpts9IplaeJoYk7okEUv8SLCY=; b=ZxbNxGKhiZ3YSn5pGarhAeU+5HiKpsm2BigC+VveIDEwHP3jdM811+FuIhhM86Tw4j Pmi/lF0UnGyQFJkq3yZmW1y+cRdCHsPjYElpyM9lkL9SsG/1HHQHA+Y7nAJrm9Ii0q+m vdzG7Ro6CO/ggn6cWF8l5kMogYSGq4RLImbwxYNrsJd0qk8V3FmLU9E/GaAPlSUFwMgU RZtmcrh2ZFQ5Z9+mDewxj7x7ZPftyA8hqp9W9+DgBx0O2gP8Z6ReL5Q4lr40aSrxIEUn ZxQTZEnCpDm56ymFg0BtC7BJNfycJE4scDt4FzP7XVwCsy3octVoLPtropK4XB4RR587 gfuA== X-Gm-Message-State: AA+aEWZxeY10Oiu6NKmIxlehq8W4C7KrePspxjvjCJLP8qjYg7DtTd1e YH6IttfFIvXqA5eW+Hy7294= X-Google-Smtp-Source: AFSGD/XJldM8wQzQKmgztzLgvYW6XD6F6f9rBcFdXRm/4FebNLhJ0nN7qoNCfqSk2sluqmiPwI2/mQ== X-Received: by 2002:a5d:5409:: with SMTP id g9mr19569977wrv.88.1545234986687; Wed, 19 Dec 2018 07:56:26 -0800 (PST) Received: from Sarah.corp.lairdtech.com ([109.174.151.67]) by smtp.gmail.com with ESMTPSA id c9sm6836099wmh.27.2018.12.19.07.56.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 07:56:25 -0800 (PST) From: Ben Whitten X-Google-Original-From: Ben Whitten To: starnight@g.ncu.edu.tw, jiri@resnulli.us, afaerber@suse.de Subject: [PATCH RFC lora-next 1/4] net: lora: sx125x sx1301: correct style warnings Date: Wed, 19 Dec 2018 15:56:13 +0000 Message-Id: <20181219155616.9547-2-ben.whitten@lairdtech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181219155616.9547-1-ben.whitten@lairdtech.com> References: <20181219155616.9547-1-ben.whitten@lairdtech.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181219_075638_703770_E0A1F502 X-CRM114-Status: GOOD ( 15.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Whitten , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-lpwan@lists.infradead.org, "David S. Miller" , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Checkpatch highlights some style issues which need to be addressed. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 20 +++++++++------ drivers/net/lora/sx1301.c | 52 ++++++++++++++++++++++----------------- drivers/net/lora/sx1301.h | 7 +++--- 3 files changed, 45 insertions(+), 34 deletions(-) diff --git a/drivers/net/lora/sx125x.c b/drivers/net/lora/sx125x.c index b7ca782b9386..1a941f663c52 100644 --- a/drivers/net/lora/sx125x.c +++ b/drivers/net/lora/sx125x.c @@ -49,7 +49,7 @@ struct sx125x_priv { struct device *dev; struct regmap *regmap; - struct regmap_field *regmap_fields[ARRAY_SIZE(sx125x_regmap_fields)]; + struct regmap_field *regmap_fields[ARRAY_SIZE(sx125x_regmap_fields)]; }; #define to_clkout(_hw) container_of(_hw, struct sx125x_priv, clkout_hw) @@ -67,13 +67,13 @@ static struct regmap_config __maybe_unused sx125x_regmap_config = { }; static int sx125x_field_write(struct sx125x_priv *priv, - enum sx125x_fields field_id, u8 val) + enum sx125x_fields field_id, u8 val) { return regmap_field_write(priv->regmap_fields[field_id], val); } static int sx125x_field_read(struct sx125x_priv *priv, - enum sx125x_fields field_id, unsigned int *val) + enum sx125x_fields field_id, unsigned int *val) { return regmap_field_read(priv->regmap_fields[field_id], val); } @@ -149,8 +149,12 @@ static int sx125x_register_clock_provider(struct sx125x_priv *priv) init.num_parents = 1; priv->clkout_hw.init = &init; - of_property_read_string_index(dev->of_node, "clock-output-names", 0, - &init.name); + ret = of_property_read_string_index(dev->of_node, "clock-output-names", + 0, &init.name); + if (ret) { + dev_err(dev, "unable to find output name\n"); + return ret; + } priv->clkout = devm_clk_register(dev, &priv->clkout_hw); if (IS_ERR(priv->clkout)) { @@ -158,7 +162,7 @@ static int sx125x_register_clock_provider(struct sx125x_priv *priv) return PTR_ERR(priv->clkout); } ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get, - &priv->clkout_hw); + &priv->clkout_hw); return ret; } @@ -180,8 +184,8 @@ static int __maybe_unused sx125x_regmap_probe(struct device *dev, struct regmap const struct reg_field *reg_fields = sx125x_regmap_fields; priv->regmap_fields[i] = devm_regmap_field_alloc(dev, - priv->regmap, - reg_fields[i]); + priv->regmap, + reg_fields[i]); if (IS_ERR(priv->regmap_fields[i])) { ret = PTR_ERR(priv->regmap_fields[i]); dev_err(dev, "Cannot allocate regmap field: %d\n", ret); diff --git a/drivers/net/lora/sx1301.c b/drivers/net/lora/sx1301.c index 23cbddc364e5..e75df93b96d8 100644 --- a/drivers/net/lora/sx1301.c +++ b/drivers/net/lora/sx1301.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -/* - * Semtech SX1301 LoRa concentrator +/* Semtech SX1301 LoRa concentrator * * Copyright (c) 2018 Andreas Färber * Copyright (c) 2018 Ben Whitten @@ -55,12 +54,13 @@ static struct regmap_config sx1301_regmap_config = { }; static int sx1301_field_write(struct sx1301_priv *priv, - enum sx1301_fields field_id, u8 val) + enum sx1301_fields field_id, u8 val) { return regmap_field_write(priv->regmap_fields[field_id], val); } -static int sx1301_agc_ram_read(struct sx1301_priv *priv, u8 addr, unsigned int *val) +static int sx1301_agc_ram_read(struct sx1301_priv *priv, u8 addr, + unsigned int *val) { int ret; @@ -79,7 +79,8 @@ static int sx1301_agc_ram_read(struct sx1301_priv *priv, u8 addr, unsigned int * return 0; } -static int sx1301_arb_ram_read(struct sx1301_priv *priv, u8 addr, unsigned int *val) +static int sx1301_arb_ram_read(struct sx1301_priv *priv, u8 addr, + unsigned int *val) { int ret; @@ -98,7 +99,8 @@ static int sx1301_arb_ram_read(struct sx1301_priv *priv, u8 addr, unsigned int * return 0; } -static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, const struct firmware *fw) +static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, + const struct firmware *fw) { u8 *buf; enum sx1301_fields rst, select_mux; @@ -165,7 +167,8 @@ static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, const struct } if (memcmp(fw->data, buf, fw->size)) { - dev_err(priv->dev, "MCU prom data read does not match data written\n"); + dev_err(priv->dev, + "MCU prom data read does not match data written\n"); kfree(buf); return -ENXIO; } @@ -228,11 +231,12 @@ static int sx1301_agc_calibrate(struct sx1301_priv *priv) return ret; } - dev_info(priv->dev, "AGC calibration firmware version %u\n", (unsigned)val); + dev_info(priv->dev, "AGC calibration firmware version %u\n", val); if (val != SX1301_MCU_AGC_CAL_FW_VERSION) { - dev_err(priv->dev, "unexpected firmware version, expecting %u\n", - SX1301_MCU_AGC_CAL_FW_VERSION); + dev_err(priv->dev, + "unexpected firmware version, expecting %u\n", + SX1301_MCU_AGC_CAL_FW_VERSION); return -ENXIO; } @@ -257,7 +261,7 @@ static int sx1301_agc_calibrate(struct sx1301_priv *priv) return ret; } - dev_info(priv->dev, "AGC status: %02x\n", (unsigned)val); + dev_info(priv->dev, "AGC status: %02x\n", val); if ((val & (BIT(7) | BIT(0))) != (BIT(7) | BIT(0))) { dev_err(priv->dev, "AGC calibration failed\n"); return -ENXIO; @@ -328,11 +332,12 @@ static int sx1301_load_all_firmware(struct sx1301_priv *priv) return ret; } - dev_info(priv->dev, "AGC firmware version %u\n", (unsigned)val); + dev_info(priv->dev, "AGC firmware version %u\n", val); if (val != SX1301_MCU_AGC_FW_VERSION) { - dev_err(priv->dev, "unexpected firmware version, expecting %u\n", - SX1301_MCU_AGC_FW_VERSION); + dev_err(priv->dev, + "unexpected firmware version, expecting %u\n", + SX1301_MCU_AGC_FW_VERSION); return -ENXIO; } @@ -342,18 +347,20 @@ static int sx1301_load_all_firmware(struct sx1301_priv *priv) return ret; } - dev_info(priv->dev, "ARB firmware version %u\n", (unsigned)val); + dev_info(priv->dev, "ARB firmware version %u\n", val); if (val != SX1301_MCU_ARB_FW_VERSION) { - dev_err(priv->dev, "unexpected firmware version, expecting %u\n", - SX1301_MCU_ARB_FW_VERSION); + dev_err(priv->dev, + "unexpected firmware version, expecting %u\n", + SX1301_MCU_ARB_FW_VERSION); return -ENXIO; } return 0; } -static netdev_tx_t sx130x_loradev_start_xmit(struct sk_buff *skb, struct net_device *netdev) +static netdev_tx_t sx130x_loradev_start_xmit(struct sk_buff *skb, + struct net_device *netdev) { if (skb->protocol != htons(ETH_P_LORA)) { kfree_skb(skb); @@ -489,11 +496,12 @@ static int sx1301_probe(struct spi_device *spi) const struct reg_field *reg_fields = sx1301_regmap_fields; priv->regmap_fields[i] = devm_regmap_field_alloc(&spi->dev, - priv->regmap, - reg_fields[i]); + priv->regmap, + reg_fields[i]); if (IS_ERR(priv->regmap_fields[i])) { ret = PTR_ERR(priv->regmap_fields[i]); - dev_err(&spi->dev, "Cannot allocate regmap field: %d\n", ret); + dev_err(&spi->dev, + "Cannot allocate regmap field: %d\n", ret); return ret; } } @@ -553,7 +561,7 @@ static int sx1301_probe(struct spi_device *spi) return ret; } - msleep(5); + usleep_range(5000, 6000); ret = sx1301_field_write(priv, F_RADIO_RST, 0); if (ret) { diff --git a/drivers/net/lora/sx1301.h b/drivers/net/lora/sx1301.h index a1a2e388207e..dd2b7da94fcc 100644 --- a/drivers/net/lora/sx1301.h +++ b/drivers/net/lora/sx1301.h @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Semtech SX1301 LoRa concentrator +/* Semtech SX1301 LoRa concentrator * * Copyright (c) 2018 Ben Whitten * Copyright (c) 2018 Andreas Färber @@ -34,7 +33,7 @@ #define SX1301_VIRT_BASE 0x100 #define SX1301_PAGE_LEN 0x80 -#define SX1301_PAGE_BASE(n) (SX1301_VIRT_BASE + (SX1301_PAGE_LEN * n)) +#define SX1301_PAGE_BASE(n) (SX1301_VIRT_BASE + (SX1301_PAGE_LEN * (n))) /* Page 0 */ #define SX1301_CHRS (SX1301_PAGE_BASE(0) + 0x23) @@ -112,7 +111,7 @@ struct sx1301_priv { struct clk *clk32m; struct gpio_desc *rst_gpio; struct regmap *regmap; - struct regmap_field *regmap_fields[ARRAY_SIZE(sx1301_regmap_fields)]; + struct regmap_field *regmap_fields[ARRAY_SIZE(sx1301_regmap_fields)]; }; int __init sx130x_radio_init(void);