linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] staging/media: Use dev_ printks in go7007/go7007-fw.c
@ 2012-11-05 11:38 YAMANE Toshiaki
  2012-11-05 11:39 ` [PATCH 2/2] staging/media: Fix trailing statements should be on next line " YAMANE Toshiaki
  0 siblings, 1 reply; 4+ messages in thread
From: YAMANE Toshiaki @ 2012-11-05 11:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-media; +Cc: linux-kernel, YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
---
 drivers/staging/media/go7007/go7007-fw.c |   42 ++++++++++++++----------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-fw.c b/drivers/staging/media/go7007/go7007-fw.c
index c9a6409..f99c05b 100644
--- a/drivers/staging/media/go7007/go7007-fw.c
+++ b/drivers/staging/media/go7007/go7007-fw.c
@@ -382,8 +382,8 @@ static int gen_mjpeghdr_to_package(struct go7007 *go, __le16 *code, int space)
 
 	buf = kzalloc(4096, GFP_KERNEL);
 	if (buf == NULL) {
-		printk(KERN_ERR "go7007: unable to allocate 4096 bytes for "
-				"firmware construction\n");
+		dev_err(go->dev,
+			"unable to allocate 4096 bytes for firmware construction\n");
 		return -1;
 	}
 
@@ -652,8 +652,8 @@ static int gen_mpeg1hdr_to_package(struct go7007 *go,
 
 	buf = kzalloc(5120, GFP_KERNEL);
 	if (buf == NULL) {
-		printk(KERN_ERR "go7007: unable to allocate 5120 bytes for "
-				"firmware construction\n");
+		dev_err(go->dev,
+			"unable to allocate 5120 bytes for firmware construction\n");
 		return -1;
 	}
 	framelen[0] = mpeg1_frame_header(go, buf, 0, 1, PFRAME);
@@ -839,8 +839,8 @@ static int gen_mpeg4hdr_to_package(struct go7007 *go,
 
 	buf = kzalloc(5120, GFP_KERNEL);
 	if (buf == NULL) {
-		printk(KERN_ERR "go7007: unable to allocate 5120 bytes for "
-				"firmware construction\n");
+		dev_err(go->dev,
+			"unable to allocate 5120 bytes for firmware construction\n");
 		return -1;
 	}
 	framelen[0] = mpeg4_frame_header(go, buf, 0, PFRAME);
@@ -1545,9 +1545,8 @@ static int do_special(struct go7007 *go, u16 type, __le16 *code, int space,
 	case SPECIAL_MODET:
 		return modet_to_package(go, code, space);
 	}
-	printk(KERN_ERR
-		"go7007: firmware file contains unsupported feature %04x\n",
-		type);
+	dev_err(go->dev,
+		"firmware file contains unsupported feature %04x\n", type);
 	return -1;
 }
 
@@ -1577,15 +1576,16 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen)
 		return -1;
 	}
 	if (request_firmware(&fw_entry, go->board_info->firmware, go->dev)) {
-		printk(KERN_ERR
-			"go7007: unable to load firmware from file \"%s\"\n",
+		dev_err(go->dev,
+			"unable to load firmware from file \"%s\"\n",
 			go->board_info->firmware);
 		return -1;
 	}
 	code = kzalloc(codespace * 2, GFP_KERNEL);
 	if (code == NULL) {
-		printk(KERN_ERR "go7007: unable to allocate %d bytes for "
-				"firmware construction\n", codespace * 2);
+		dev_err(go->dev,
+			"unable to allocate %d bytes for firmware construction\n",
+			codespace * 2);
 		goto fw_failed;
 	}
 	src = (__le16 *)fw_entry->data;
@@ -1594,9 +1594,9 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen)
 		chunk_flags = __le16_to_cpu(src[0]);
 		chunk_len = __le16_to_cpu(src[1]);
 		if (chunk_len + 2 > srclen) {
-			printk(KERN_ERR "go7007: firmware file \"%s\" "
-					"appears to be corrupted\n",
-					go->board_info->firmware);
+			dev_err(go->dev,
+				"firmware file \"%s\" appears to be corrupted\n",
+				go->board_info->firmware);
 			goto fw_failed;
 		}
 		if (chunk_flags & mode_flag) {
@@ -1604,17 +1604,15 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen)
 				ret = do_special(go, __le16_to_cpu(src[2]),
 					&code[i], codespace - i, framelen);
 				if (ret < 0) {
-					printk(KERN_ERR "go7007: insufficient "
-							"memory for firmware "
-							"construction\n");
+					dev_err(go->dev,
+						"insufficient memory for firmware construction\n");
 					goto fw_failed;
 				}
 				i += ret;
 			} else {
 				if (codespace - i < chunk_len) {
-					printk(KERN_ERR "go7007: insufficient "
-							"memory for firmware "
-							"construction\n");
+					dev_err(go->dev,
+						"insufficient memory for firmware construction\n");
 					goto fw_failed;
 				}
 				memcpy(&code[i], &src[2], chunk_len * 2);
-- 
1.7.9.5


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

* [PATCH 2/2] staging/media: Fix trailing statements should be on next line in go7007/go7007-fw.c
  2012-11-05 11:38 [PATCH 1/2] staging/media: Use dev_ printks in go7007/go7007-fw.c YAMANE Toshiaki
@ 2012-11-05 11:39 ` YAMANE Toshiaki
  2012-12-21 20:43   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: YAMANE Toshiaki @ 2012-11-05 11:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-media; +Cc: linux-kernel, YAMANE Toshiaki

fixed below checkpatch error.
- ERROR: trailing statements should be on next line

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
---
 drivers/staging/media/go7007/go7007-fw.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/go7007/go7007-fw.c b/drivers/staging/media/go7007/go7007-fw.c
index f99c05b..cfce760 100644
--- a/drivers/staging/media/go7007/go7007-fw.c
+++ b/drivers/staging/media/go7007/go7007-fw.c
@@ -725,7 +725,8 @@ static int vti_bitlen(struct go7007 *go)
 {
 	unsigned int i, max_time_incr = go->sensor_framerate / go->fps_scale;
 
-	for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i);
+	for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i)
+		;
 	return i + 1;
 }
 
-- 
1.7.9.5


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

* Re: [PATCH 2/2] staging/media: Fix trailing statements should be on next line in go7007/go7007-fw.c
  2012-11-05 11:39 ` [PATCH 2/2] staging/media: Fix trailing statements should be on next line " YAMANE Toshiaki
@ 2012-12-21 20:43   ` Mauro Carvalho Chehab
  2012-12-22  7:20     ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2012-12-21 20:43 UTC (permalink / raw)
  To: YAMANE Toshiaki; +Cc: Greg Kroah-Hartman, linux-media, linux-kernel

Em Mon,  5 Nov 2012 20:39:33 +0900
YAMANE Toshiaki <yamanetoshi@gmail.com> escreveu:

> fixed below checkpatch error.
> - ERROR: trailing statements should be on next line
> 
> Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
> ---
>  drivers/staging/media/go7007/go7007-fw.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/go7007/go7007-fw.c b/drivers/staging/media/go7007/go7007-fw.c
> index f99c05b..cfce760 100644
> --- a/drivers/staging/media/go7007/go7007-fw.c
> +++ b/drivers/staging/media/go7007/go7007-fw.c
> @@ -725,7 +725,8 @@ static int vti_bitlen(struct go7007 *go)
>  {
>  	unsigned int i, max_time_incr = go->sensor_framerate / go->fps_scale;
>  
> -	for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i);
> +	for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i)
> +		;

Nah, this doesn't sound right to me. IMO, in this specific case,
checkpatch.pl did a bad job.

At least on my eyes, the first line is easier to read than the other
two ones.

>  	return i + 1;
>  }
>  


Regards,
Mauro

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

* Re: [PATCH 2/2] staging/media: Fix trailing statements should be on next line in go7007/go7007-fw.c
  2012-12-21 20:43   ` Mauro Carvalho Chehab
@ 2012-12-22  7:20     ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2012-12-22  7:20 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: YAMANE Toshiaki, Greg Kroah-Hartman, linux-media, linux-kernel

On Fri, 2012-12-21 at 18:43 -0200, Mauro Carvalho Chehab wrote:
> Em Mon,  5 Nov 2012 20:39:33 +0900
> YAMANE Toshiaki <yamanetoshi@gmail.com> escreveu:
> 
> > fixed below checkpatch error.
> > - ERROR: trailing statements should be on next line
> > 
> > Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
> > ---
> >  drivers/staging/media/go7007/go7007-fw.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/media/go7007/go7007-fw.c b/drivers/staging/media/go7007/go7007-fw.c
> > index f99c05b..cfce760 100644
> > --- a/drivers/staging/media/go7007/go7007-fw.c
> > +++ b/drivers/staging/media/go7007/go7007-fw.c
> > @@ -725,7 +725,8 @@ static int vti_bitlen(struct go7007 *go)
> >  {
> >  	unsigned int i, max_time_incr = go->sensor_framerate / go->fps_scale;
> >  
> > -	for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i);
> > +	for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i)
> > +		;
> 
> Nah, this doesn't sound right to me. IMO, in this specific case,
> checkpatch.pl did a bad job.

Is this even guaranteed to exit the loop?
Maybe using ffs would be more sensible.



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

end of thread, other threads:[~2012-12-22  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 11:38 [PATCH 1/2] staging/media: Use dev_ printks in go7007/go7007-fw.c YAMANE Toshiaki
2012-11-05 11:39 ` [PATCH 2/2] staging/media: Fix trailing statements should be on next line " YAMANE Toshiaki
2012-12-21 20:43   ` Mauro Carvalho Chehab
2012-12-22  7:20     ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).