[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b3b93ae7ce41562565e9007eb4580b9c47a2881f.1657134099.git.philipp.g.hortmann@gmail.com>
Date: Wed, 6 Jul 2022 21:19:01 +0200
From: Philipp Hortmann <philipp.g.hortmann@...il.com>
To: Forest Bond <forest@...ttletooquiet.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Joe Perches <joe@...ches.com>, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr
Use loop in vt6655_mac_write_bssid_addr to avoid multiple
similar statements.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@...il.com>
---
Code for testing:
for (int i = 0; i < 6; i++){
iowrite8(mac_addr[i], iobase + MAC_REG_BSSID0 + i);
printk("i = %i\n", i);
}
Log:
[ 2592.189081] i = 0
[ 2592.189083] i = 1
[ 2592.189083] i = 2
[ 2592.189084] i = 3
[ 2592.189084] i = 4
[ 2592.189085] i = 5
---
drivers/staging/vt6655/device_main.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 298963cbca1d..099f0b95417a 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -192,12 +192,8 @@ device_set_options(struct vnt_private *priv)
static void vt6655_mac_write_bssid_addr(void __iomem *iobase, const u8 *mac_addr)
{
iowrite8(1, iobase + MAC_REG_PAGE1SEL);
- iowrite8(mac_addr[0], iobase + MAC_REG_BSSID0);
- iowrite8(mac_addr[1], iobase + MAC_REG_BSSID0 + 1);
- iowrite8(mac_addr[2], iobase + MAC_REG_BSSID0 + 2);
- iowrite8(mac_addr[3], iobase + MAC_REG_BSSID0 + 3);
- iowrite8(mac_addr[4], iobase + MAC_REG_BSSID0 + 4);
- iowrite8(mac_addr[5], iobase + MAC_REG_BSSID0 + 5);
+ for (int i = 0; i < 6; i++)
+ iowrite8(mac_addr[i], iobase + MAC_REG_BSSID0 + i);
iowrite8(0, iobase + MAC_REG_PAGE1SEL);
}
--
2.37.0
Powered by blists - more mailing lists