Skip to contentSkip to conversation

staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

PATCH Superseded Lisa Nguyen 3 participants 4 messages Dec 10, 2013 – Dec 11, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

Rewrite the return statement in vpfe_video.c to eliminate the use of a ternary operator. This will prevent the checkpatch.pl script from generating a warning saying to remove () from this particular return statement.

---
Changes since v2:
- Aligned -ETIMEDOUT return statement with if condition

 drivers/staging/media/davinci_vpfe/vpfe_video.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/vpfe_video.c +4 -1
index 24d98a6..22e31d2 100644
@@ -346,7 +346,10 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
 	}
 	mutex_unlock(&mdev->graph_mutex);
 
-	return (ret == 0) ? ret : -ETIMEDOUT ;
+	if (ret == 0)
+		return ret;
+
+	return -ETIMEDOUT;
 }
 
 /*
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Lisa,

Thank you for the patch.

Quoted 19 lines · On Tuesday 10 December 2013 08:05:42 Lisa Nguyen wrote:

Rewrite the return statement in vpfe_video.c to eliminate the use of a ternary operator. This will prevent the checkpatch.pl script from generating a warning saying to remove () from this particular return statement.

---
Changes since v2:
- Aligned -ETIMEDOUT return statement with if condition

 drivers/staging/media/davinci_vpfe/vpfe_video.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 24d98a6..22e31d2 100644

drivers/staging/media/davinci_vpfe/vpfe_video.c static int vpfe_pipeline_disable(struct vpfe_pipeline · line 352

Quoted 8 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +4 -1
@@ -346,7 +346,10 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline
 *pipe) }
 	mutex_unlock(&mdev->graph_mutex);
 
-	return (ret == 0) ? ret : -ETIMEDOUT ;
+	if (ret == 0)
+		return ret;
+
+	return -ETIMEDOUT;

I don't want to point the obvious, but what about just

	return ret ? -ETIMEDOUT : 0;

or, if this is just about fixing the checkpatch.pl warning,

	return ret == 0 ? ret : -ETIMEDOUT;

(I'd prefer the first)

Quoted 3 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +0 -0
 }
 
 /*
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi Laurent,

Quoted 35 lines · Laurent Pinchart

Hi Lisa,

Thank you for the patch.

Quoted 19 lines · On Tuesday 10 December 2013 08:05:42 Lisa Nguyen wrote:

Rewrite the return statement in vpfe_video.c to eliminate the use of a ternary operator. This will prevent the checkpatch.pl script from generating a warning saying to remove () from this particular return statement.

---
Changes since v2:
- Aligned -ETIMEDOUT return statement with if condition

 drivers/staging/media/davinci_vpfe/vpfe_video.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 24d98a6..22e31d2 100644

drivers/staging/media/davinci_vpfe/vpfe_video.c static int vpfe_pipeline_disable(struct vpfe_pipeline · line 352

Quoted 8 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +4 -1
@@ -346,7 +346,10 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline
 *pipe) }
      mutex_unlock(&mdev->graph_mutex);
 
-     return (ret == 0) ? ret : -ETIMEDOUT ;
+     if (ret == 0)
+             return ret;
+
+     return -ETIMEDOUT;

I don't want to point the obvious, but what about just

Quoted 7 lines
        return ret ? -ETIMEDOUT : 0;

or, if this is just about fixing the checkpatch.pl warning,

        return ret == 0 ? ret : -ETIMEDOUT;

(I'd prefer the first)

I understand your point :) I was making changes based on Prabhakar's feedback he gave me a while back[1].

Should I wait until he says?

Lisa

[1] http://www.mail-archive.com/[email protected]/msg67833.html

#3 lore raw

Hi Lisa,

Quoted 41 lines · Lisa Nguyen

Hi Laurent,

Quoted 37 lines · Laurent Pinchart

Hi Lisa,

Thank you for the patch.

Quoted 19 lines · On Tuesday 10 December 2013 08:05:42 Lisa Nguyen wrote:

Rewrite the return statement in vpfe_video.c to eliminate the use of a ternary operator. This will prevent the checkpatch.pl script from generating a warning saying to remove () from this particular return statement.

---
Changes since v2:
- Aligned -ETIMEDOUT return statement with if condition

 drivers/staging/media/davinci_vpfe/vpfe_video.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 24d98a6..22e31d2 100644

drivers/staging/media/davinci_vpfe/vpfe_video.c static int vpfe_pipeline_disable(struct vpfe_pipeline · line 352

Quoted 8 lines
drivers/staging/media/davinci_vpfe/vpfe_video.c +4 -1
@@ -346,7 +346,10 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline
 *pipe) }
      mutex_unlock(&mdev->graph_mutex);
 
-     return (ret == 0) ? ret : -ETIMEDOUT ;
+     if (ret == 0)
+             return ret;
+
+     return -ETIMEDOUT;

I don't want to point the obvious, but what about just

        return ret ? -ETIMEDOUT : 0;
Quoted 9 lines
Quoted 5 lines

or, if this is just about fixing the checkpatch.pl warning,

        return ret == 0 ? ret : -ETIMEDOUT;

(I'd prefer the first)

I understand your point :) I was making changes based on Prabhakar's feedback he gave me a while back[1].

Please go ahead as per Laurent's suggestion.

Thanks,
--Prabhakar Lad