[PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use loop in vt6655_mac_write_bssid_addr to avoid multiple
similar statements.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@xxxxxxxxx>
---
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





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux