lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190106083754.6004-6-afaerber@suse.de>
Date:   Sun,  6 Jan 2019 09:37:48 +0100
From:   Andreas Färber <afaerber@...e.de>
To:     linux-lpwan@...ts.infradead.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Andreas Färber <afaerber@...e.de>,
        Ben Whitten <ben.whitten@...il.com>,
        "David S. Miller" <davem@...emloft.net>
Subject: [PATCH lora-next 05/11] net: lora: sx130x: Fix regmap field toggles

When toggling the value of a regmap field, such as for F_RADIO_RST or
F_EMERGENCY_FORCE_HOST_CTRL, we need to ensure it gets written out.

Sadly the timing of the writes got lost in the regmap field conversion.

Introduce an sx130x_field_force_write() helper for this.
While at it, make trivial sx130x_field_write() static inline, too.

Cc: Ben Whitten <ben.whitten@...il.com>
Signed-off-by: Andreas Färber <afaerber@...e.de>
---
 drivers/net/lora/sx130x.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/lora/sx130x.c b/drivers/net/lora/sx130x.c
index 4ba02836a35d..457f2396d9ee 100644
--- a/drivers/net/lora/sx130x.c
+++ b/drivers/net/lora/sx130x.c
@@ -174,12 +174,18 @@ const struct regmap_config sx130x_regmap_config = {
 };
 EXPORT_SYMBOL_GPL(sx130x_regmap_config);
 
-static int sx130x_field_write(struct sx130x_priv *priv,
+static inline int sx130x_field_write(struct sx130x_priv *priv,
 		enum sx130x_fields field_id, u8 val)
 {
 	return regmap_field_write(priv->regmap_fields[field_id], val);
 }
 
+static inline int sx130x_field_force_write(struct sx130x_priv *priv,
+		enum sx130x_fields field_id, u8 val)
+{
+	return regmap_field_force_write(priv->regmap_fields[field_id], val);
+}
+
 static int sx130x_soft_reset(struct sx130x_priv *priv)
 {
 	int ret;
@@ -373,7 +379,7 @@ static int sx130x_agc_calibrate(struct sx130x_priv *priv)
 		return -EIO;
 	}
 
-	ret = sx130x_field_write(priv, F_EMERGENCY_FORCE_HOST_CTRL, 0);
+	ret = sx130x_field_force_write(priv, F_EMERGENCY_FORCE_HOST_CTRL, 0);
 	if (ret) {
 		dev_err(priv->dev, "emergency force failed\n");
 		return ret;
@@ -694,7 +700,7 @@ int sx130x_probe(struct device *dev)
 
 	msleep(500);
 
-	ret = sx130x_field_write(priv, F_RADIO_RST, 1);
+	ret = sx130x_field_force_write(priv, F_RADIO_RST, 1);
 	if (ret) {
 		dev_err(dev, "radio assert reset failed (%d)\n", ret);
 		return ret;
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ