Skip to content

Commit

Permalink
removed res2 instead of res
Browse files Browse the repository at this point in the history
  • Loading branch information
vkomenda committed Apr 21, 2022
1 parent b9ed49f commit 459c4f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions XDMA/linux-kernel/xdma/cdev_sgdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void async_io_handler(unsigned long cb_hndl, int err)
struct xdma_io_cb *cb = (struct xdma_io_cb *)cb_hndl;
struct cdev_async_io *caio = (struct cdev_async_io *)cb->private;
ssize_t numbytes = 0;
ssize_t res, res2;
ssize_t res;
int lock_stat;
int rv;

Expand Down Expand Up @@ -94,22 +94,23 @@ static void async_io_handler(unsigned long cb_hndl, int err)

char_sgdma_unmap_user_buf(cb, cb->write);

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
caio->res2 |= (err < 0) ? err : 0;
if (caio->res2)
caio->err_cnt++;
#endif

caio->cmpl_cnt++;
caio->res += numbytes;

if (caio->cmpl_cnt == caio->req_cnt) {
res = caio->res;
res2 = caio->res2;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
caio->iocb->ki_complete(caio->iocb, res2);
caio->iocb->ki_complete(caio->iocb, res);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
caio->iocb->ki_complete(caio->iocb, res, res2);
caio->iocb->ki_complete(caio->iocb, res, caio->res2);
#else
aio_complete(caio->iocb, res, res2);
aio_complete(caio->iocb, res, caio->res2);
#endif
skip_tran:
spin_unlock(&caio->lock);
Expand All @@ -122,7 +123,7 @@ static void async_io_handler(unsigned long cb_hndl, int err)

skip_dev_lock:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
caio->iocb->ki_complete(caio->iocb, -EBUSY);
caio->iocb->ki_complete(caio->iocb, numbytes);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
caio->iocb->ki_complete(caio->iocb, numbytes, -EBUSY);
#else
Expand Down
2 changes: 2 additions & 0 deletions XDMA/linux-kernel/xdma/xdma_mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ struct cdev_async_io {
struct work_struct wrk_itm;
struct cdev_async_io *next;
ssize_t res;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
ssize_t res2;
#endif
int err_cnt;
};

Expand Down

0 comments on commit 459c4f9

Please sign in to comment.