public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] i2c.c: Fixed coding style issue for if statement
@ 2013-07-27 17:48 santosh.anbu
  2013-07-27 17:53 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: santosh.anbu @ 2013-07-27 17:48 UTC (permalink / raw)
  To: airlied; +Cc: asantosh.king, dri-devel, linux-kernel

From: "santosh.anbu" <asantosh.king@gmail.com>

Fixed coding style issue

Signed-off-by: santosh.anbu <asantosh.king@gmail.com>
---
 drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c b/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
index cfb9288..e88529c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
@@ -114,15 +114,19 @@ dcb_i2c_parse(struct nouveau_bios *bios, u8 idx, struct dcb_i2c_entry *info)
 
 		if (idx == 0) {
 			info->drive = nv_ro08(bios, ent + 4);
-			if (!info->drive) info->drive = 0x3f;
+			if (!info->drive)
+				info->drive = 0x3f;
 			info->sense = nv_ro08(bios, ent + 5);
-			if (!info->sense) info->sense = 0x3e;
+			if (!info->sense)
+				info->sense = 0x3e;
 		} else
 		if (idx == 1) {
 			info->drive = nv_ro08(bios, ent + 6);
-			if (!info->drive) info->drive = 0x37;
+			if (!info->drive)
+				info->drive = 0x37;
 			info->sense = nv_ro08(bios, ent + 7);
-			if (!info->sense) info->sense = 0x36;
+			if (!info->sense)
+				info->sense = 0x36;
 		}
 
 		info->type  = DCB_I2C_NV04_BIT;
-- 
1.8.1.2


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

* Re: [PATCH 2/2] i2c.c: Fixed coding style issue for if statement
  2013-07-27 17:48 [PATCH 2/2] i2c.c: Fixed coding style issue for if statement santosh.anbu
@ 2013-07-27 17:53 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2013-07-27 17:53 UTC (permalink / raw)
  To: santosh.anbu; +Cc: airlied, asantosh.king, dri-devel, linux-kernel

On Sat, 2013-07-27 at 23:18 +0530, santosh.anbu wrote:
> From: "santosh.anbu" <asantosh.king@gmail.com>
[]
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c b/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
> index cfb9288..e88529c 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
> @@ -114,15 +114,19 @@ dcb_i2c_parse(struct nouveau_bios *bios, u8 idx, struct dcb_i2c_entry *info)
>  
>  		if (idx == 0) {
>  			info->drive = nv_ro08(bios, ent + 4);
> -			if (!info->drive) info->drive = 0x3f;
> +			if (!info->drive)
> +				info->drive = 0x3f;
>  			info->sense = nv_ro08(bios, ent + 5);
> -			if (!info->sense) info->sense = 0x3e;
> +			if (!info->sense)
> +				info->sense = 0x3e;
>  		} else
>  		if (idx == 1) {
>  			info->drive = nv_ro08(bios, ent + 6);
> -			if (!info->drive) info->drive = 0x37;
> +			if (!info->drive)
> +				info->drive = 0x37;
>  			info->sense = nv_ro08(bios, ent + 7);
> -			if (!info->sense) info->sense = 0x36;
> +			if (!info->sense)
> +				info->sense = 0x36;
>  		}
>  
>  		info->type  = DCB_I2C_NV04_BIT;

Perhaps this is better handled with a new function like

int nv_ro08_default(bios, address, default)
{
	int val = nv_ro08(bios, address);
	if (val == 0)
		val = default;
	return val;
}


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

end of thread, other threads:[~2013-07-27 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-27 17:48 [PATCH 2/2] i2c.c: Fixed coding style issue for if statement santosh.anbu
2013-07-27 17:53 ` Joe Perches

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