From 17490135b2a7a46fc7fb67d64dbaeb1301ea169d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 6 Nov 2008 23:02:07 +0100 Subject: v4l: fix dev_set_name compiler errors for kernels < 2.6.26 From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- linux/drivers/media/video/sh_mobile_ceu_camera.c | 1 + linux/drivers/media/video/soc_camera.c | 1 + v4l/compat.h | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/linux/drivers/media/video/sh_mobile_ceu_camera.c b/linux/drivers/media/video/sh_mobile_ceu_camera.c index 4677e2ce0..2fb8bee0b 100644 --- a/linux/drivers/media/video/sh_mobile_ceu_camera.c +++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c @@ -37,6 +37,7 @@ #include #include #include +#include "compat.h" /* register offsets for sh7722 / sh7723 */ diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c index 28cf5c94b..7a46697c4 100644 --- a/linux/drivers/media/video/soc_camera.c +++ b/linux/drivers/media/video/soc_camera.c @@ -29,6 +29,7 @@ #include #include #include +#include "compat.h" static LIST_HEAD(hosts); static LIST_HEAD(devices); diff --git a/v4l/compat.h b/v4l/compat.h index 7325e15c4..3c0c2e345 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -18,6 +18,7 @@ #ifdef CONFIG_PROC_FS #include #include +#include #endif #endif @@ -210,6 +211,10 @@ static inline struct proc_dir_entry *proc_create_data(const char *a, #define hweight64(x) generic_hweight64(x) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) +typedef unsigned long uintptr_t; +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) #define div64_u64(a,b) div64_64(a,b) @@ -219,20 +224,17 @@ static inline struct proc_dir_entry *proc_create_data(const char *a, ( h ), \ ( x ) ) ) -#define dev_name(dev) ((dev)->bus_id) - -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) -typedef unsigned long uintptr_t; -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static inline int list_is_singular(const struct list_head *head) { return !list_empty(head) && (head->next == head->prev); } +#define dev_name(dev) ((dev)->bus_id) + +#define dev_set_name(dev, fmt, arg...) ({ \ + snprintf((dev)->bus_id, sizeof((dev)->bus_id), fmt , ## arg); \ + 0; \ +}) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) -- cgit v1.2.3