Skip to contentSkip to conversation

Clarify expression which uses both multiplication and pointer dereference

PATCH In review Alex Dowad 5 participants 6 messages May 17, 2015 – May 18, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Alex Dowad

author
#0 lore raw

PATCH 1/1 Clarify expression which uses both multiplication and pointer dereference

This fixes a checkpatch style error in vpfe_buffer_queue_setup.

---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/vpfe_video.c +1 -1
index 06d48d5..04a687c 100644
@@ -1095,7 +1095,7 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
 	size = video->fmt.fmt.pix.sizeimage;
 
 	if (vpfe_dev->video_limit) {
-		while (size * *nbuffers > vpfe_dev->video_limit)
+		while (size * (*nbuffers) > vpfe_dev->video_limit)
 			(*nbuffers)--;
 	}
 	if (pipe->state == VPFE_PIPELINE_STREAM_CONTINUOUS) {
Signature · 1 line
2.0.0.GIT
Acked-by on v1 1/1
#1 lore raw

Hi Alex,

Thank you for the patch.

Quoted 3 lines · On Sunday 17 May 2015 19:18:42 Alex Dowad wrote:

This fixes a checkpatch style error in vpfe_buffer_queue_setup.

Quoted 18 lines
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 06d48d5..04a687c 100644

drivers/staging/media/davinci_vpfe/vpfe_video.c +1 -1
@@ -1095,7 +1095,7 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const
 struct v4l2_format *fmt, size = video->fmt.fmt.pix.sizeimage;
 
 	if (vpfe_dev->video_limit) {
-		while (size * *nbuffers > vpfe_dev->video_limit)
+		while (size * (*nbuffers) > vpfe_dev->video_limit)
 			(*nbuffers)--;
 	}
 	if (pipe->state == VPFE_PIPELINE_STREAM_CONTINUOUS) {
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
In reply to Alex Dowad
Quoted 1 line · Alex Dowad

This fixes a checkpatch style error in vpfe_buffer_queue_setup.

There is no checkpatch message for this style.

Nor should there be.

drivers/staging/media/davinci_vpfe/vpfe_video.c

Quoted 1 line
drivers/staging/media/davinci_vpfe/vpfe_video.c +0 -0

[]

Quoted 3 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +1 -1
@@ -1095,7 +1095,7 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
-		while (size * *nbuffers > vpfe_dev->video_limit)
+		while (size * (*nbuffers) > vpfe_dev->video_limit)
#3 lore raw
In reply to Alex Dowad
Quoted 12 lines · Alex Dowad

This fixes a checkpatch style error in vpfe_buffer_queue_setup.

---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/vpfe_video.c +0 -0
index 06d48d5..04a687c 100644

drivers/staging/media/davinci_vpfe/vpfe_video.c vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, · line 1101

Quoted 8 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +1 -1
@@ -1095,7 +1095,7 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
 	size = video->fmt.fmt.pix.sizeimage;
 
 	if (vpfe_dev->video_limit) {
-		while (size * *nbuffers > vpfe_dev->video_limit)
+		while (size * (*nbuffers) > vpfe_dev->video_limit)
 			(*nbuffers)--;
 	}
 	if (pipe->state == VPFE_PIPELINE_STREAM_CONTINUOUS) {

Style issue aside, is there a reason not to use

		if (size * *nbuffers > vpfe_dev->video_limit)
			*nbuffers = vpfe_dev->video_limit / size;

instead?

Michal Kubecek

#4 lore raw
Quoted 24 lines · Michal Kubecek
Quoted 12 lines · Alex Dowad

This fixes a checkpatch style error in vpfe_buffer_queue_setup.

---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/vpfe_video.c +0 -0
index 06d48d5..04a687c 100644

drivers/staging/media/davinci_vpfe/vpfe_video.c vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, · line 1101

Quoted 8 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +1 -1
@@ -1095,7 +1095,7 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
      size = video->fmt.fmt.pix.sizeimage;
 
      if (vpfe_dev->video_limit) {
-             while (size * *nbuffers > vpfe_dev->video_limit)
+             while (size * (*nbuffers) > vpfe_dev->video_limit)
                      (*nbuffers)--;
      }
      if (pipe->state == VPFE_PIPELINE_STREAM_CONTINUOUS) {

Style issue aside, is there a reason not to use

Quoted 5 lines
                if (size * *nbuffers > vpfe_dev->video_limit)
                        *nbuffers = vpfe_dev->video_limit / size;

instead?

I would prefer this.

Cheers,
--Prabhakar Lad

#6 lore raw
In reply to a message not in the archive

Hi Hans,

Quoted 31 lines · Hans Verkuil
Quoted 28 lines · Prabhakar
Quoted 27 lines · Michal Kubecek
Quoted 12 lines · Alex Dowad

This fixes a checkpatch style error in vpfe_buffer_queue_setup.

---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/vpfe_video.c +0 -0
index 06d48d5..04a687c 100644

drivers/staging/media/davinci_vpfe/vpfe_video.c vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, · line 1101

Quoted 8 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +1 -1
@@ -1095,7 +1095,7 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
      size = video->fmt.fmt.pix.sizeimage;
 
      if (vpfe_dev->video_limit) {
-             while (size * *nbuffers > vpfe_dev->video_limit)
+             while (size * (*nbuffers) > vpfe_dev->video_limit)
                      (*nbuffers)--;
      }
      if (pipe->state == VPFE_PIPELINE_STREAM_CONTINUOUS) {

Style issue aside, is there a reason not to use

                if (size * *nbuffers > vpfe_dev->video_limit)
                        *nbuffers = vpfe_dev->video_limit / size;
Quoted 9 lines
Quoted 3 lines
Quoted 2 lines

instead?

I would prefer this.

As far as I can see video_limit is never set at all, so this code (and the video_limit field) can just be removed.

I think this is a left-over from old code, long since removed.

Yes makes sense, I'll fix it up and post a patch for it.

Cheers,
--Prabhakar Lad