LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH RFC] staging: media: davinci_vpfe: drop condition with no effect
@ 2015-01-26  7:27 Nicholas Mc Guire
  2015-01-29 10:27 ` Lad, Prabhakar
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2015-01-26  7:27 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Greg Kroah-Hartman, Hans Verkuil, Lad Prabhakar, Jiayi Ye,
	Tapasweni Pathak, Boris BREZILLON, linux-media, devel,
	linux-kernel, Nicholas Mc Guire

As the if and else branch body are identical the condition has no effect and 
can be dropped.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---

As the if and the else branch of the inner conditional paths are the same
the condition is without effect. Given the comments indicate that
the else branch *should* be handling a specific case this may indicate
a bug, in which case the below patch is *wrong*. This needs a review by
someone that knows the specifics of this driver.

If the inner if/else is a placeholder for planed updates then it should
be commented so this is clear.

Patch was only compile tested with davinci_all_defconfig + CONFIG_STAGING=y
CONFIG_STAGING_MEDIA=y, CONFIG_MEDIA_SUPPORT=m,
CONFIG_MEDIA_ANALOG_TV_SUPPORT=y, CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_CONTROLLER=y, CONFIG_VIDEO_V4L2_SUBDEV_API=y
CONFIG_VIDEO_DM365_VPFE=m

Patch is against 3.0.19-rc5 -next-20150123

 drivers/staging/media/davinci_vpfe/dm365_resizer.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index 75e70e1..bf2cb7a 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -63,16 +63,11 @@ resizer_calculate_line_length(u32 pix, int width, int height,
 	if (pix == MEDIA_BUS_FMT_UYVY8_2X8 ||
 	    pix == MEDIA_BUS_FMT_SGRBG12_1X12) {
 		*line_len = width << 1;
-	} else if (pix == MEDIA_BUS_FMT_Y8_1X8 ||
-		   pix == MEDIA_BUS_FMT_UV8_1X8) {
-		*line_len = width;
-		*line_len_c = width;
-	} else {
-		/* YUV 420 */
-		/* round width to upper 32 byte boundary */
+	} else { 
 		*line_len = width;
 		*line_len_c = width;
 	}
+
 	/* adjust the line len to be a multiple of 32 */
 	*line_len += 31;
 	*line_len &= ~0x1f;
-- 
1.7.10.4


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

* Re: [PATCH RFC] staging: media: davinci_vpfe: drop condition with no effect
  2015-01-26  7:27 [PATCH RFC] staging: media: davinci_vpfe: drop condition with no effect Nicholas Mc Guire
@ 2015-01-29 10:27 ` Lad, Prabhakar
  0 siblings, 0 replies; 2+ messages in thread
From: Lad, Prabhakar @ 2015-01-29 10:27 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Hans Verkuil,
	Jiayi Ye, Tapasweni Pathak, Boris BREZILLON, linux-media,
	OSUOSL Drivers, LKML

On Mon, Jan 26, 2015 at 7:27 AM, Nicholas Mc Guire <der.herr@hofr.at> wrote:
> As the if and else branch body are identical the condition has no effect and
> can be dropped.
>
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

> ---
>
> As the if and the else branch of the inner conditional paths are the same
> the condition is without effect. Given the comments indicate that
> the else branch *should* be handling a specific case this may indicate
> a bug, in which case the below patch is *wrong*. This needs a review by
> someone that knows the specifics of this driver.
>
> If the inner if/else is a placeholder for planed updates then it should
> be commented so this is clear.
>
> Patch was only compile tested with davinci_all_defconfig + CONFIG_STAGING=y
> CONFIG_STAGING_MEDIA=y, CONFIG_MEDIA_SUPPORT=m,
> CONFIG_MEDIA_ANALOG_TV_SUPPORT=y, CONFIG_MEDIA_CAMERA_SUPPORT=y
> CONFIG_MEDIA_CONTROLLER=y, CONFIG_VIDEO_V4L2_SUBDEV_API=y
> CONFIG_VIDEO_DM365_VPFE=m
>
> Patch is against 3.0.19-rc5 -next-20150123
>
>  drivers/staging/media/davinci_vpfe/dm365_resizer.c |    9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
> index 75e70e1..bf2cb7a 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
> @@ -63,16 +63,11 @@ resizer_calculate_line_length(u32 pix, int width, int height,
>         if (pix == MEDIA_BUS_FMT_UYVY8_2X8 ||
>             pix == MEDIA_BUS_FMT_SGRBG12_1X12) {
>                 *line_len = width << 1;
> -       } else if (pix == MEDIA_BUS_FMT_Y8_1X8 ||
> -                  pix == MEDIA_BUS_FMT_UV8_1X8) {
> -               *line_len = width;
> -               *line_len_c = width;
> -       } else {
> -               /* YUV 420 */
> -               /* round width to upper 32 byte boundary */
> +       } else {
>                 *line_len = width;
>                 *line_len_c = width;
>         }
> +
>         /* adjust the line len to be a multiple of 32 */
>         *line_len += 31;
>         *line_len &= ~0x1f;
> --
> 1.7.10.4
>

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

end of thread, other threads:[~2015-01-29 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26  7:27 [PATCH RFC] staging: media: davinci_vpfe: drop condition with no effect Nicholas Mc Guire
2015-01-29 10:27 ` Lad, Prabhakar

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).