>
> +
>
> +static ssize_t ar1520_read(struct file *file,
>
> +      char __user *buf, size_t count, loff_t *offset)
>
> +{
>
> +      int n = count;
>
> +      int rt = 0;
>
> +      int ret, cf;
>
> +      struct ar1520_data *data = file->private_data;
>
> +
>
> +      PPDEBUG(AR1520_DBG_INFO, "%s start\n", __func__);
>
> +      /* limit max read oeration size to 8K */
>
> +      if (count > 8192)
>
> +              count = 8192;
>
> +      /* allocate buffer, return error if impossible*/
>
> +      data->tmp_buf = kmalloc(count, GFP_KERNEL);
>
> +      if (data->tmp_buf == NULL)
>
> +              return -ENOMEM;
>
> +      if (file->f_flags & O_NONBLOCK) {
>
> +              ret = mutex_lock_interruptible(&data->wr_mutex);
>
> +              if (ret) {
>
> +                      ret = -ERESTARTSYS;
>
> +                      return report_reading_error(data, ret, 0);
>
> +              }
>
> +
>
> +              ret = i2c_master_recv(data->i2c_client,
>
> +                      &data->tmp_buf[rt], n);
>
> +              mutex_unlock(&data->wr_mutex);
>
> +              if (ret < 0) {
>
> +                      /* reading error happened, report proper code */
>
> +                      return report_reading_error(data, ret, 0);
>
>
>
Please check the value of n; if the value of n is lager than 8192, it might
be a problem on "i2c_master_recv" function.
_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to