result = sensor->status_cur;\r
if (copy_to_user(argp, &result, sizeof(result)))\r
{\r
+ mutex_unlock(&sensor->operation_mutex);\r
printk("%s:failed to copy sense data to user space.\n",__FUNCTION__);\r
return -EFAULT;\r
}\r
DBG("%s:L3G4200D_IOCTL_SET_ENABLE OK\n", __func__);\r
break;\r
case L3G4200D_IOCTL_SET_DELAY: \r
- mutex_lock(&sensor->operation_mutex);\r
if (copy_from_user(&rate, argp, sizeof(rate)))\r
return -EFAULT;\r
+ mutex_lock(&sensor->operation_mutex);\r
if(sensor->status_cur == SENSOR_OFF)\r
{\r
if ( (result = sensor->ops->active(client, 1, rate) ) < 0 ) {\r
if(result < 0)\r
goto out_free_memory;\r
\r
- sensor->input_dev = input_allocate_device();\r
+ sensor->input_dev = devm_input_allocate_device(&client->dev);\r
if (!sensor->input_dev) {\r
result = -ENOMEM;\r
dev_err(&client->dev,\r
- "Failed to allocate input device %s\n", sensor->input_dev->name);\r
+ "Failed to allocate input device\n");\r
goto out_free_memory;\r
} \r
\r
return result;\r
\r
out_misc_device_register_device_failed:\r
- input_unregister_device(sensor->input_dev); \r
out_input_register_device_failed:\r
- input_free_device(sensor->input_dev); \r
out_free_memory:\r
- //kfree(sensor);\r
out_no_free:\r
dev_err(&client->adapter->dev, "%s failed %d\n\n", __func__, result);\r
return result;\r
\r
cancel_delayed_work_sync(&sensor->delaywork);\r
misc_deregister(&sensor->miscdev);\r
- input_unregister_device(sensor->input_dev); \r
- input_free_device(sensor->input_dev); \r
- kfree(sensor);\r
#ifdef CONFIG_HAS_EARLYSUSPEND\r
if((sensor->ops->suspend) && (sensor->ops->resume))\r
unregister_early_suspend(&sensor->early_suspend);\r