Commit 99640fa5 authored by A. Hahn's avatar A. Hahn

wishbone: added support for kernel 4.x

parent 372ebdde
......@@ -43,7 +43,7 @@
#define API 8
#endif
#if API <= 7
#if API <= 8
static const struct usb_device_id id_table[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(0x1D50, 0x6062, 0xFF, 0xFF, 0xFF) },
......
......@@ -28,7 +28,7 @@ static DEFINE_MUTEX(wishbone_mutex);
static struct class *wishbone_master_class;
static dev_t wishbone_master_dev_first;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,30)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,30) || LINUX_VERSION_CODE > KERNEL_VERSION(3,1,19)
/* missing 'const' in 2.6.30. present in 2.6.31. */
static int compat_memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
......@@ -56,6 +56,7 @@ static int compat_memcpy_fromiovecend(unsigned char *kdata, const struct iovec *
}
/* does not exist in 2.6.30. does in 2.6.31. */
static int compat_memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata,
int offset, int len)
......@@ -524,6 +525,8 @@ static ssize_t char_master_aio_read(struct kiocb *iocb, const struct iovec *iov,
return len;
}
static ssize_t char_master_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos)
{
struct file *filep = iocb->ki_filp;
......@@ -591,6 +594,23 @@ static int char_master_fasync(int fd, struct file *file, int on)
return fasync_helper(fd, file, on, &context->fasync);
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(4,1,0)
static ssize_t char_master_aio_read_iter(struct kiocb *iocb, struct iov_iter *iter)
{
return char_master_aio_read(iocb, iter->iov, iter->nr_segs, iter->iov_offset);
}
static ssize_t char_master_aio_write_iter(struct kiocb *iocb, struct iov_iter *iter)
{
return char_master_aio_write(iocb, iter->iov, iter->nr_segs, iter->iov_offset);
}
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,1,0)
static const struct file_operations etherbone_master_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
......@@ -604,6 +624,26 @@ static const struct file_operations etherbone_master_fops = {
.fasync = char_master_fasync,
};
#else
static const struct file_operations etherbone_master_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
//.read = new_sync_read,
.read_iter = char_master_aio_read_iter,
//.write = new_sync_write,
.write_iter = char_master_aio_write_iter,
.open = char_master_open,
.poll = char_master_poll,
.release = char_master_release,
.fasync = char_master_fasync,
};
#endif
//ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
//ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
int wishbone_register(struct wishbone* wb)
{
struct list_head *list_pos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment