/** * IO Control - handle commands from client. * */ static int dsps_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int ret = 0; u32 val = 0; pr_debug("%s.\n", __func__); switch (cmd) { case DSPS_IOCTL_ON: ret = dsps_power_on_handler(); dsps_resume(); break; case DSPS_IOCTL_OFF: dsps_suspend(); ret = dsps_power_off_handler(); break; case DSPS_IOCTL_READ_SLOW_TIMER: val = dsps_read_slow_timer(); ret = put_user(val, (u32 __user *) arg); break; case DSPS_IOCTL_READ_FAST_TIMER: val = dsps_read_fast_timer(); ret = put_user(val, (u32 __user *) arg); break; default: ret = -EINVAL; break; } return ret; }
static long dsps_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret = 0; u32 val = 0; pr_debug("%s.\n", __func__); switch (cmd) { case DSPS_IOCTL_ON: if (!drv->pdata->dsps_pwr_ctl_en) { ret = dsps_power_on_handler(); dsps_resume(); } break; case DSPS_IOCTL_OFF: if (!drv->pdata->dsps_pwr_ctl_en) { dsps_suspend(); ret = dsps_power_off_handler(); } break; case DSPS_IOCTL_READ_SLOW_TIMER: val = dsps_read_slow_timer(); ret = put_user(val, (u32 __user *) arg); break; case DSPS_IOCTL_READ_FAST_TIMER: val = dsps_read_fast_timer(); ret = put_user(val, (u32 __user *) arg); break; case DSPS_IOCTL_RESET: pr_err("%s: User-initiated DSPS reset.\nResetting DSPS\n", __func__); subsystem_restart("dsps"); ret = 0; break; default: ret = -EINVAL; break; } return ret; }