return result;\r
}\r
\r
-\r
+#ifdef CONFIG_HAS_EARLYSUSPEND\r
static void sensor_suspend(struct early_suspend *h)\r
{\r
struct sensor_private_data *sensor = \r
if(sensor->ops->resume)\r
sensor->ops->resume(sensor->client);\r
}\r
+#endif\r
\r
static int gsensor_dev_open(struct inode *inode, struct file *file)\r
{\r
break;\r
default:\r
break;\r
- }
-
- switch (cmd) {
+ }\r
+\r
+ switch (cmd) {\r
case GSENSOR_IOCTL_START: \r
DBG("%s:GSENSOR_IOCTL_START start,status=%d\n", __func__,sensor->status_cur);\r
mutex_lock(&sensor->operation_mutex); \r
mutex_unlock(&sensor->operation_mutex);\r
DBG("%s:GSENSOR_IOCTL_START OK\n", __func__);\r
break;\r
-
+\r
case GSENSOR_IOCTL_CLOSE: \r
DBG("%s:GSENSOR_IOCTL_CLOSE start,status=%d\n", __func__,sensor->status_cur);\r
mutex_lock(&sensor->operation_mutex); \r
\r
mutex_unlock(&sensor->operation_mutex); \r
break;\r
-
+\r
case GSENSOR_IOCTL_APP_SET_RATE: \r
DBG("%s:GSENSOR_IOCTL_APP_SET_RATE start\n", __func__); \r
mutex_lock(&sensor->operation_mutex); \r
default:\r
result = -ENOTTY;\r
goto error;\r
- }
-
- switch (cmd) {
+ }\r
+\r
+ switch (cmd) {\r
case GSENSOR_IOCTL_GETDATA:\r
if ( copy_to_user(argp, &axis, sizeof(axis) ) ) {\r
printk("failed to copy sense data to user space.");\r
goto error;\r
} \r
DBG("%s:GSENSOR_IOCTL_GETDATA OK\n", __func__);\r
- break;
- default:
- break;
+ break;\r
+ default:\r
+ break;\r
}\r
\r
error:\r
return result;\r
}\r
\r
-static ssize_t gsensor_set_orientation_online(struct device *dev,\r
- struct device_attribute *attr, char *buf)\r
+static ssize_t gsensor_set_orientation_online(struct class *class,\r
+ struct class_attribute *attr, const char *buf, size_t count)\r
{\r
int i=0;\r
char orientation[20];\r
+ char *tmp;\r
\r
struct sensor_private_data *sensor = g_sensor[SENSOR_TYPE_ACCEL];\r
struct sensor_platform_data *pdata = sensor->pdata;\r
int end = strcspn(p,"}");\r
\r
strncpy(orientation,p+start,end-start+1);\r
- char *tmp = orientation;\r
+ tmp = orientation;\r
\r
\r
while(strncmp(tmp,"}",1)!=0)\r
\r
}\r
\r
-static CLASS_ATTR(orientation, 0660, NULL,gsensor_set_orientation_online);\r
+static CLASS_ATTR(orientation, 0660, NULL, gsensor_set_orientation_online);\r
\r
static int gsensor_class_init(void)\r
{\r
\r
switch(cmd)\r
{\r
- case LIGHTSENSOR_IOCTL_GET_ENABLED:
+ case LIGHTSENSOR_IOCTL_GET_ENABLED:\r
*argp = sensor->status_cur;\r
- break;
+ break;\r
case LIGHTSENSOR_IOCTL_ENABLE: \r
DBG("%s:LIGHTSENSOR_IOCTL_ENABLE start\n", __func__);\r
mutex_lock(&sensor->operation_mutex); \r
{\r
case PSENSOR_IOCTL_GET_ENABLED:\r
*argp = sensor->status_cur;\r
- break;
+ break;\r
case PSENSOR_IOCTL_ENABLE: \r
DBG("%s:PSENSOR_IOCTL_ENABLE start\n", __func__);\r
mutex_lock(&sensor->operation_mutex); \r
\r
}\r
sensor->input_dev->dev.parent = &client->dev;\r
-
+\r
result = input_register_device(sensor->input_dev);\r
if (result) {\r
dev_err(&client->dev,\r
\r
static void sensor_shut_down(struct i2c_client *client)\r
{\r
+#ifdef CONFIG_HAS_EARLYSUSPEND\r
struct sensor_private_data *sensor =\r
(struct sensor_private_data *) i2c_get_clientdata(client);\r
if((sensor->ops->suspend) && (sensor->ops->resume)) \r
unregister_early_suspend(&sensor->early_suspend);\r
DBG("%s:%s\n",__func__,sensor->i2c_id->name);\r
+#endif\r
}\r
\r
static int sensor_remove(struct i2c_client *client)\r
kfree(sensor);\r
#ifdef CONFIG_HAS_EARLYSUSPEND\r
if((sensor->ops->suspend) && (sensor->ops->resume))\r
- unregister_early_suspend(&sensor->early_suspend);\r
+ unregister_early_suspend(&sensor->early_suspend);\r
#endif \r
return result;\r
}\r