vserver 1.9.5.x5
[linux-2.6.git] / sound / oss / cs46xx.c
index c212b94..bc4941c 100644 (file)
 
 #if CSDEBUG
 static unsigned long cs_debuglevel=1;                  /* levels range from 1-9 */
-MODULE_PARM(cs_debuglevel, "i");
+module_param(cs_debuglevel, ulong, 0644);
 static unsigned long cs_debugmask=CS_INIT | CS_ERROR;  /* use CS_DBGOUT with various mask values */
-MODULE_PARM(cs_debugmask, "i");
+module_param(cs_debugmask, ulong, 0644);
 #endif
 static unsigned long hercules_egpio_disable;  /* if non-zero set all EGPIO to 0 */
-MODULE_PARM(hercules_egpio_disable, "i");
+module_param(hercules_egpio_disable, ulong, 0);
 static unsigned long initdelay=700;  /* PM delay in millisecs */
-MODULE_PARM(initdelay, "i");
+module_param(initdelay, ulong, 0);
 static unsigned long powerdown=-1;  /* turn on/off powerdown processing in driver */
-MODULE_PARM(powerdown, "i");
+module_param(powerdown, ulong, 0);
 #define DMABUF_DEFAULTORDER 3
 static unsigned long defaultorder=DMABUF_DEFAULTORDER;
-MODULE_PARM(defaultorder, "i");
+module_param(defaultorder, ulong, 0);
 
 static int external_amp;
-MODULE_PARM(external_amp, "i");
+module_param(external_amp, bool, 0);
 static int thinkpad;
-MODULE_PARM(thinkpad, "i");
+module_param(thinkpad, bool, 0);
 
 /*
 * set the powerdown module parm to 0 to disable all 
@@ -219,7 +219,7 @@ struct cs_channel
 #define CS46XX_ARCH            "32"    //architecture key
 #endif
 
-struct list_head cs46xx_devs = { &cs46xx_devs, &cs46xx_devs };
+static struct list_head cs46xx_devs = { &cs46xx_devs, &cs46xx_devs };
 
 /* magic numbers to protect our data structures */
 #define CS_CARD_MAGIC          0x43525553 /* "CRUS" */
@@ -346,17 +346,17 @@ struct cs_card {
        u32 irq;
        
        /* mappings */
-       void *ba0;
+       void __iomem *ba0;
        union
        {
                struct
                {
-                       u8 *data0;
-                       u8 *data1;
-                       u8 *pmem;
-                       u8 *reg;
+                       u8 __iomem *data0;
+                       u8 __iomem *data1;
+                       u8 __iomem *pmem;
+                       u8 __iomem *reg;
                } name;
-               u8 *idx[4];
+               u8 __iomem *idx[4];
        } ba1;
        
        /* Function support */
@@ -391,30 +391,9 @@ static void cs461x_clear_serial_FIFOs(struct cs_card *card, int type);
 static int cs46xx_suspend_tbl(struct pci_dev *pcidev, u32 state);
 static int cs46xx_resume_tbl(struct pci_dev *pcidev);
 
-static inline unsigned ld2(unsigned int x)
-{
-       unsigned r = 0;
-       
-       if (x >= 0x10000) {
-               x >>= 16;
-               r += 16;
-       }
-       if (x >= 0x100) {
-               x >>= 8;
-               r += 8;
-       }
-       if (x >= 0x10) {
-               x >>= 4;
-               r += 4;
-       }
-       if (x >= 4) {
-               x >>= 2;
-               r += 2;
-       }
-       if (x >= 2)
-               r++;
-       return r;
-}
+#ifndef CS46XX_ACPI_SUPPORT
+static int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
+#endif
 
 #if CSDEBUG
 
@@ -426,7 +405,7 @@ static inline unsigned ld2(unsigned int x)
 #define SOUND_MIXER_CS_SETDBGMASK      _SIOWR('M',123, int)
 #define SOUND_MIXER_CS_APM             _SIOWR('M',124, int)
 
-void printioctl(unsigned int x)
+static void printioctl(unsigned int x)
 {
     unsigned int i;
     unsigned char vidx;
@@ -964,7 +943,7 @@ static struct InitStruct
  * "SetCaptureSPValues()" -- Initialize record task values before each
  *     capture startup.  
  */
-void SetCaptureSPValues(struct cs_card *card)
+static void SetCaptureSPValues(struct cs_card *card)
 {
        unsigned i, offset;
        CS_DBGOUT(CS_FUNCTION, 8, printk("cs46xx: SetCaptureSPValues()+\n") );
@@ -1190,7 +1169,7 @@ static int alloc_dmabuf(struct cs_state *state)
        dmabuf->buforder = order;
        dmabuf->rawbuf = rawbuf;
        // Now mark the pages as reserved; otherwise the 
-       // remap_page_range() in cs46xx_mmap doesn't work.
+       // remap_pfn_range() in cs46xx_mmap doesn't work.
        // 1. get index to last page in mem_map array for rawbuf.
        mapend = virt_to_page(dmabuf->rawbuf + 
                (PAGE_SIZE << dmabuf->buforder) - 1);
@@ -1227,7 +1206,7 @@ static int alloc_dmabuf(struct cs_state *state)
        dmabuf->buforder_tmpbuff = order;
        
        // Now mark the pages as reserved; otherwise the 
-       // remap_page_range() in cs46xx_mmap doesn't work.
+       // remap_pfn_range() in cs46xx_mmap doesn't work.
        // 1. get index to last page in mem_map array for rawbuf.
        mapend = virt_to_page(dmabuf->tmpbuff + 
                (PAGE_SIZE << dmabuf->buforder_tmpbuff) - 1);
@@ -2452,7 +2431,8 @@ static int cs_mmap(struct file *file, struct vm_area_struct *vma)
                ret = -EINVAL;
                goto out;
        }
-       if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf),
+       if (remap_pfn_range(vma, vma->vm_start,
+                            virt_to_phys(dmabuf->rawbuf) >> PAGE_SHIFT,
                             size, vma->vm_page_prot))
        {
                ret = -EAGAIN;
@@ -3489,7 +3469,7 @@ static void printpm(struct cs_card *s)
 *  Suspend - save the ac97 regs, mute the outputs and power down the part.  
 *
 ****************************************************************************/
-void cs46xx_ac97_suspend(struct cs_card *card)
+static void cs46xx_ac97_suspend(struct cs_card *card)
 {
        int Count,i;
        struct ac97_codec *dev=card->ac97_codec[0];
@@ -3560,7 +3540,7 @@ void cs46xx_ac97_suspend(struct cs_card *card)
 *  Resume - power up the part and restore its registers..  
 *
 ****************************************************************************/
-void cs46xx_ac97_resume(struct cs_card *card)
+static void cs46xx_ac97_resume(struct cs_card *card)
 {
        int Count,i;
        struct ac97_codec *dev=card->ac97_codec[0];
@@ -4148,7 +4128,6 @@ match:
        return 0;
 }
 
-void __exit cs46xx_cleanup_module(void);
 static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd,
                                unsigned long arg)
 {
@@ -4308,7 +4287,7 @@ static int __init cs_ac97_init(struct cs_card *card)
 static void cs461x_download_image(struct cs_card *card)
 {
     unsigned i, j, temp1, temp2, offset, count;
-    unsigned char *pBA1 = ioremap(card->ba1_addr, 0x40000);
+    unsigned char __iomem *pBA1 = ioremap(card->ba1_addr, 0x40000);
     for( i=0; i < CLEAR__COUNT; i++)
     {
         offset = ClrStat[i].BA1__DestByteOffset;
@@ -5718,7 +5697,7 @@ static struct pci_device_id cs46xx_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, cs46xx_pci_tbl);
 
-struct pci_driver cs46xx_pci_driver = {
+static struct pci_driver cs46xx_pci_driver = {
        .name     = "cs46xx",
        .id_table = cs46xx_pci_tbl,
        .probe    = cs46xx_probe,
@@ -5727,7 +5706,7 @@ struct pci_driver cs46xx_pci_driver = {
        .resume   = CS46XX_RESUME_TBL,
 };
 
-int __init cs46xx_init_module(void)
+static int __init cs46xx_init_module(void)
 {
        int rtn = 0;
        CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, printk(KERN_INFO 
@@ -5745,7 +5724,7 @@ int __init cs46xx_init_module(void)
        return rtn;
 }
 
-void __exit cs46xx_cleanup_module(void)
+static void __exit cs46xx_cleanup_module(void)
 {
        pci_unregister_driver(&cs46xx_pci_driver);
        cs_pm_unregister_all(cs46xx_pm_callback);
@@ -5756,7 +5735,8 @@ void __exit cs46xx_cleanup_module(void)
 module_init(cs46xx_init_module);
 module_exit(cs46xx_cleanup_module);
 
-int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
+#ifndef CS46XX_ACPI_SUPPORT
+static int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
 {
        struct cs_card *card;
 
@@ -5791,6 +5771,7 @@ int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
 
        return 0;
 }
+#endif
 
 #if CS46XX_ACPI_SUPPORT
 static int cs46xx_suspend_tbl(struct pci_dev *pcidev, u32 state)