Skip to contentSkip to conversation

media_build: add PTR_RET to compat.h

PATCH Applied Gianluca Gennari 2 participants 2 messages Feb 9, 2013 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media_build: add PTR_RET to compat.h

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.

---
 v4l/compat.h                      | 10 ++++++++++
 v4l/scripts/make_config_compat.pl |  1 +
 2 files changed, 11 insertions(+)
v4l/compat.h +10 -0
index 1a82bb7..b27b178 100644
@@ -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 */
v4l/scripts/make_config_compat.pl +1 -0
index 583ef9d..51a1f5d 100644
@@ -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");
Signature · 1 line
1.8.1.1
Applied
#1 lore raw
Quoted 3 lines · 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

Quoted 39 lines
---
 v4l/compat.h                      | 10 ++++++++++
 v4l/scripts/make_config_compat.pl |  1 +
 2 files changed, 11 insertions(+)
v4l/compat.h +10 -0
index 1a82bb7..b27b178 100644
@@ -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 */
v4l/scripts/make_config_compat.pl +1 -0
index 583ef9d..51a1f5d 100644
@@ -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");