Skip to contentSkip to conversation

staging: media: davinci_vpfe: Compress return logic and remove unnecessary lines of function

PATCH In review Thaissa Falbo 3 participants 8 messages Feb 18, 2016 – Feb 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover staging: media: davinci_vpfe: Compress return logic and remove unnecessary lines of function

Simplify function by:
- compressing return logic
- removing unnecessary case in switch
- removing ununsed variable

Thaissa Falbo (2):
staging: media: davinci_vpfe: remove ret variable of function
staging: media: davinci_vpfe: remove unnecessary case and enum

 drivers/staging/media/davinci_vpfe/dm365_isif.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 staging: media: davinci_vpfe: remove ret variable of function

---
 drivers/staging/media/davinci_vpfe/dm365_isif.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_isif.c +4 -8
index 9b28513..747d29f 100644
@@ -229,7 +229,6 @@ isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 	struct vpfe_isif_device *vpfe_isif = &vpfe_dev->vpfe_isif;
 	enum isif_frmfmt frm_fmt = ISIF_FRMFMT_INTERLACED;
 	struct v4l2_pix_format format;
-	int ret = 0;
 
 	v4l2_fill_pix_format(&format, &vpfe_dev->vpfe_isif.formats[pad]);
 	mbus_to_pix(&vpfe_dev->vpfe_isif.formats[pad], &format);
@@ -252,8 +251,8 @@ isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 	switch (vpfe_dev->vpfe_isif.formats[pad].field) {
 	case V4L2_FIELD_INTERLACED:
 		/* do nothing, since it is default */
-		ret = isif_set_buftype(vpfe_isif, ISIF_BUFTYPE_FLD_INTERLEAVED);
-		break;
+		return isif_set_buftype(vpfe_isif,
+				ISIF_BUFTYPE_FLD_INTERLEAVED);
 
 	case V4L2_FIELD_NONE:
 		frm_fmt = ISIF_FRMFMT_PROGRESSIVE;
@@ -261,18 +260,15 @@ isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 		break;
 
 	case V4L2_FIELD_SEQ_TB:
-		ret = isif_set_buftype(vpfe_isif, ISIF_BUFTYPE_FLD_SEPARATED);
-		break;
+		return isif_set_buftype(vpfe_isif, ISIF_BUFTYPE_FLD_SEPARATED);
 
 	default:
 		return -EINVAL;
 	}
 
 	/* set the frame format */
-	if (!ret)
-		ret = isif_set_frame_format(vpfe_isif, frm_fmt);
+	return isif_set_frame_format(vpfe_isif, frm_fmt);
 
-	return ret;
 }
 
 /*
Signature · 1 line
2.1.4
#4 lore raw

PATCH 2/2 staging: media: davinci_vpfe: remove unnecessary case and enum

In reply to Thaissa Falbo
---
 drivers/staging/media/davinci_vpfe/dm365_isif.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -6
index 747d29f..b1e6fd0 100644
@@ -227,7 +227,6 @@ static int
 isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 {
 	struct vpfe_isif_device *vpfe_isif = &vpfe_dev->vpfe_isif;
-	enum isif_frmfmt frm_fmt = ISIF_FRMFMT_INTERLACED;
 	struct v4l2_pix_format format;
 
 	v4l2_fill_pix_format(&format, &vpfe_dev->vpfe_isif.formats[pad]);
@@ -254,11 +253,6 @@ isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 		return isif_set_buftype(vpfe_isif,
 				ISIF_BUFTYPE_FLD_INTERLEAVED);
 
-	case V4L2_FIELD_NONE:
-		frm_fmt = ISIF_FRMFMT_PROGRESSIVE;
-		/* buffer type only applicable for interlaced scan */
-		break;
-
 	case V4L2_FIELD_SEQ_TB:
 		return isif_set_buftype(vpfe_isif, ISIF_BUFTYPE_FLD_SEPARATED);
 
Signature · 1 line
2.1.4
#5 lore raw

Re: [Outreachy kernel] [PATCH 2/2] staging: media: davinci_vpfe: remove unnecessary case and enum

Why is it unnecessary? There should probably be more information in the commit message.

julia

Quoted 39 lines · Thaissa Falbo
---
 drivers/staging/media/davinci_vpfe/dm365_isif.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -7
index 747d29f..b1e6fd0 100644
@@ -227,7 +227,6 @@ static int
 isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 {
 	struct vpfe_isif_device *vpfe_isif = &vpfe_dev->vpfe_isif;
-	enum isif_frmfmt frm_fmt = ISIF_FRMFMT_INTERLACED;
 	struct v4l2_pix_format format;
 
 	v4l2_fill_pix_format(&format, &vpfe_dev->vpfe_isif.formats[pad]);
@@ -254,11 +253,6 @@ isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 		return isif_set_buftype(vpfe_isif,
 				ISIF_BUFTYPE_FLD_INTERLEAVED);
 
-	case V4L2_FIELD_NONE:
-		frm_fmt = ISIF_FRMFMT_PROGRESSIVE;
-		/* buffer type only applicable for interlaced scan */
-		break;
-
 	case V4L2_FIELD_SEQ_TB:
 		return isif_set_buftype(vpfe_isif, ISIF_BUFTYPE_FLD_SEPARATED);
 
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a97c778a2c814868c68a81dc18bfe25466422853.1455834014.git.thaissa.falbo%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw

Re: [Outreachy kernel] [PATCH 2/2] staging: media: davinci_vpfe: remove unnecessary case and enum

Thaíssa Falbo

2016-02-19 1:13 GMT-02:00 Julia Lawall <[email protected]>:

Quoted 12 lines

Why is it unnecessary? There should probably be more information in the commit message.

julia

Quoted 5 lines · Thaissa Falbo
---
 drivers/staging/media/davinci_vpfe/dm365_isif.c | 6 ------
 1 file changed, 6 deletions(-)
Quoted 8 lines

drivers/staging/media/davinci_vpfe/dm365_isif.c static int · line 229

Quoted 8 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -0
index 747d29f..b1e6fd0 100644
@@ -227,7 +227,6 @@ static int
 isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 {
      struct vpfe_isif_device *vpfe_isif = &vpfe_dev->vpfe_isif;

Here, the variable was set to a constant

Quoted 8 lines

drivers/staging/media/davinci_vpfe/dm365_isif.c isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad) · line 255

Quoted 8 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -1
-     enum isif_frmfmt frm_fmt = ISIF_FRMFMT_INTERLACED;
      struct v4l2_pix_format format;
 
      v4l2_fill_pix_format(&format, &vpfe_dev->vpfe_isif.formats[pad]);
@@ -254,11 +253,6 @@ isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
              return isif_set_buftype(vpfe_isif,
                              ISIF_BUFTYPE_FLD_INTERLEAVED);
 

And then used into one of the cases.

Quoted 8 lines

drivers/staging/media/davinci_vpfe/dm365_isif.c isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad) · line 258

Quoted 8 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -5
-     case V4L2_FIELD_NONE:
-             frm_fmt = ISIF_FRMFMT_PROGRESSIVE;
-             /* buffer type only applicable for interlaced scan */
-             break;
-
      case V4L2_FIELD_SEQ_TB:
              return isif_set_buftype(vpfe_isif, ISIF_BUFTYPE_FLD_SEPARATED);
 

After the switch, if was never used. There is only the return of the function.

Quoted 10 lines
Quoted 10 lines

--
2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a97c778a2c814868c68a81dc18bfe25466422853.1455834014.git.thaissa.falbo%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#7 lore raw

Re: [Outreachy kernel] [PATCH 2/2] staging: media: davinci_vpfe: remove unnecessary case and enum

Quoted 7 lines · Thaíssa Falbo

Thaíssa Falbo

2016-02-19 1:13 GMT-02:00 Julia Lawall <[email protected]>:

Quoted 2 lines

Why is it unnecessary? There should probably be more information in the commit message.

You should answer the question here, instead of at the end of the message. Also, it would be better to put your name after the answer, rather than at the top of the message.

Quoted 24 lines
Quoted 10 lines

julia

Quoted 5 lines · Thaissa Falbo
---
 drivers/staging/media/davinci_vpfe/dm365_isif.c | 6 ------
 1 file changed, 6 deletions(-)
Quoted 8 lines

drivers/staging/media/davinci_vpfe/dm365_isif.c static int · line 229

Quoted 8 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -0
index 747d29f..b1e6fd0 100644
@@ -227,7 +227,6 @@ static int
 isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
 {
      struct vpfe_isif_device *vpfe_isif = &vpfe_dev->vpfe_isif;

Here, the variable was set to a constant

Quoted 3 lines
Quoted 3 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -1
-     enum isif_frmfmt frm_fmt = ISIF_FRMFMT_INTERLACED;
      struct v4l2_pix_format format;
 
Quoted 13 lines
Quoted 5 lines

drivers/staging/media/davinci_vpfe/dm365_isif.c isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad) · line 255

Quoted 5 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -0
      v4l2_fill_pix_format(&format, &vpfe_dev->vpfe_isif.formats[pad]);
@@ -254,11 +253,6 @@ isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad)
              return isif_set_buftype(vpfe_isif,
                              ISIF_BUFTYPE_FLD_INTERLEAVED);
 

And then used into one of the cases.

Quoted 5 lines
Quoted 5 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -5
-     case V4L2_FIELD_NONE:
-             frm_fmt = ISIF_FRMFMT_PROGRESSIVE;
-             /* buffer type only applicable for interlaced scan */
-             break;
-

After the switch, frm_fmt is used in the call to isif_set_frame_format. I'm not sure why this call can be discarded. Also, removing the case and the break will cause the result to be return -EINVAL;, but that doesn't seem correct.

julia

Quoted 24 lines
Quoted 3 lines

drivers/staging/media/davinci_vpfe/dm365_isif.c isif_config_format(struct vpfe_device *vpfe_dev, unsigned int pad) · line 258

Quoted 3 lines
drivers/staging/media/davinci_vpfe/dm365_isif.c +0 -0
      case V4L2_FIELD_SEQ_TB:
              return isif_set_buftype(vpfe_isif, ISIF_BUFTYPE_FLD_SEPARATED);
 

After the switch, if was never used. There is only the return of the function.

Quoted 10 lines
Quoted 10 lines

--
2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a97c778a2c814868c68a81dc18bfe25466422853.1455834014.git.thaissa.falbo%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAKqL7ZVnFHPjQJ53uuHFWrYZEg6oKgNN9Rg1hiex3SEhu6ms%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: media: davinci_vpfe: remove ret variable of function

Sorry, I'm gonna send a v2 on that! :)
Em 20/02/2016 20:55, "Greg KH" <[email protected]> escreveu:

Quoted 6 lines · Thaissa Falbo
Quoted 1 line

I can't accept patches without any changelog text at all :(