X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Foss%2Fmaestro3.c;h=4a5e4237a1106af30e0c7e08a93002bf6981e848;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=c27e88f476f2237ade09ade4056196ad3afed033;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c index c27e88f47..4a5e4237a 100644 --- a/sound/oss/maestro3.c +++ b/sound/oss/maestro3.c @@ -144,6 +144,8 @@ #include #include #include +#include + #include #include @@ -205,7 +207,7 @@ struct m3_state { when irqhandler uses s->lock and m3_assp_read uses card->lock ? */ - struct semaphore open_sem; + struct mutex open_mutex; wait_queue_head_t open_wait; mode_t open_mode; @@ -375,10 +377,10 @@ static struct m3_card *devs; * I'm not very good at laying out functions in a file :) */ static int m3_notifier(struct notifier_block *nb, unsigned long event, void *buf); -static int m3_suspend(struct pci_dev *pci_dev, u32 state); +static int m3_suspend(struct pci_dev *pci_dev, pm_message_t state); static void check_suspend(struct m3_card *card); -struct notifier_block m3_reboot_nb = { +static struct notifier_block m3_reboot_nb = { .notifier_call = m3_notifier, }; @@ -1024,8 +1026,8 @@ static void set_dmac(struct m3_state *s, unsigned int addr, unsigned int count) DPRINTK(DPINT,"set_dmac??\n"); } -u32 get_dma_pos(struct m3_card *card, - int instance_addr) +static u32 get_dma_pos(struct m3_card *card, + int instance_addr) { u16 hi = 0, lo = 0; int retry = 10; @@ -1047,7 +1049,7 @@ u32 get_dma_pos(struct m3_card *card, return lo | (hi<<16); } -u32 get_dmaa(struct m3_state *s) +static u32 get_dmaa(struct m3_state *s) { u32 offset; @@ -1059,7 +1061,7 @@ u32 get_dmaa(struct m3_state *s) return offset; } -u32 get_dmac(struct m3_state *s) +static u32 get_dmac(struct m3_state *s) { u32 offset; @@ -1557,7 +1559,9 @@ static int m3_mmap(struct file *file, struct vm_area_struct *vma) * ask Jeff what the hell I'm doing wrong. */ ret = -EAGAIN; - if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) + if (remap_pfn_range(vma, vma->vm_start, + virt_to_phys(db->rawbuf) >> PAGE_SHIFT, + size, vma->vm_page_prot)) goto out; db->mapped = 1; @@ -2011,17 +2015,17 @@ static int m3_open(struct inode *inode, struct file *file) file->private_data = s; /* wait for device to become free */ - down(&s->open_sem); + mutex_lock(&s->open_mutex); while (s->open_mode & file->f_mode) { if (file->f_flags & O_NONBLOCK) { - up(&s->open_sem); + mutex_unlock(&s->open_mutex); return -EWOULDBLOCK; } - up(&s->open_sem); + mutex_unlock(&s->open_mutex); interruptible_sleep_on(&s->open_wait); if (signal_pending(current)) return -ERESTARTSYS; - down(&s->open_sem); + mutex_lock(&s->open_mutex); } spin_lock_irqsave(&c->lock, flags); @@ -2045,7 +2049,7 @@ static int m3_open(struct inode *inode, struct file *file) set_fmt(s, fmtm, fmts); s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); - up(&s->open_sem); + mutex_unlock(&s->open_mutex); spin_unlock_irqrestore(&c->lock, flags); return nonseekable_open(inode, file); } @@ -2060,7 +2064,7 @@ static int m3_release(struct inode *inode, struct file *file) if (file->f_mode & FMODE_WRITE) drain_dac(s, file->f_flags & O_NONBLOCK); - down(&s->open_sem); + mutex_lock(&s->open_mutex); spin_lock_irqsave(&card->lock, flags); if (file->f_mode & FMODE_WRITE) { @@ -2081,7 +2085,7 @@ static int m3_release(struct inode *inode, struct file *file) s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE); spin_unlock_irqrestore(&card->lock, flags); - up(&s->open_sem); + mutex_unlock(&s->open_mutex); wake_up(&s->open_wait); return 0; @@ -2100,7 +2104,7 @@ static int m3_ac97_wait(struct m3_card *card) return i == 0; } -u16 m3_ac97_read(struct ac97_codec *codec, u8 reg) +static u16 m3_ac97_read(struct ac97_codec *codec, u8 reg) { u16 ret = 0; struct m3_card *card = codec->private_data; @@ -2127,7 +2131,7 @@ out: return ret; } -void m3_ac97_write(struct ac97_codec *codec, u8 reg, u16 val) +static void m3_ac97_write(struct ac97_codec *codec, u8 reg, u16 val) { struct m3_card *card = codec->private_data; @@ -2185,7 +2189,7 @@ static struct file_operations m3_mixer_fops = { .release = m3_release_mixdev, }; -void remote_codec_config(int io, int isremote) +static void remote_codec_config(int io, int isremote) { isremote = isremote ? 1 : 0; @@ -2569,7 +2573,7 @@ static struct file_operations m3_audio_fops = { }; #ifdef CONFIG_PM -int alloc_dsp_suspendmem(struct m3_card *card) +static int alloc_dsp_suspendmem(struct m3_card *card) { int len = sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH); @@ -2578,15 +2582,9 @@ int alloc_dsp_suspendmem(struct m3_card *card) return 0; } -void free_dsp_suspendmem(struct m3_card *card) -{ - if(card->suspend_mem) - vfree(card->suspend_mem); -} #else #define alloc_dsp_suspendmem(args...) 0 -#define free_dsp_suspendmem(args...) #endif /* @@ -2677,7 +2675,7 @@ static int __devinit m3_probe(struct pci_dev *pci_dev, const struct pci_device_i init_waitqueue_head(&s->dma_adc.wait); init_waitqueue_head(&s->dma_dac.wait); init_waitqueue_head(&s->open_wait); - init_MUTEX(&(s->open_sem)); + mutex_init(&(s->open_mutex)); s->magic = M3_STATE_MAGIC; m3_assp_client_init(s); @@ -2713,7 +2711,7 @@ out: if(ret) { if(card->iobase) release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - free_dsp_suspendmem(card); + vfree(card->suspend_mem); if(card->ac97) { unregister_sound_mixer(card->ac97->dev_mixer); kfree(card->ac97); @@ -2756,7 +2754,7 @@ static void m3_remove(struct pci_dev *pci_dev) } release_region(card->iobase, 256); - free_dsp_suspendmem(card); + vfree(card->suspend_mem); kfree(card); } devs = NULL; @@ -2775,12 +2773,12 @@ static int m3_notifier(struct notifier_block *nb, unsigned long event, void *buf for(card = devs; card != NULL; card = card->next) { if(!card->in_suspend) - m3_suspend(card->pcidev, 3); /* XXX legal? */ + m3_suspend(card->pcidev, PMSG_SUSPEND); /* XXX legal? */ } return 0; } -static int m3_suspend(struct pci_dev *pci_dev, u32 state) +static int m3_suspend(struct pci_dev *pci_dev, pm_message_t state) { unsigned long flags; int i; @@ -2917,10 +2915,10 @@ MODULE_DESCRIPTION("ESS Maestro3/Allegro Driver"); MODULE_LICENSE("GPL"); #ifdef M_DEBUG -MODULE_PARM(debug,"i"); +module_param(debug, int, 0); #endif -MODULE_PARM(external_amp,"i"); -MODULE_PARM(gpio_pin, "i"); +module_param(external_amp, int, 0); +module_param(gpio_pin, int, 0); static struct pci_driver m3_pci_driver = { .name = "ess_m3_audio", @@ -2940,8 +2938,7 @@ static int __init m3_init_module(void) return -ENODEV; /* ? */ } - if (!pci_register_driver(&m3_pci_driver)) { - pci_unregister_driver(&m3_pci_driver); + if (pci_register_driver(&m3_pci_driver)) { unregister_reboot_notifier(&m3_reboot_nb); return -ENODEV; }