[PATCH] tpqic02.c: get rid of check_region, suser

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Sat Aug 26 2000 - 18:20:52 EST


Hi,

                Please take a look and consider applying.

                        - Arnaldo

--- linux-2.4.0-test7/drivers/char/tpqic02.c Thu Jul 13 01:58:42 2000
+++ linux-2.4.0-test7.acme/drivers/char/tpqic02.c Sat Aug 26 20:18:29 2000
@@ -30,6 +30,8 @@
  *
  * You are not allowed to change this line nor the text above.
  *
+ * 2000/08/26 s/suser/capable/, get rid or check_region (acme)
+ *
  * 1996/10/10 Emerald changes
  *
  * 1996/05/21 Misc changes+merges+cleanups + I/O reservations
@@ -2198,7 +2200,7 @@
 
     if (MINOR(dev)==255) /* special case for resetting */
     {
- if (suser())
+ if (capable(CAP_SYS_ADMIN))
         {
             return (tape_reset(1)==TE_OK) ? -EAGAIN : -ENXIO;
         }
@@ -2607,7 +2609,7 @@
         
         CHECK_IOC_SIZE(mtconfiginfo);
         
- if (!suser())
+ if (!capable(CAP_SYS_ADMIN))
         {
             return -EPERM;
         }
@@ -2802,7 +2804,7 @@
      * the config parameters have been set using MTSETCONFIG.
      */
 
- if (check_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE))
+ 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);
@@ -2814,6 +2816,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;
     }
 
@@ -2823,11 +2826,10 @@
         printk(TPQIC02_NAME ": 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. */
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:18 EST