diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 0a98517f3959..0385476bfb03 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -113,7 +113,7 @@ enum sbe_state #define SBEFIFO_TIMEOUT_IN_RSP 1000 /* Other constants */ -#define SBEFIFO_MAX_USER_CMD_LEN (0x100000 + PAGE_SIZE) +#define SBEFIFO_MAX_USER_CMD_LEN (0x400000 + PAGE_SIZE) #define SBEFIFO_RESET_MAGIC 0x52534554 /* "RSET" */ struct sbefifo { @@ -882,6 +882,13 @@ static ssize_t sbefifo_user_write(struct file *file, const char __user *buf, mutex_lock(&user->file_lock); + /* If previous write command is still pending then free it. It is safe + * to do that because read cannot be in progress since we hold the + * lock. + */ + if (user->pending_cmd) + sbefifo_release_command(user); + /* Can we use the pre-allocate buffer ? If not, allocate */ if (len <= PAGE_SIZE) user->pending_cmd = user->cmd_page; diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c index cb7e02213032..8d65c562b488 100644 --- a/drivers/fsi/i2cr-scom.c +++ b/drivers/fsi/i2cr-scom.c @@ -73,9 +73,18 @@ static ssize_t i2cr_scom_write(struct file *filep, const char __user *buf, size_ return len; } +static int i2cr_scom_open(struct inode *inode, struct file *file) +{ + struct i2cr_scom *scom = container_of(inode->i_cdev, struct i2cr_scom, cdev); + + file->private_data = scom; + + return 0; +} + static const struct file_operations i2cr_scom_fops = { .owner = THIS_MODULE, - .open = simple_open, + .open = i2cr_scom_open, .llseek = i2cr_scom_llseek, .read = i2cr_scom_read, .write = i2cr_scom_write,