sensors: sensorhub_brcm: fix for compatibility 21/85621/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 26 Aug 2016 07:04:31 +0000 (16:04 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 26 Aug 2016 07:11:29 +0000 (16:11 +0900)
For 32bit compatibility, compat_ioctl should be registered. Also,
32bit built IOCTL value is different from 64bit, then it should be
considered. So this fixes for compatibility with compat_ioctl.

Change-Id: I11c353d4cd39a8ef5014f2b9b2d1f504fda86182
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/sensors/brcm/bbdpl2/bcm_gps_i2c.c
drivers/sensors/brcm/gps/sec_gps_bcm47531.c
drivers/sensors/brcm/ssp_sensorhub.c
drivers/sensors/brcm/ssp_sensorhub.h
drivers/sensors/brcm/ssp_sysfs.c

index 08a8f94..b1475de 100644 (file)
@@ -437,7 +437,10 @@ static const struct file_operations gps_irq_fops = {
        .poll = gps_irq_poll,
        .read = gps_irq_read,
        .write = gps_irq_write,
-       .unlocked_ioctl = gps_irq_ioctl
+       .unlocked_ioctl = gps_irq_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl = gps_irq_ioctl,
+#endif
 };
 
 static int gps_hostwake_probe(struct i2c_client *client,
index 2ec596b..4bcb01c 100644 (file)
@@ -95,7 +95,10 @@ static const struct file_operations gps_geofence_wake_fops = {
        .poll = gps_geofence_wake_poll,
        /*.read = gps_geofence_wake_read,
        .write = gps_geofence_wake_write,*/
-       .unlocked_ioctl = gps_geofence_wake_ioctl
+       .unlocked_ioctl = gps_geofence_wake_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl = gps_geofence_wake_ioctl,
+#endif
 };
 
 static struct gps_geofence_wake geofence_wake;
index 70d033f..258a00b 100644 (file)
@@ -258,6 +258,9 @@ static long ssp_sensorhub_ioctl(struct file *file, unsigned int cmd,
 
        switch (cmd) {
        case IOCTL_READ_BIG_CONTEXT_DATA:
+#ifdef CONFIG_COMPAT
+       case IOCTL_READ_BIG_CONTEXT_DATA_COMPAT:
+#endif
                if (unlikely(!hub_data->big_events.library_data
                        || !hub_data->big_events.library_length)) {
                        sensorhub_info("no big library data");
@@ -300,6 +303,9 @@ static struct file_operations ssp_sensorhub_fops = {
        .write = ssp_sensorhub_write,
        .read = ssp_sensorhub_read,
        .unlocked_ioctl = ssp_sensorhub_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl = ssp_sensorhub_ioctl,
+#endif
 };
 
 void ssp_sensorhub_report_notice(struct ssp_data *ssp_data, char notice)
@@ -696,6 +702,9 @@ void ssp_sensorhub_remove(struct ssp_data *ssp_data)
        ssp_sensorhub_fops.write = NULL;
        ssp_sensorhub_fops.read = NULL;
        ssp_sensorhub_fops.unlocked_ioctl = NULL;
+#ifdef CONFIG_COMPAT
+       ssp_sensorhub_fops.compat_ioctl = NULL;
+#endif
 
        kthread_stop(hub_data->sensorhub_task);
        kfifo_free(&hub_data->fifo);
index 742806d..fa36b1e 100644 (file)
@@ -37,6 +37,8 @@
 
 #define SENSORHUB_IOCTL_MAGIC          'S'
 #define IOCTL_READ_BIG_CONTEXT_DATA    _IOR(SENSORHUB_IOCTL_MAGIC, 3, char *)
+#define IOCTL_READ_BIG_CONTEXT_DATA_COMPAT     \
+                                       _IOR(SENSORHUB_IOCTL_MAGIC, 3, unsigned int)
 
 #define sensorhub_info(str, args...) \
        pr_info("[SSP]: %s - " str, __func__, ##args)
index c0cd582..1c8a0dd 100644 (file)
@@ -905,6 +905,9 @@ static struct file_operations ssp_batch_fops = {
        .owner = THIS_MODULE,
        .open = nonseekable_open,
        .unlocked_ioctl = ssp_batch_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl = ssp_batch_ioctl,
+#endif
 };
 
 static void initialize_mcu_factorytest(struct ssp_data *data)