Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: kpc2000: removed DMA AIO implementation.

The existing implementation for doing DMA via asynchronous IO didn't
work and there was no longer a use-case for it. Removed it.

Fixed a few checkpatch warnings about too-long lines and extraneous
braces in the process.

Reported-by: Matt Sickler <matt.sickler@daktronics.com>
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jeremy Sowden and committed by
Greg Kroah-Hartman
c77a6794 eafae15f

+21 -86
-3
drivers/staging/kpc2000/TODO
··· 1 1 - the kpc_spi driver doesn't seem to let multiple transactions (to different instances of the core) happen in parallel... 2 2 - The kpc_i2c driver is a hot mess, it should probably be cleaned up a ton. It functions against current hardware though. 3 - - would be nice if the AIO fileops in kpc_dma could be made to work 4 - - probably want to add a CONFIG_ option to control compilation of the AIO functions 5 - - if the AIO fileops in kpc_dma start working, next would be making iov_count > 1 work too
+21 -81
drivers/staging/kpc2000/kpc_dma/fileops.c
··· 9 9 #include <linux/types.h> /* size_t */ 10 10 #include <linux/cdev.h> 11 11 #include <linux/uaccess.h> /* copy_*_user */ 12 - #include <linux/aio.h> /* aio stuff */ 13 12 #include <linux/highmem.h> 14 13 #include <linux/pagemap.h> 15 14 #include "kpc_dma_driver.h" ··· 31 32 } 32 33 33 34 /********** Transfer Helpers **********/ 34 - static 35 - int kpc_dma_transfer(struct dev_private_data *priv, struct kiocb *kcb, unsigned long iov_base, size_t iov_len) 35 + static int kpc_dma_transfer(struct dev_private_data *priv, 36 + unsigned long iov_base, size_t iov_len) 36 37 { 37 38 unsigned int i = 0; 38 39 long rv = 0; ··· 64 65 acd->ldev = priv->ldev; 65 66 acd->cpl = &done; 66 67 acd->flags = 0; 67 - acd->kcb = kcb; 68 68 acd->len = iov_len; 69 69 acd->page_count = count_pages(iov_base, iov_len); 70 70 ··· 171 173 172 174 unlock_engine(ldev); 173 175 174 - // If this is a synchronous kiocb, we need to put the calling process to sleep until the transfer is complete 175 - if (kcb == NULL || is_sync_kiocb(kcb)) { 176 - rv = wait_for_completion_interruptible(&done); 177 - // If the user aborted (rv == -ERESTARTSYS), we're no longer responsible for cleaning up the acd 178 - if (rv == -ERESTARTSYS) { 179 - acd->cpl = NULL; 180 - } 181 - if (rv == 0) { 182 - rv = acd->len; 183 - kfree(acd); 184 - } 185 - return rv; 176 + rv = wait_for_completion_interruptible(&done); 177 + /* 178 + * If the user aborted (rv == -ERESTARTSYS), we're no longer responsible 179 + * for cleaning up the acd 180 + */ 181 + if (rv == -ERESTARTSYS) 182 + acd->cpl = NULL; 183 + if (rv == 0) { 184 + rv = acd->len; 185 + kfree(acd); 186 186 } 187 - 188 - return -EIOCBQUEUED; 187 + return rv; 189 188 190 189 err_descr_too_many: 191 190 unlock_engine(ldev); ··· 229 234 230 235 acd->flags = flags; 231 236 232 - if (acd->kcb == NULL || is_sync_kiocb(acd->kcb)) { 233 - if (acd->cpl) { 234 - complete(acd->cpl); 235 - } else { 236 - // There's no completion, so we're responsible for cleaning up the acd 237 - kfree(acd); 238 - } 237 + if (acd->cpl) { 238 + complete(acd->cpl); 239 239 } else { 240 - #ifdef CONFIG_KPC_DMA_AIO 241 - aio_complete(acd->kcb, acd->len, acd->flags); 242 - #endif 240 + /* 241 + * There's no completion, so we're responsible for cleaning up 242 + * the acd 243 + */ 243 244 kfree(acd); 244 245 } 245 246 } ··· 299 308 return 0; 300 309 } 301 310 302 - #ifdef CONFIG_KPC_DMA_AIO 303 - static 304 - int kpc_dma_aio_cancel(struct kiocb *kcb) 305 - { 306 - struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data; 307 - 308 - dev_dbg(&priv->ldev->pldev->dev, "%s(kcb = [%p]) priv = [%p], ldev = [%p]\n", __func__, kcb, priv, priv->ldev); 309 - return 0; 310 - } 311 - 312 - static 313 - ssize_t kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov, unsigned long iov_count, loff_t pos) 314 - { 315 - struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data; 316 - 317 - if (priv->ldev->dir != DMA_FROM_DEVICE) 318 - return -EMEDIUMTYPE; 319 - 320 - if (iov_count != 1) { 321 - dev_err(&priv->ldev->pldev->dev, "%s() called with iov_count > 1!\n", __func__); 322 - return -EFAULT; 323 - } 324 - 325 - if (!is_sync_kiocb(kcb)) 326 - kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel); 327 - return kpc_dma_transfer(priv, kcb, (unsigned long)iov->iov_base, iov->iov_len); 328 - } 329 - 330 - static 331 - ssize_t kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov, unsigned long iov_count, loff_t pos) 332 - { 333 - struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data; 334 - 335 - if (priv->ldev->dir != DMA_TO_DEVICE) 336 - return -EMEDIUMTYPE; 337 - 338 - if (iov_count != 1) { 339 - dev_err(&priv->ldev->pldev->dev, "%s() called with iov_count > 1!\n", __func__); 340 - return -EFAULT; 341 - } 342 - 343 - if (!is_sync_kiocb(kcb)) 344 - kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel); 345 - return kpc_dma_transfer(priv, kcb, (unsigned long)iov->iov_base, iov->iov_len); 346 - } 347 - #endif 348 - 349 311 static 350 312 ssize_t kpc_dma_read(struct file *filp, char __user *user_buf, size_t count, loff_t *ppos) 351 313 { ··· 307 363 if (priv->ldev->dir != DMA_FROM_DEVICE) 308 364 return -EMEDIUMTYPE; 309 365 310 - return kpc_dma_transfer(priv, (struct kiocb *)NULL, (unsigned long)user_buf, count); 366 + return kpc_dma_transfer(priv, (unsigned long)user_buf, count); 311 367 } 312 368 313 369 static ··· 318 374 if (priv->ldev->dir != DMA_TO_DEVICE) 319 375 return -EMEDIUMTYPE; 320 376 321 - return kpc_dma_transfer(priv, (struct kiocb *)NULL, (unsigned long)user_buf, count); 377 + return kpc_dma_transfer(priv, (unsigned long)user_buf, count); 322 378 } 323 379 324 380 static ··· 346 402 .release = kpc_dma_close, 347 403 .read = kpc_dma_read, 348 404 .write = kpc_dma_write, 349 - #ifdef CONFIG_KPC_DMA_AIO 350 - .aio_read = kpc_dma_aio_read, 351 - .aio_write = kpc_dma_aio_write, 352 - #endif 353 405 .unlocked_ioctl = kpc_dma_ioctl, 354 406 }; 355 407
-2
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.h
··· 14 14 #include <linux/pci.h> 15 15 #include <linux/interrupt.h> 16 16 #include <linux/workqueue.h> 17 - #include <linux/aio.h> 18 17 #include <linux/bitops.h> 19 18 #include "../kpc.h" 20 19 ··· 86 87 struct kpc_dma_device *ldev; 87 88 struct completion *cpl; 88 89 unsigned char flags; 89 - struct kiocb *kcb; 90 90 size_t len; 91 91 92 92 unsigned int page_count;