Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media_build: add PTR_RET to compat.h
@ 2013-02-09 14:04 Gianluca Gennari
  2013-02-09 15:23 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Gianluca Gennari @ 2013-02-09 14:04 UTC (permalink / raw)
  To: linux-media, mchehab; +Cc: hans.verkuil, Gianluca Gennari

PTR_RET is used by the solo6x10 staging driver,
and was introduced in kernel 2.6.39.
Add it to compat.h for compatibility with older kernels.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
---
 v4l/compat.h                      | 10 ++++++++++
 v4l/scripts/make_config_compat.pl |  1 +
 2 files changed, 11 insertions(+)

diff --git a/v4l/compat.h b/v4l/compat.h
index 1a82bb7..b27b178 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -1137,4 +1137,14 @@ static inline int usb_translate_errors(int error_code)
 }
 #endif
 
+#ifdef NEED_PTR_RET
+static inline int __must_check PTR_RET(const void *ptr)
+{
+	if (IS_ERR(ptr))
+		return PTR_ERR(ptr);
+	else
+		return 0;
+}
+#endif
+
 #endif /*  _COMPAT_H */
diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl
index 583ef9d..51a1f5d 100644
--- a/v4l/scripts/make_config_compat.pl
+++ b/v4l/scripts/make_config_compat.pl
@@ -588,6 +588,7 @@ sub check_other_dependencies()
 	check_files_for_func("config_enabled", "NEED_IS_ENABLED", "include/linux/kconfig.h");
 	check_files_for_func("DEFINE_PCI_DEVICE_TABLE", "NEED_DEFINE_PCI_DEVICE_TABLE", "include/linux/pci.h");
 	check_files_for_func("usb_translate_errors", "NEED_USB_TRANSLATE_ERRORS", "include/linux/usb.h");
+	check_files_for_func("PTR_RET", "NEED_PTR_RET", "include/linux/err.h");
 
 	# For tests for uapi-dependent logic
 	check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h");
-- 
1.8.1.1


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

* Re: [PATCH] media_build: add PTR_RET to compat.h
  2013-02-09 14:04 [PATCH] media_build: add PTR_RET to compat.h Gianluca Gennari
@ 2013-02-09 15:23 ` Hans Verkuil
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2013-02-09 15:23 UTC (permalink / raw)
  To: Gianluca Gennari; +Cc: linux-media, mchehab, hans.verkuil

On Sat February 9 2013 15:04:40 Gianluca Gennari wrote:
> PTR_RET is used by the solo6x10 staging driver,
> and was introduced in kernel 2.6.39.
> Add it to compat.h for compatibility with older kernels.

Applied, thanks!

Regards,

	Hans

> 
> Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
> ---
>  v4l/compat.h                      | 10 ++++++++++
>  v4l/scripts/make_config_compat.pl |  1 +
>  2 files changed, 11 insertions(+)
> 
> diff --git a/v4l/compat.h b/v4l/compat.h
> index 1a82bb7..b27b178 100644
> --- a/v4l/compat.h
> +++ b/v4l/compat.h
> @@ -1137,4 +1137,14 @@ static inline int usb_translate_errors(int error_code)
>  }
>  #endif
>  
> +#ifdef NEED_PTR_RET
> +static inline int __must_check PTR_RET(const void *ptr)
> +{
> +	if (IS_ERR(ptr))
> +		return PTR_ERR(ptr);
> +	else
> +		return 0;
> +}
> +#endif
> +
>  #endif /*  _COMPAT_H */
> diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl
> index 583ef9d..51a1f5d 100644
> --- a/v4l/scripts/make_config_compat.pl
> +++ b/v4l/scripts/make_config_compat.pl
> @@ -588,6 +588,7 @@ sub check_other_dependencies()
>  	check_files_for_func("config_enabled", "NEED_IS_ENABLED", "include/linux/kconfig.h");
>  	check_files_for_func("DEFINE_PCI_DEVICE_TABLE", "NEED_DEFINE_PCI_DEVICE_TABLE", "include/linux/pci.h");
>  	check_files_for_func("usb_translate_errors", "NEED_USB_TRANSLATE_ERRORS", "include/linux/usb.h");
> +	check_files_for_func("PTR_RET", "NEED_PTR_RET", "include/linux/err.h");
>  
>  	# For tests for uapi-dependent logic
>  	check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h");
> 

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

end of thread, other threads:[~2013-02-09 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-09 14:04 [PATCH] media_build: add PTR_RET to compat.h Gianluca Gennari
2013-02-09 15:23 ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox