diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2015-03-04 17:38:19 +0900 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2016-12-14 13:40:57 +0900 |
commit | 631f630fe27de998ca1bd938363d3ea82193a47b (patch) | |
tree | 6cf4a1ff125e2dd0ae56a8e16c99d80bde2f18cc /drivers/misc | |
parent | 188630bfe93634428c8e431b1a350356de295939 (diff) |
misc: tizen_global_lock: add support for 32bt compat mode from 64bit
This patch adds support for 32bit compat mode, including compat_ioctl,
pointer casting and compat ioctl cmd, from 64bit system.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/tizen_global_lock.c | 23 | ||||
-rw-r--r-- | drivers/misc/tizen_global_lock.h | 9 |
2 files changed, 28 insertions, 4 deletions
diff --git a/drivers/misc/tizen_global_lock.c b/drivers/misc/tizen_global_lock.c index 95cd0400c698..9a5414f62efc 100644 --- a/drivers/misc/tizen_global_lock.c +++ b/drivers/misc/tizen_global_lock.c @@ -51,7 +51,7 @@ struct tgl_lock { struct list_head waiting_list; /* waiting list */ struct mutex waiting_list_mutex; unsigned int locked; /* flag if is locked */ - unsigned int owner; /* session data */ + struct tgl_session_data *owner; /* session data */ struct mutex data_mutex; unsigned int user_data1; @@ -324,7 +324,7 @@ static int tgl_lock_lock(struct tgl_session_data *session_data, TGL_LOG(); mutex_lock(&lock->data_mutex); - lock->owner = (unsigned int)session_data; + lock->owner = session_data; lock->locked = 1; lock->owner_pid = current->tgid; lock->owner_tid = current->pid; @@ -358,7 +358,7 @@ static int _tgl_unlock_lock(struct tgl_lock *lock) return -EBADRQC; } - lock->owner = 0; + lock->owner = NULL; lock->locked = 0; lock->owner_pid = 0; lock->owner_tid = 0; @@ -404,7 +404,7 @@ static int tgl_unlock_lock(struct tgl_session_data *session_data, mutex_unlock(&tgl_global.mutex); mutex_lock(&lock->data_mutex); - if (lock->owner != (unsigned int)session_data) { + if (lock->owner != session_data) { mutex_unlock(&lock->data_mutex); TGL_WARN("tried to unlock not-owned lock by calling session"); return -EBADRQC; @@ -647,6 +647,9 @@ static long tgl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) switch (cmd) { case TGL_IOC_INIT_LOCK: +#ifdef CONFIG_COMPAT + case TGL_IOC_INIT_LOCK_COMPAT: +#endif /* destroy lock with attribute */ err = tgl_init_lock(session_data, (struct tgl_attribute *)arg); break; @@ -663,12 +666,21 @@ static long tgl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) err = tgl_unlock_lock(session_data, (unsigned int)arg); break; case TGL_IOC_SET_DATA: +#ifdef CONFIG_COMPAT + case TGL_IOC_SET_DATA_COMPAT: +#endif err = tgl_set_data(session_data, (struct tgl_user_data *)arg); break; case TGL_IOC_GET_DATA: +#ifdef CONFIG_COMPAT + case TGL_IOC_GET_DATA_COMPAT: +#endif err = tgl_get_data(session_data, (struct tgl_user_data *)arg); break; case TGL_IOC_DUMP_LOCKS: +#ifdef CONFIG_COMPAT + case TGL_IOC_DUMP_LOCKS_COMPAT: +#endif tgl_dump_locks(); break; default: @@ -762,6 +774,9 @@ static const struct file_operations tgl_ops = { .open = tgl_open, .release = tgl_release, .unlocked_ioctl = tgl_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = tgl_ioctl, +#endif }; static int __init tgl_init(void) diff --git a/drivers/misc/tizen_global_lock.h b/drivers/misc/tizen_global_lock.h index 38eb5fcd0c08..2e6eadccea97 100644 --- a/drivers/misc/tizen_global_lock.h +++ b/drivers/misc/tizen_global_lock.h @@ -38,6 +38,9 @@ enum tgl_ioctls { #define TGL_IOC_INIT_LOCK _IOW(TGL_IOC_BASE, TGL_INIT_LOCK, \ struct tgl_attribute *) +#define TGL_IOC_INIT_LOCK_COMPAT \ + _IOW(TGL_IOC_BASE, TGL_INIT_LOCK, \ + unsigned int) #define TGL_IOC_DESTROY_LOCK _IOW(TGL_IOC_BASE, TGL_DESTROY_LOCK, \ unsigned int) #define TGL_IOC_LOCK_LOCK _IOW(TGL_IOC_BASE, TGL_LOCK_LOCK, \ @@ -46,8 +49,14 @@ enum tgl_ioctls { unsigned int) #define TGL_IOC_SET_DATA _IOW(TGL_IOC_BASE, TGL_SET_DATA, \ struct tgl_user_data *) +#define TGL_IOC_SET_DATA_COMPAT _IOW(TGL_IOC_BASE, TGL_SET_DATA, \ + unsigned int) #define TGL_IOC_GET_DATA _IOW(TGL_IOC_BASE, TGL_GET_DATA, \ struct tgl_user_data *) +#define TGL_IOC_GET_DATA_COMPAT _IOW(TGL_IOC_BASE, TGL_GET_DATA, \ + unsigned int) #define TGL_IOC_DUMP_LOCKS _IOW(TGL_IOC_BASE, TGL_DUMP_LOCKS, void *) +#define TGL_IOC_DUMP_LOCKS_COMPAT \ + _IOW(TGL_IOC_BASE, TGL_DUMP_LOCKS, unsigned int) #endif /* __TIZEN_GLOBAL_LOCK_H__ */ |