Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1604405
| From | Daeseok Youn <daeseok.youn@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/4] staging: atomisp: simplify if statement in atomisp_get_sensor_fps() |
| Date | 2017-03-20 12:20 +0100 |
| Message-ID | <tn3vZ-3VF-35@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
If v4l2_subdev_call() gets the global frame interval values,
it returned 0 and it could be checked whether numerator is zero or not.
If the numerator is not zero, the fps could be calculated in this function.
If not, it just returns 0.
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
.../media/atomisp/pci/atomisp2/atomisp_cmd.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 8bdb224..6bdd19e 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -153,20 +153,18 @@ struct atomisp_acc_pipe *atomisp_to_acc_pipe(struct video_device *dev)
static unsigned short atomisp_get_sensor_fps(struct atomisp_sub_device *asd)
{
- struct v4l2_subdev_frame_interval frame_interval;
+ struct v4l2_subdev_frame_interval fi;
struct atomisp_device *isp = asd->isp;
- unsigned short fps;
- if (v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
- video, g_frame_interval, &frame_interval)) {
- fps = 0;
- } else {
- if (frame_interval.interval.numerator)
- fps = frame_interval.interval.denominator /
- frame_interval.interval.numerator;
- else
- fps = 0;
- }
+ unsigned short fps = 0;
+ int ret;
+
+ ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
+ video, g_frame_interval, &fi);
+
+ if (!ret && fi.interval.numerator)
+ fps = fi.interval.denominator / fi.interval.numerator;
+
return fps;
}
--
1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 2/4] staging: atomisp: simplify if statement in atomisp_get_sensor_fps() Daeseok Youn <daeseok.youn@gmail.com> - 2017-03-20 12:20 +0100
Re: [PATCH 2/4] staging: atomisp: simplify if statement in atomisp_get_sensor_fps() walter harms <wharms@bfs.de> - 2017-03-20 13:10 +0100
Re: [PATCH 2/4] staging: atomisp: simplify if statement in atomisp_get_sensor_fps() DaeSeok Youn <daeseok.youn@gmail.com> - 2017-03-20 14:00 +0100
Re: [PATCH 2/4] staging: atomisp: simplify if statement in atomisp_get_sensor_fps() walter harms <wharms@bfs.de> - 2017-03-20 14:20 +0100
Re: [PATCH 2/4] staging: atomisp: simplify if statement in atomisp_get_sensor_fps() DaeSeok Youn <daeseok.youn@gmail.com> - 2017-03-21 02:50 +0100
csiph-web