long compat_msm_ion_ioctl(struct ion_client *client, unsigned int cmd, unsigned long arg) { switch (cmd) { case COMPAT_ION_IOC_CLEAN_CACHES: case COMPAT_ION_IOC_INV_CACHES: case COMPAT_ION_IOC_CLEAN_INV_CACHES: { struct compat_ion_flush_data __user *data32; struct ion_flush_data __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_ion_flush_data(data32, data); if (err) return err; return msm_ion_custom_ioctl(client, convert_cmd(cmd), (unsigned long)data); } case COMPAT_ION_IOC_PREFETCH: case COMPAT_ION_IOC_DRAIN: { struct compat_ion_prefetch_data __user *data32; struct ion_prefetch_data __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_ion_prefetch_data(data32, data); if (err) return err; return msm_ion_custom_ioctl(client, convert_cmd(cmd), (unsigned long)data); } default: if (is_compat_task()) return -ENOIOCTLCMD; else return msm_ion_custom_ioctl(client, cmd, arg); } }
long compat_qseecom_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { long ret; switch (cmd) { case COMPAT_QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ: case COMPAT_QSEECOM_IOCTL_RECEIVE_REQ: case COMPAT_QSEECOM_IOCTL_SEND_RESP_REQ: case COMPAT_QSEECOM_IOCTL_UNLOAD_APP_REQ: case COMPAT_QSEECOM_IOCTL_PERF_ENABLE_REQ: case COMPAT_QSEECOM_IOCTL_PERF_DISABLE_REQ: case COMPAT_QSEECOM_IOCTL_UNLOAD_EXTERNAL_ELF_REQ: { return qseecom_ioctl(file, convert_cmd(cmd), 0); } case COMPAT_QSEECOM_IOCTL_REGISTER_LISTENER_REQ: { struct compat_qseecom_register_listener_req __user *data32; struct qseecom_register_listener_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_register_listener_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_LOAD_APP_REQ: { struct compat_qseecom_load_img_req __user *data32; struct qseecom_load_img_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_load_img_req(data32, data); if (err) return err; ret = qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); err = compat_put_qseecom_load_img_req(data32, data); return ret ? ret : err; } case COMPAT_QSEECOM_IOCTL_SEND_CMD_REQ: { struct compat_qseecom_send_cmd_req __user *data32; struct qseecom_send_cmd_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_send_cmd_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_SEND_MODFD_CMD_REQ: { struct compat_qseecom_send_modfd_cmd_req __user *data32; struct qseecom_send_modfd_cmd_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_send_modfd_cmd_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_SET_MEM_PARAM_REQ: { struct compat_qseecom_set_sb_mem_param_req __user *data32; struct qseecom_set_sb_mem_param_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_set_sb_mem_param_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_GET_QSEOS_VERSION_REQ: { struct compat_qseecom_qseos_version_req __user *data32; struct qseecom_qseos_version_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_qseos_version_req(data32, data); if (err) return err; ret = qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); err = compat_put_qseecom_qseos_version_req(data32, data); return ret ? ret : err; } case COMPAT_QSEECOM_IOCTL_SET_BUS_SCALING_REQ: { compat_int_t __user *data32; int __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_int(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ: { struct compat_qseecom_load_img_req __user *data32; struct qseecom_load_img_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_load_img_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_APP_LOADED_QUERY_REQ: { struct compat_qseecom_qseos_app_load_query __user *data32; struct qseecom_qseos_app_load_query __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_qseos_app_load_query(data32, data); if (err) return err; ret = qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); err = compat_put_qseecom_qseos_app_load_query(data32, data); return ret ? ret : err; } case COMPAT_QSEECOM_IOCTL_SEND_CMD_SERVICE_REQ: { struct compat_qseecom_send_svc_cmd_req __user *data32; struct qseecom_send_svc_cmd_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_send_svc_cmd_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_CREATE_KEY_REQ: { struct compat_qseecom_create_key_req __user *data32; struct qseecom_create_key_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_create_key_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_WIPE_KEY_REQ: { struct compat_qseecom_wipe_key_req __user *data32; struct qseecom_wipe_key_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_wipe_key_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_UPDATE_KEY_USER_INFO_REQ: { struct compat_qseecom_update_key_userinfo_req __user *data32; struct qseecom_update_key_userinfo_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_update_key_userinfo_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_SAVE_PARTITION_HASH_REQ: { struct compat_qseecom_save_partition_hash_req __user *data32; struct qseecom_save_partition_hash_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_save_partition_hash_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_IOCTL_IS_ES_ACTIVATED_REQ: { struct compat_qseecom_is_es_activated_req __user *data32; struct qseecom_is_es_activated_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_is_es_activated_req(data32, data); if (err) return err; ret = qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); err = compat_put_qseecom_is_es_activated_req(data32, data); return ret ? ret : err; } case COMPAT_QSEECOM_IOCTL_SEND_MODFD_RESP: { struct compat_qseecom_send_modfd_listener_resp __user *data32; struct qseecom_send_modfd_listener_resp __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_send_modfd_listener_resp(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } case COMPAT_QSEECOM_QTEEC_IOCTL_OPEN_SESSION_REQ: case COMPAT_QSEECOM_QTEEC_IOCTL_CLOSE_SESSION_REQ: case COMPAT_QSEECOM_QTEEC_IOCTL_INVOKE_MODFD_CMD_REQ: { struct compat_qseecom_qteec_req __user *data32; struct qseecom_qteec_req __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_qseecom_qteec_req(data32, data); if (err) return err; return qseecom_ioctl(file, convert_cmd(cmd), (unsigned long)data); } default: return -ENOIOCTLCMD; } return 0; }