public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.28-rc6-omap-git 1/2] twl4030-usb: cleanup debug code
@ 2008-11-27  0:44 David Brownell
  2008-12-15 18:57 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: David Brownell @ 2008-11-27  0:44 UTC (permalink / raw)
  To: linux-omap

From: David Brownell <dbrownell@users.sourceforge.net>

Remove some debug code from twl4030-usb which 'checkpatch.pl' warned
about.  Turn some other messages into debug code; and add some debug
messages in the "write verify" paths (so we can see if they matter).
This gives about 25% codespace shrinkage.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/i2c/chips/twl4030-usb.c |   29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

--- a/drivers/i2c/chips/twl4030-usb.c
+++ b/drivers/i2c/chips/twl4030-usb.c
@@ -285,13 +285,18 @@ static int twl4030_i2c_write_u8_verify(s
 	    (twl4030_i2c_read_u8(module, &check, address) >= 0) &&
 						(check == data))
 		return 0;
+	dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
+			1, module, address, check, data);
+
 	/* Failed once: Try again */
 	if ((twl4030_i2c_write_u8(module, data, address) >= 0) &&
 	    (twl4030_i2c_read_u8(module, &check, address) >= 0) &&
 						(check == data))
 		return 0;
-	/* Failed again: Return error */
+	dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
+			2, module, address, check, data);
 
+	/* Failed again: Return error */
 	return -EBUSY;
 }
 
@@ -304,23 +309,9 @@ static inline int twl4030_usb_write(stru
 	int ret = 0;
 
 	ret = twl4030_i2c_write_u8(TWL4030_MODULE_USB, data, address);
-	if (ret >= 0) {
-#if 0	/* debug */
-		u8 data1;
-		if (twl4030_i2c_read_u8(TWL4030_MODULE_USB, &data1,
-					address) < 0)
-			dev_err(twl->dev, "re-read failed\n");
-		else
-			dev_dbg(twl->dev,
-			       "Write %s wrote %x read %x from reg %x\n",
-			       (data1 == data) ? "succeed" : "mismatch",
-			       data, data1, address);
-#endif
-	} else {
-		dev_warn(twl->dev,
+	if (ret < 0)
+		dev_dbg(twl->dev,
 			"TWL4030:USB:Write[0x%x] Error %d\n", address, ret);
-	}
-
 	return ret;
 }
 
@@ -333,7 +324,7 @@ static inline int twl4030_readb(struct t
 	if (ret >= 0)
 		ret = data;
 	else
-		dev_warn(twl->dev,
+		dev_dbg(twl->dev,
 			"TWL4030:readb[0x%x,0x%x] Error %d\n",
 					module, address, ret);
 
@@ -655,7 +646,7 @@ static int __init twl4030_usb_probe(stru
 		return -ENOMEM;
 
 	if (!pdata) {
-		dev_info(&pdev->dev, "platform_data not available\n");
+		dev_dbg(&pdev->dev, "platform_data not available\n");
 		return -EINVAL;
 	}
 

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

* Re: [patch 2.6.28-rc6-omap-git 1/2] twl4030-usb: cleanup debug code
  2008-11-27  0:44 [patch 2.6.28-rc6-omap-git 1/2] twl4030-usb: cleanup debug code David Brownell
@ 2008-12-15 18:57 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2008-12-15 18:57 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap

* David Brownell <david-b@pacbell.net> [081126 16:45]:
> From: David Brownell <dbrownell@users.sourceforge.net>
> 
> Remove some debug code from twl4030-usb which 'checkpatch.pl' warned
> about.  Turn some other messages into debug code; and add some debug
> messages in the "write verify" paths (so we can see if they matter).
> This gives about 25% codespace shrinkage.

Pushing both to l-o tree today.

Tony

> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
>  drivers/i2c/chips/twl4030-usb.c |   29 ++++++++++-------------------
>  1 file changed, 10 insertions(+), 19 deletions(-)
> 
> --- a/drivers/i2c/chips/twl4030-usb.c
> +++ b/drivers/i2c/chips/twl4030-usb.c
> @@ -285,13 +285,18 @@ static int twl4030_i2c_write_u8_verify(s
>  	    (twl4030_i2c_read_u8(module, &check, address) >= 0) &&
>  						(check == data))
>  		return 0;
> +	dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
> +			1, module, address, check, data);
> +
>  	/* Failed once: Try again */
>  	if ((twl4030_i2c_write_u8(module, data, address) >= 0) &&
>  	    (twl4030_i2c_read_u8(module, &check, address) >= 0) &&
>  						(check == data))
>  		return 0;
> -	/* Failed again: Return error */
> +	dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
> +			2, module, address, check, data);
>  
> +	/* Failed again: Return error */
>  	return -EBUSY;
>  }
>  
> @@ -304,23 +309,9 @@ static inline int twl4030_usb_write(stru
>  	int ret = 0;
>  
>  	ret = twl4030_i2c_write_u8(TWL4030_MODULE_USB, data, address);
> -	if (ret >= 0) {
> -#if 0	/* debug */
> -		u8 data1;
> -		if (twl4030_i2c_read_u8(TWL4030_MODULE_USB, &data1,
> -					address) < 0)
> -			dev_err(twl->dev, "re-read failed\n");
> -		else
> -			dev_dbg(twl->dev,
> -			       "Write %s wrote %x read %x from reg %x\n",
> -			       (data1 == data) ? "succeed" : "mismatch",
> -			       data, data1, address);
> -#endif
> -	} else {
> -		dev_warn(twl->dev,
> +	if (ret < 0)
> +		dev_dbg(twl->dev,
>  			"TWL4030:USB:Write[0x%x] Error %d\n", address, ret);
> -	}
> -
>  	return ret;
>  }
>  
> @@ -333,7 +324,7 @@ static inline int twl4030_readb(struct t
>  	if (ret >= 0)
>  		ret = data;
>  	else
> -		dev_warn(twl->dev,
> +		dev_dbg(twl->dev,
>  			"TWL4030:readb[0x%x,0x%x] Error %d\n",
>  					module, address, ret);
>  
> @@ -655,7 +646,7 @@ static int __init twl4030_usb_probe(stru
>  		return -ENOMEM;
>  
>  	if (!pdata) {
> -		dev_info(&pdev->dev, "platform_data not available\n");
> +		dev_dbg(&pdev->dev, "platform_data not available\n");
>  		return -EINVAL;
>  	}
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2008-12-15 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-27  0:44 [patch 2.6.28-rc6-omap-git 1/2] twl4030-usb: cleanup debug code David Brownell
2008-12-15 18:57 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox