All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] staging/rtl8182u: cleanup eprom_read function and clean all checkpatch warnings / errors
@ 2012-06-17 13:48 Devendra Naga
  2012-06-19  0:02 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Devendra Naga @ 2012-06-17 13:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Justin P. Mattock, devel, linux-kernel; +Cc: Devendra Naga

this patch cleans up the copying of the addr data into addr_str fields
by using for loops.

and also with the previous patch all the checkpatch warnings / errors are
eliminated

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

diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c
index e48a5aa..50b88fc 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.c
+++ b/drivers/staging/rtl8192u/r8180_93cx6.c
@@ -73,7 +73,7 @@ short eprom_r(struct net_device *dev)
 	bit = (read_nic_byte_E(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT));
 	udelay(EPROM_DELAY);
 
-	return bit ? 1: 0;
+	return bit ? 1 : 0;
 }
 
 
@@ -81,7 +81,7 @@ void eprom_send_bits_string(struct net_device *dev, short b[], int len)
 {
 	int i;
 
-	for(i=0; i<len; i++){
+	for (i = 0; i < len; i++) {
 		eprom_w(dev, b[i]);
 		eprom_ck_cycle(dev);
 	}
@@ -91,50 +91,43 @@ void eprom_send_bits_string(struct net_device *dev, short b[], int len)
 u32 eprom_read(struct net_device *dev, u32 addr)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	short read_cmd[]={1,1,0};
+	short read_cmd[] = {1, 1, 0};
 	short addr_str[8];
 	int i;
 	int addr_len;
-	u32 ret;
+	u32 ret = 0;
 
-	ret=0;
-        //enable EPROM programming
+	/* enable EPROM programming */
 	write_nic_byte_E(dev, EPROM_CMD,
 		       (EPROM_CMD_PROGRAM<<EPROM_CMD_OPERATING_MODE_SHIFT));
 	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);
 	eprom_send_bits_string(dev, addr_str, addr_len);
 
-	//keep chip pin D to low state while reading.
-	//I'm unsure if it is necessary, but anyway shouldn't hurt
+	/**
+	  * keep chip pin D to low state while reading.
+	  * I'm unsure if it is necessary, but anyway shouldn't hurt
+	  */
 	eprom_w(dev, 0);
 
-	for(i=0;i<16;i++){
-		//eeprom needs a clk cycle between writing opcode&adr
-		//and reading data. (eeprom outs a dummy 0)
+	for (i = 0; i < 16; i++) {
+		/**
+		  * eeprom needs a clk cycle between writing opcode&adr
+		  * and reading data. (eeprom outs a dummy 0)
+		  */
 		eprom_ck_cycle(dev);
 		ret |= (eprom_r(dev)<<(15-i));
 	}
@@ -142,7 +135,7 @@ u32 eprom_read(struct net_device *dev, u32 addr)
 	eprom_cs(dev, 0);
 	eprom_ck_cycle(dev);
 
-	//disable EPROM programming
+	/* disable EPROM programming */
 	write_nic_byte_E(dev, EPROM_CMD,
 		       (EPROM_CMD_NORMAL<<EPROM_CMD_OPERATING_MODE_SHIFT));
 	return ret;
-- 
1.7.9.5


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

* Re: [PATCH 2/2] staging/rtl8182u: cleanup eprom_read function and clean all checkpatch warnings / errors
  2012-06-17 13:48 [PATCH 2/2] staging/rtl8182u: cleanup eprom_read function and clean all checkpatch warnings / errors Devendra Naga
@ 2012-06-19  0:02 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2012-06-19  0:02 UTC (permalink / raw)
  To: Devendra Naga; +Cc: Justin P. Mattock, devel, linux-kernel

On Sun, Jun 17, 2012 at 07:18:31PM +0530, Devendra Naga wrote:
> this patch cleans up the copying of the addr data into addr_str fields
> by using for loops.
> 
> and also with the previous patch all the checkpatch warnings / errors are
> eliminated

Please only do one thing per patch, so break this up into a few
different ones.

thanks,

greg k-h

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

end of thread, other threads:[~2012-06-19  0:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-17 13:48 [PATCH 2/2] staging/rtl8182u: cleanup eprom_read function and clean all checkpatch warnings / errors Devendra Naga
2012-06-19  0:02 ` Greg Kroah-Hartman

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.