Input: uinput - specify exact bit sizes on userspace APIs
Switch to using __u32/__s32 instead of ordinary 'int' in structures forming userspace API. Also internally make request_id unsigned int. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
parent
00ce756ce5
commit
c5b3533a82
@ -59,7 +59,7 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i
|
|||||||
static bool uinput_request_alloc_id(struct uinput_device *udev,
|
static bool uinput_request_alloc_id(struct uinput_device *udev,
|
||||||
struct uinput_request *request)
|
struct uinput_request *request)
|
||||||
{
|
{
|
||||||
int id;
|
unsigned int id;
|
||||||
bool reserved = false;
|
bool reserved = false;
|
||||||
|
|
||||||
spin_lock(&udev->requests_lock);
|
spin_lock(&udev->requests_lock);
|
||||||
@ -77,10 +77,11 @@ static bool uinput_request_alloc_id(struct uinput_device *udev,
|
|||||||
return reserved;
|
return reserved;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct uinput_request *uinput_request_find(struct uinput_device *udev, int id)
|
static struct uinput_request *uinput_request_find(struct uinput_device *udev,
|
||||||
|
unsigned int id)
|
||||||
{
|
{
|
||||||
/* Find an input request, by ID. Returns NULL if the ID isn't valid. */
|
/* Find an input request, by ID. Returns NULL if the ID isn't valid. */
|
||||||
if (id >= UINPUT_NUM_REQUESTS || id < 0)
|
if (id >= UINPUT_NUM_REQUESTS)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return udev->requests[id];
|
return udev->requests[id];
|
||||||
@ -556,8 +557,8 @@ static int uinput_release(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
struct uinput_ff_upload_compat {
|
struct uinput_ff_upload_compat {
|
||||||
int request_id;
|
__u32 request_id;
|
||||||
int retval;
|
__s32 retval;
|
||||||
struct ff_effect_compat effect;
|
struct ff_effect_compat effect;
|
||||||
struct ff_effect_compat old;
|
struct ff_effect_compat old;
|
||||||
};
|
};
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
* - first public version
|
* - first public version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
|
||||||
#define UINPUT_VERSION 3
|
#define UINPUT_VERSION 3
|
||||||
@ -44,14 +45,14 @@
|
|||||||
enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
|
enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
|
||||||
|
|
||||||
struct uinput_request {
|
struct uinput_request {
|
||||||
int id;
|
unsigned int id;
|
||||||
int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
|
unsigned int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
|
||||||
|
|
||||||
int retval;
|
int retval;
|
||||||
struct completion done;
|
struct completion done;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
int effect_id;
|
unsigned int effect_id;
|
||||||
struct {
|
struct {
|
||||||
struct ff_effect *effect;
|
struct ff_effect *effect;
|
||||||
struct ff_effect *old;
|
struct ff_effect *old;
|
||||||
@ -77,16 +78,16 @@ struct uinput_device {
|
|||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
struct uinput_ff_upload {
|
struct uinput_ff_upload {
|
||||||
int request_id;
|
__u32 request_id;
|
||||||
int retval;
|
__s32 retval;
|
||||||
struct ff_effect effect;
|
struct ff_effect effect;
|
||||||
struct ff_effect old;
|
struct ff_effect old;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uinput_ff_erase {
|
struct uinput_ff_erase {
|
||||||
int request_id;
|
__u32 request_id;
|
||||||
int retval;
|
__s32 retval;
|
||||||
int effect_id;
|
__u32 effect_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ioctl */
|
/* ioctl */
|
||||||
@ -166,11 +167,11 @@ struct uinput_ff_erase {
|
|||||||
struct uinput_user_dev {
|
struct uinput_user_dev {
|
||||||
char name[UINPUT_MAX_NAME_SIZE];
|
char name[UINPUT_MAX_NAME_SIZE];
|
||||||
struct input_id id;
|
struct input_id id;
|
||||||
int ff_effects_max;
|
__u32 ff_effects_max;
|
||||||
int absmax[ABS_CNT];
|
__s32 absmax[ABS_CNT];
|
||||||
int absmin[ABS_CNT];
|
__s32 absmin[ABS_CNT];
|
||||||
int absfuzz[ABS_CNT];
|
__s32 absfuzz[ABS_CNT];
|
||||||
int absflat[ABS_CNT];
|
__s32 absflat[ABS_CNT];
|
||||||
};
|
};
|
||||||
#endif /* __UINPUT_H_ */
|
#endif /* __UINPUT_H_ */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user