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 08a8f9453192da8ef7b14e0d1fc22f4eff521cbb..b1475de1686c9680afd4bc78e3b7fae65df5bf79 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 2ec596be3ce6f82b253d0c3a87154a7b6e7efea3..4bcb01c4bee53cb1bad09e509a06e51f32b63649 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 70d033fc958eff349f6a70619b1560c2324b3390..258a00b3044046c7e2c9825a396364f7aeaa8790 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 742806d3679cd1ee6092d2ecb84fe86192e79675..fa36b1e0bb2e8ee3cff153ec50e102ad58c245a0 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 c0cd582ac686d76eba7c3cdf7986f5ac64def35c..1c8a0dd488c037904a42b3733c65aa30b7fca6e0 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)