All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] media: ov2659: two fixes for ov2659 driver
@ 2019-03-30 14:01 Akinobu Mita
  2019-03-30 14:01 ` [PATCH 1/2] media: ov2659: make S_FMT ioctl succeed even if requested format doesn't match Akinobu Mita
  2019-03-30 14:01 ` [PATCH 2/2] media: ov2659: fix unbalanced mutex_lock/unlock Akinobu Mita
  0 siblings, 2 replies; 5+ messages in thread
From: Akinobu Mita @ 2019-03-30 14:01 UTC (permalink / raw)
  To: linux-media; +Cc: Akinobu Mita

This patchset contains two fixes for ov2659 driver.

Akinobu Mita (2):
  media: ov2659: make S_FMT ioctl succeed even if requested format
    doesn't match
  media: ov2659: fix unbalanced mutex_lock/unlock

 drivers/media/i2c/ov2659.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

-- 
2.7.4


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

* [PATCH 1/2] media: ov2659: make S_FMT ioctl succeed even if requested format doesn't match
  2019-03-30 14:01 [PATCH 0/2] media: ov2659: two fixes for ov2659 driver Akinobu Mita
@ 2019-03-30 14:01 ` Akinobu Mita
  2019-04-04 15:18   ` Lad, Prabhakar
  2019-03-30 14:01 ` [PATCH 2/2] media: ov2659: fix unbalanced mutex_lock/unlock Akinobu Mita
  1 sibling, 1 reply; 5+ messages in thread
From: Akinobu Mita @ 2019-03-30 14:01 UTC (permalink / raw)
  To: linux-media
  Cc: Akinobu Mita, Lad, Prabhakar, Sakari Ailus, Mauro Carvalho Chehab

This driver returns an error if unsupported media bus pixel code is
requested by VIDIOC_SUBDEV_S_FMT.

But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst,

Drivers must not return an error solely because the requested format
doesn't match the device capabilities. They must instead modify the
format to match what the hardware can provide.

So select default format code and return success in that case.

This is detected by v4l2-compliance.

Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/ov2659.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index 799acce..a1e9a98 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,
 		if (ov2659_formats[index].code == mf->code)
 			break;
 
-	if (index < 0)
-		return -EINVAL;
+	if (index < 0) {
+		index = 0;
+		mf->code = ov2659_formats[index].code;
+	}
 
 	mf->colorspace = V4L2_COLORSPACE_SRGB;
 	mf->field = V4L2_FIELD_NONE;
-- 
2.7.4


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

* [PATCH 2/2] media: ov2659: fix unbalanced mutex_lock/unlock
  2019-03-30 14:01 [PATCH 0/2] media: ov2659: two fixes for ov2659 driver Akinobu Mita
  2019-03-30 14:01 ` [PATCH 1/2] media: ov2659: make S_FMT ioctl succeed even if requested format doesn't match Akinobu Mita
@ 2019-03-30 14:01 ` Akinobu Mita
  2019-04-04 15:19   ` Lad, Prabhakar
  1 sibling, 1 reply; 5+ messages in thread
From: Akinobu Mita @ 2019-03-30 14:01 UTC (permalink / raw)
  To: linux-media
  Cc: Akinobu Mita, Lad, Prabhakar, Sakari Ailus, Mauro Carvalho Chehab

Avoid returning with mutex locked.

Fixes: fa8cb6444c32 ("[media] ov2659: Don't depend on subdev API")
Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/ov2659.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index a1e9a98..5ed2413 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1132,7 +1132,7 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,
 		mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
 		*mf = fmt->format;
 #else
-		return -ENOTTY;
+		ret = -ENOTTY;
 #endif
 	} else {
 		s64 val;
-- 
2.7.4


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

* Re: [PATCH 1/2] media: ov2659: make S_FMT ioctl succeed even if requested format doesn't match
  2019-03-30 14:01 ` [PATCH 1/2] media: ov2659: make S_FMT ioctl succeed even if requested format doesn't match Akinobu Mita
@ 2019-04-04 15:18   ` Lad, Prabhakar
  0 siblings, 0 replies; 5+ messages in thread
From: Lad, Prabhakar @ 2019-04-04 15:18 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-media, Sakari Ailus, Mauro Carvalho Chehab

Hi Akinobu,

Thanks for the patch.

On Sat, Mar 30, 2019 at 2:01 PM Akinobu Mita <akinobu.mita@gmail.com> wrote:
>
> This driver returns an error if unsupported media bus pixel code is
> requested by VIDIOC_SUBDEV_S_FMT.
>
> But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst,
>
> Drivers must not return an error solely because the requested format
> doesn't match the device capabilities. They must instead modify the
> format to match what the hardware can provide.
>
> So select default format code and return success in that case.
>
> This is detected by v4l2-compliance.
>
> Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>  drivers/media/i2c/ov2659.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Cheers,
--Prabhakar Lad

> diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
> index 799acce..a1e9a98 100644
> --- a/drivers/media/i2c/ov2659.c
> +++ b/drivers/media/i2c/ov2659.c
> @@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,
>                 if (ov2659_formats[index].code == mf->code)
>                         break;
>
> -       if (index < 0)
> -               return -EINVAL;
> +       if (index < 0) {
> +               index = 0;
> +               mf->code = ov2659_formats[index].code;
> +       }
>
>         mf->colorspace = V4L2_COLORSPACE_SRGB;
>         mf->field = V4L2_FIELD_NONE;
> --
> 2.7.4
>

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

* Re: [PATCH 2/2] media: ov2659: fix unbalanced mutex_lock/unlock
  2019-03-30 14:01 ` [PATCH 2/2] media: ov2659: fix unbalanced mutex_lock/unlock Akinobu Mita
@ 2019-04-04 15:19   ` Lad, Prabhakar
  0 siblings, 0 replies; 5+ messages in thread
From: Lad, Prabhakar @ 2019-04-04 15:19 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-media, Sakari Ailus, Mauro Carvalho Chehab

Hi Akinobu,

Thanks for the patch.

On Sat, Mar 30, 2019 at 2:01 PM Akinobu Mita <akinobu.mita@gmail.com> wrote:
>
> Avoid returning with mutex locked.
>
> Fixes: fa8cb6444c32 ("[media] ov2659: Don't depend on subdev API")
> Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>  drivers/media/i2c/ov2659.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Cheers,
--Prabhakar Lad

> diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
> index a1e9a98..5ed2413 100644
> --- a/drivers/media/i2c/ov2659.c
> +++ b/drivers/media/i2c/ov2659.c
> @@ -1132,7 +1132,7 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,
>                 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
>                 *mf = fmt->format;
>  #else
> -               return -ENOTTY;
> +               ret = -ENOTTY;
>  #endif
>         } else {
>                 s64 val;
> --
> 2.7.4
>

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

end of thread, other threads:[~2019-04-04 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-30 14:01 [PATCH 0/2] media: ov2659: two fixes for ov2659 driver Akinobu Mita
2019-03-30 14:01 ` [PATCH 1/2] media: ov2659: make S_FMT ioctl succeed even if requested format doesn't match Akinobu Mita
2019-04-04 15:18   ` Lad, Prabhakar
2019-03-30 14:01 ` [PATCH 2/2] media: ov2659: fix unbalanced mutex_lock/unlock Akinobu Mita
2019-04-04 15:19   ` Lad, Prabhakar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.