diff options
Diffstat (limited to 'sound/usb/usx2y/usX2Yhwdep.c')
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 8abe08611df6..fc0d534ec7fc 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -67,15 +67,15 @@ static struct vm_operations_struct us428ctls_vm_ops = { | |||
67 | static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) | 67 | static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) |
68 | { | 68 | { |
69 | unsigned long size = (unsigned long)(area->vm_end - area->vm_start); | 69 | unsigned long size = (unsigned long)(area->vm_end - area->vm_start); |
70 | usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; | 70 | usX2Ydev_t *us428 = hw->private_data; |
71 | 71 | ||
72 | // FIXME this hwdep interface is used twice: fpga download and mmap for controlling Lights etc. Maybe better using 2 hwdep devs? | 72 | // FIXME this hwdep interface is used twice: fpga download and mmap for controlling Lights etc. Maybe better using 2 hwdep devs? |
73 | // so as long as the device isn't fully initialised yet we return -EBUSY here. | 73 | // so as long as the device isn't fully initialised yet we return -EBUSY here. |
74 | if (!(((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT)) | 74 | if (!(us428->chip_status & USX2Y_STAT_CHIP_INIT)) |
75 | return -EBUSY; | 75 | return -EBUSY; |
76 | 76 | ||
77 | /* if userspace tries to mmap beyond end of our buffer, fail */ | 77 | /* if userspace tries to mmap beyond end of our buffer, fail */ |
78 | if (size > ((PAGE_SIZE - 1 + sizeof(us428ctls_sharedmem_t)) / PAGE_SIZE) * PAGE_SIZE) { | 78 | if (size > PAGE_ALIGN(sizeof(us428ctls_sharedmem_t))) { |
79 | snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(us428ctls_sharedmem_t)); | 79 | snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(us428ctls_sharedmem_t)); |
80 | return -EINVAL; | 80 | return -EINVAL; |
81 | } | 81 | } |
@@ -96,7 +96,7 @@ static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_are | |||
96 | static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_table *wait) | 96 | static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_table *wait) |
97 | { | 97 | { |
98 | unsigned int mask = 0; | 98 | unsigned int mask = 0; |
99 | usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; | 99 | usX2Ydev_t *us428 = hw->private_data; |
100 | us428ctls_sharedmem_t *shm = us428->us428ctls_sharedmem; | 100 | us428ctls_sharedmem_t *shm = us428->us428ctls_sharedmem; |
101 | if (us428->chip_status & USX2Y_STAT_CHIP_HUP) | 101 | if (us428->chip_status & USX2Y_STAT_CHIP_HUP) |
102 | return POLLHUP; | 102 | return POLLHUP; |
@@ -127,9 +127,10 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i | |||
127 | [USX2Y_TYPE_224] = "us224", | 127 | [USX2Y_TYPE_224] = "us224", |
128 | [USX2Y_TYPE_428] = "us428", | 128 | [USX2Y_TYPE_428] = "us428", |
129 | }; | 129 | }; |
130 | usX2Ydev_t *us428 = hw->private_data; | ||
130 | int id = -1; | 131 | int id = -1; |
131 | 132 | ||
132 | switch (le16_to_cpu(((usX2Ydev_t*)hw->private_data)->chip.dev->descriptor.idProduct)) { | 133 | switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) { |
133 | case USB_ID_US122: | 134 | case USB_ID_US122: |
134 | id = USX2Y_TYPE_122; | 135 | id = USX2Y_TYPE_122; |
135 | break; | 136 | break; |
@@ -144,7 +145,7 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i | |||
144 | return -ENODEV; | 145 | return -ENODEV; |
145 | strcpy(info->id, type_ids[id]); | 146 | strcpy(info->id, type_ids[id]); |
146 | info->num_dsps = 2; // 0: Prepad Data, 1: FPGA Code | 147 | info->num_dsps = 2; // 0: Prepad Data, 1: FPGA Code |
147 | if (((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT) | 148 | if (us428->chip_status & USX2Y_STAT_CHIP_INIT) |
148 | info->chip_ready = 1; | 149 | info->chip_ready = 1; |
149 | info->version = USX2Y_DRIVER_VERSION; | 150 | info->version = USX2Y_DRIVER_VERSION; |
150 | return 0; | 151 | return 0; |