{
struct segdev_file *vf = file->private_data;
struct segdev *dev = segdev_get(vf->minor);
+ uint32_t portno;
int ret = -ENODEV;
if (!dev)
goto out;
- if (count > SEGDEV_BUFSIZE)
- count = SEGDEV_BUFSIZE;
+ if (count != sizeof(uint32_t))
+ goto out;
- ret = copy_from_user(dev->buffer, buf, count);
+ ret = copy_from_user(&portno, buf, sizeof(uint32_t));
if (ret < 0)
goto out;
- dev->buffer_index = count - ret;
+ if((count - ret) != sizeof(uint32_t))
+ goto out;
ret = 0;
if (dev->callback)
- dev->callback(dev);
+ dev->callback(dev, portno);
else
ret = -ENOSYS;