All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support
@ 2016-08-17 13:32 Laurent Pinchart
  2016-08-17 13:34 ` Geert Uytterhoeven
  2016-08-18 14:36   ` Niklas Söderlund
  0 siblings, 2 replies; 4+ messages in thread
From: Laurent Pinchart @ 2016-08-17 13:32 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc, Sergei Shtylyov, Geert Uytterhoeven

The rcar_fcp_enable() function immediately returns successfully when the
FCP device pointer is NULL to avoid forcing the users to check the FCP
device manually before every call. However, the stub version of the
function used when the FCP driver is disabled returns -ENOSYS
unconditionally, resulting in a different API contract for the two
versions of the function.

As a user that requires FCP support will fail at probe time when calling
rcar_fcp_get() if the FCP driver is disabled, the stub version of the
rcar_fcp_enable() function will only be called with a NULL FCP device.
We can thus return 0 unconditionally to align the behaviour with the
normal version of the function.

Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 include/media/rcar-fcp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h
index 4c7fc77eaf29..8723f05c6321 100644
--- a/include/media/rcar-fcp.h
+++ b/include/media/rcar-fcp.h
@@ -29,7 +29,7 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
 static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { }
 static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp)
 {
-	return -ENOSYS;
+	return 0;
 }
 static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { }
 #endif
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support
  2016-08-17 13:32 [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support Laurent Pinchart
@ 2016-08-17 13:34 ` Geert Uytterhoeven
  2016-08-18 14:36   ` Niklas Söderlund
  1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2016-08-17 13:34 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Linux Media Mailing List, Linux-Renesas, Sergei Shtylyov

On Wed, Aug 17, 2016 at 3:32 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> The rcar_fcp_enable() function immediately returns successfully when the
> FCP device pointer is NULL to avoid forcing the users to check the FCP
> device manually before every call. However, the stub version of the
> function used when the FCP driver is disabled returns -ENOSYS
> unconditionally, resulting in a different API contract for the two
> versions of the function.
>
> As a user that requires FCP support will fail at probe time when calling
> rcar_fcp_get() if the FCP driver is disabled, the stub version of the
> rcar_fcp_enable() function will only be called with a NULL FCP device.
> We can thus return 0 unconditionally to align the behaviour with the
> normal version of the function.
>
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support
  2016-08-17 13:32 [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support Laurent Pinchart
@ 2016-08-18 14:36   ` Niklas Söderlund
  2016-08-18 14:36   ` Niklas Söderlund
  1 sibling, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2016-08-18 14:36 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, linux-renesas-soc, Sergei Shtylyov, Geert Uytterhoeven

On 2016-08-17 16:32:08 +0300, Laurent Pinchart wrote:
> The rcar_fcp_enable() function immediately returns successfully when the
> FCP device pointer is NULL to avoid forcing the users to check the FCP
> device manually before every call. However, the stub version of the
> function used when the FCP driver is disabled returns -ENOSYS
> unconditionally, resulting in a different API contract for the two
> versions of the function.
> 
> As a user that requires FCP support will fail at probe time when calling
> rcar_fcp_get() if the FCP driver is disabled, the stub version of the
> rcar_fcp_enable() function will only be called with a NULL FCP device.
> We can thus return 0 unconditionally to align the behaviour with the
> normal version of the function.
> 
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Works on Koelsch with shmobile_defconfig.

Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  include/media/rcar-fcp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h
> index 4c7fc77eaf29..8723f05c6321 100644
> --- a/include/media/rcar-fcp.h
> +++ b/include/media/rcar-fcp.h
> @@ -29,7 +29,7 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
>  static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { }
>  static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp)
>  {
> -	return -ENOSYS;
> +	return 0;
>  }
>  static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { }
>  #endif
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund

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

* Re: [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support
@ 2016-08-18 14:36   ` Niklas Söderlund
  0 siblings, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2016-08-18 14:36 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, linux-renesas-soc, Sergei Shtylyov, Geert Uytterhoeven

On 2016-08-17 16:32:08 +0300, Laurent Pinchart wrote:
> The rcar_fcp_enable() function immediately returns successfully when the
> FCP device pointer is NULL to avoid forcing the users to check the FCP
> device manually before every call. However, the stub version of the
> function used when the FCP driver is disabled returns -ENOSYS
> unconditionally, resulting in a different API contract for the two
> versions of the function.
> 
> As a user that requires FCP support will fail at probe time when calling
> rcar_fcp_get() if the FCP driver is disabled, the stub version of the
> rcar_fcp_enable() function will only be called with a NULL FCP device.
> We can thus return 0 unconditionally to align the behaviour with the
> normal version of the function.
> 
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Works on Koelsch with shmobile_defconfig.

Tested-by: Niklas S�derlund <niklas.soderlund@ragnatech.se>

> ---
>  include/media/rcar-fcp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h
> index 4c7fc77eaf29..8723f05c6321 100644
> --- a/include/media/rcar-fcp.h
> +++ b/include/media/rcar-fcp.h
> @@ -29,7 +29,7 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
>  static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { }
>  static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp)
>  {
> -	return -ENOSYS;
> +	return 0;
>  }
>  static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { }
>  #endif
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas S�derlund

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

end of thread, other threads:[~2016-08-18 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17 13:32 [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support Laurent Pinchart
2016-08-17 13:34 ` Geert Uytterhoeven
2016-08-18 14:36 ` Niklas Söderlund
2016-08-18 14:36   ` Niklas Söderlund

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.