patch-2.4.19 linux-2.4.19/drivers/char/tpqic02.c
Next file: linux-2.4.19/drivers/char/tty_io.c
Previous file: linux-2.4.19/drivers/char/sysrq.c
Back to the patch index
Back to the overall index
- Lines: 60
- Date:
Fri Aug 2 17:39:43 2002
- Orig file:
linux-2.4.18/drivers/char/tpqic02.c
- Orig date:
Fri Sep 14 14:40:00 2001
diff -urN linux-2.4.18/drivers/char/tpqic02.c linux-2.4.19/drivers/char/tpqic02.c
@@ -1944,12 +1944,8 @@
}
/* copy buffer to user-space in one go */
if (bytes_done > 0) {
- err =
- copy_to_user(buf, buffaddr,
- bytes_done);
- if (err) {
+ if (copy_to_user(buf, buffaddr, bytes_done))
return -EFAULT;
- }
}
#if 1
/* Checks Ton's patch below */
@@ -2085,10 +2081,8 @@
/* copy from user to DMA buffer and initiate transfer. */
if (bytes_todo > 0) {
- err = copy_from_user(buffaddr, buf, bytes_todo);
- if (err) {
+ if (copy_from_user(buffaddr, buf, bytes_todo))
return -EFAULT;
- }
/****************** similar problem with read() at FM could happen here at EOT.
******************/
@@ -2750,7 +2744,9 @@
* the config parameters have been set using MTSETCONFIG.
*/
- if (check_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE)) {
+ /* Grab the IO region. */
+ if (!request_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE,
+ TPQIC02_NAME)) {
printk(TPQIC02_NAME
": IO space at 0x%x [%d ports] already reserved\n",
QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
@@ -2764,6 +2760,7 @@
printk(TPQIC02_NAME
": can't allocate IRQ%d for QIC-02 tape\n",
QIC02_TAPE_IRQ);
+ release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
return -EBUSY;
}
@@ -2773,13 +2770,10 @@
": can't allocate DMA%d for QIC-02 tape\n",
QIC02_TAPE_DMA);
free_irq(QIC02_TAPE_IRQ, NULL);
+ release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
return -EBUSY;
}
- /* Grab the IO region. We already made sure it's available. */
- request_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE,
- TPQIC02_NAME);
-
/* Setup the page-address for the dma transfer. */
buffaddr =
(void *) __get_dma_pages(GFP_KERNEL, get_order(TPQBUF_SIZE));
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)