All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 3/3] staging/rtl8192u: use for loop to assign bit shifted addr
@ 2012-06-19 19:08 Devendra Naga
  2012-06-19 19:19 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Devendra Naga @ 2012-06-19 19:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Justin P. Mattock, devel, linux-kernel; +Cc: Devendra Naga

this change is a rewrite of that bitshifted addr copying
logic with for loop, which can easily understandable.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
 drivers/staging/rtl8192u/r8180_93cx6.c |   27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c
index a72bbd4..815b0f3 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.c
+++ b/drivers/staging/rtl8192u/r8180_93cx6.c
@@ -102,25 +102,16 @@ u32 eprom_read(struct net_device *dev, u32 addr)
 	force_pci_posting(dev);
 	udelay(EPROM_DELAY);
 
-	if (priv->epromtype==EPROM_93c56){
-		addr_str[7]=addr & 1;
-		addr_str[6]=addr & (1<<1);
-		addr_str[5]=addr & (1<<2);
-		addr_str[4]=addr & (1<<3);
-		addr_str[3]=addr & (1<<4);
-		addr_str[2]=addr & (1<<5);
-		addr_str[1]=addr & (1<<6);
-		addr_str[0]=addr & (1<<7);
-		addr_len=8;
-	}else{
-		addr_str[5]=addr & 1;
-		addr_str[4]=addr & (1<<1);
-		addr_str[3]=addr & (1<<2);
-		addr_str[2]=addr & (1<<3);
-		addr_str[1]=addr & (1<<4);
-		addr_str[0]=addr & (1<<5);
-		addr_len=6;
+	if (priv->epromtype == EPROM_93c56) {
+		addr_len = 8;
+		for (i = 0; i < addr_len; i++)
+			addr_str[i] = addr & (1 << (addr_len - (i + 1)));
+	} else {
+		addr_len = 6;
+		for (i = 0; i < addr_len; i++)
+			addr_str[i] = addr & (1 << (addr_len - (i + 1)));
 	}
+
 	eprom_cs(dev, 1);
 	eprom_ck_cycle(dev);
 	eprom_send_bits_string(dev, read_cmd, 3);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-20  6:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-19 19:08 [PATCH V2 3/3] staging/rtl8192u: use for loop to assign bit shifted addr Devendra Naga
2012-06-19 19:19 ` Joe Perches
2012-06-20  6:31   ` devendra.aaru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.