Re: [PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
Sorry, my mistake, the device should be able to opened multiple times. It's a wrong patch. On 11/1/2016 16:52, Hans Verkuil wrote: On 01/11/16 09:08, Songjun Wu wrote: Release the filehandle in 'isc_open' if it's not the only filehandle opened for the associated video_device. What's wrong with that? You should always be able to open the device multiple times. v4l2-compliance will fail after this patch. I'm not sure what you intended to do here, but this patch is wrong. Regards, Hans Signed-off-by: Songjun Wu--- drivers/media/platform/atmel/atmel-isc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index 8e25d3f..5e08404 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -926,21 +926,21 @@ static int isc_open(struct file *file) if (ret < 0) goto unlock; -if (!v4l2_fh_is_singular_file(file)) -goto unlock; +ret = !v4l2_fh_is_singular_file(file); +if (ret) +goto fh_rel; ret = v4l2_subdev_call(sd, core, s_power, 1); -if (ret < 0 && ret != -ENOIOCTLCMD) { -v4l2_fh_release(file); -goto unlock; -} +if (ret < 0 && ret != -ENOIOCTLCMD) +goto fh_rel; ret = isc_set_fmt(isc, >fmt); -if (ret) { +if (ret) v4l2_subdev_call(sd, core, s_power, 0); -v4l2_fh_release(file); -} +fh_rel: +if (ret) +v4l2_fh_release(file); unlock: mutex_unlock(>lock); return ret;
Re: [PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
Sorry, my mistake, the device should be able to opened multiple times. It's a wrong patch. On 11/1/2016 16:52, Hans Verkuil wrote: On 01/11/16 09:08, Songjun Wu wrote: Release the filehandle in 'isc_open' if it's not the only filehandle opened for the associated video_device. What's wrong with that? You should always be able to open the device multiple times. v4l2-compliance will fail after this patch. I'm not sure what you intended to do here, but this patch is wrong. Regards, Hans Signed-off-by: Songjun Wu --- drivers/media/platform/atmel/atmel-isc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index 8e25d3f..5e08404 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -926,21 +926,21 @@ static int isc_open(struct file *file) if (ret < 0) goto unlock; -if (!v4l2_fh_is_singular_file(file)) -goto unlock; +ret = !v4l2_fh_is_singular_file(file); +if (ret) +goto fh_rel; ret = v4l2_subdev_call(sd, core, s_power, 1); -if (ret < 0 && ret != -ENOIOCTLCMD) { -v4l2_fh_release(file); -goto unlock; -} +if (ret < 0 && ret != -ENOIOCTLCMD) +goto fh_rel; ret = isc_set_fmt(isc, >fmt); -if (ret) { +if (ret) v4l2_subdev_call(sd, core, s_power, 0); -v4l2_fh_release(file); -} +fh_rel: +if (ret) +v4l2_fh_release(file); unlock: mutex_unlock(>lock); return ret;
Re: [PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
On 01/11/16 09:08, Songjun Wu wrote: Release the filehandle in 'isc_open' if it's not the only filehandle opened for the associated video_device. What's wrong with that? You should always be able to open the device multiple times. v4l2-compliance will fail after this patch. I'm not sure what you intended to do here, but this patch is wrong. Regards, Hans Signed-off-by: Songjun Wu--- drivers/media/platform/atmel/atmel-isc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index 8e25d3f..5e08404 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -926,21 +926,21 @@ static int isc_open(struct file *file) if (ret < 0) goto unlock; - if (!v4l2_fh_is_singular_file(file)) - goto unlock; + ret = !v4l2_fh_is_singular_file(file); + if (ret) + goto fh_rel; ret = v4l2_subdev_call(sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD) { - v4l2_fh_release(file); - goto unlock; - } + if (ret < 0 && ret != -ENOIOCTLCMD) + goto fh_rel; ret = isc_set_fmt(isc, >fmt); - if (ret) { + if (ret) v4l2_subdev_call(sd, core, s_power, 0); - v4l2_fh_release(file); - } +fh_rel: + if (ret) + v4l2_fh_release(file); unlock: mutex_unlock(>lock); return ret;
Re: [PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
On 01/11/16 09:08, Songjun Wu wrote: Release the filehandle in 'isc_open' if it's not the only filehandle opened for the associated video_device. What's wrong with that? You should always be able to open the device multiple times. v4l2-compliance will fail after this patch. I'm not sure what you intended to do here, but this patch is wrong. Regards, Hans Signed-off-by: Songjun Wu --- drivers/media/platform/atmel/atmel-isc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index 8e25d3f..5e08404 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -926,21 +926,21 @@ static int isc_open(struct file *file) if (ret < 0) goto unlock; - if (!v4l2_fh_is_singular_file(file)) - goto unlock; + ret = !v4l2_fh_is_singular_file(file); + if (ret) + goto fh_rel; ret = v4l2_subdev_call(sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD) { - v4l2_fh_release(file); - goto unlock; - } + if (ret < 0 && ret != -ENOIOCTLCMD) + goto fh_rel; ret = isc_set_fmt(isc, >fmt); - if (ret) { + if (ret) v4l2_subdev_call(sd, core, s_power, 0); - v4l2_fh_release(file); - } +fh_rel: + if (ret) + v4l2_fh_release(file); unlock: mutex_unlock(>lock); return ret;
[PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
Release the filehandle in 'isc_open' if it's not the only filehandle opened for the associated video_device. Signed-off-by: Songjun Wu--- drivers/media/platform/atmel/atmel-isc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index 8e25d3f..5e08404 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -926,21 +926,21 @@ static int isc_open(struct file *file) if (ret < 0) goto unlock; - if (!v4l2_fh_is_singular_file(file)) - goto unlock; + ret = !v4l2_fh_is_singular_file(file); + if (ret) + goto fh_rel; ret = v4l2_subdev_call(sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD) { - v4l2_fh_release(file); - goto unlock; - } + if (ret < 0 && ret != -ENOIOCTLCMD) + goto fh_rel; ret = isc_set_fmt(isc, >fmt); - if (ret) { + if (ret) v4l2_subdev_call(sd, core, s_power, 0); - v4l2_fh_release(file); - } +fh_rel: + if (ret) + v4l2_fh_release(file); unlock: mutex_unlock(>lock); return ret; -- 2.7.4
[PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
Release the filehandle in 'isc_open' if it's not the only filehandle opened for the associated video_device. Signed-off-by: Songjun Wu --- drivers/media/platform/atmel/atmel-isc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index 8e25d3f..5e08404 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -926,21 +926,21 @@ static int isc_open(struct file *file) if (ret < 0) goto unlock; - if (!v4l2_fh_is_singular_file(file)) - goto unlock; + ret = !v4l2_fh_is_singular_file(file); + if (ret) + goto fh_rel; ret = v4l2_subdev_call(sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD) { - v4l2_fh_release(file); - goto unlock; - } + if (ret < 0 && ret != -ENOIOCTLCMD) + goto fh_rel; ret = isc_set_fmt(isc, >fmt); - if (ret) { + if (ret) v4l2_subdev_call(sd, core, s_power, 0); - v4l2_fh_release(file); - } +fh_rel: + if (ret) + v4l2_fh_release(file); unlock: mutex_unlock(>lock); return ret; -- 2.7.4