#include <linux/bitops.h>
#include <asm/io.h>
#include <linux/sched.h>
+#include <linux/mm.h>
#include <linux/smp_lock.h>
#include "hwaccess.h"
static void calculate_ofrag(struct woinst *);
static void calculate_ifrag(struct wiinst *);
+static void emu10k1_waveout_bh(unsigned long refdata);
+static void emu10k1_wavein_bh(unsigned long refdata);
+
/* Audio file operations */
static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
{
if ((bytestocopy >= wiinst->buffer.fragment_size)
|| (bytestocopy >= count)) {
+ int rc;
+
bytestocopy = min_t(u32, bytestocopy, count);
- emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy);
+ rc = emu10k1_wavein_xferdata(wiinst,
+ (u8 __user *)buffer,
+ &bytestocopy);
+ if (rc)
+ return rc;
count -= bytestocopy;
buffer += bytestocopy;
return dmapage;
}
-struct vm_operations_struct emu10k1_mm_ops = {
+static struct vm_operations_struct emu10k1_mm_ops = {
.nopage = emu10k1_mm_nopage,
};
match:
- wave_dev = (struct emu10k1_wavedevice *) kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL);
+ wave_dev = kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL);
if (wave_dev == NULL) {
ERROR();
/* Recording */
struct wiinst *wiinst;
- if ((wiinst = (struct wiinst *) kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) {
+ if ((wiinst = kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) {
ERROR();
kfree(wave_dev);
return -ENOMEM;
wiinst->mmapped = 0;
wiinst->total_recorded = 0;
wiinst->blocks = 0;
- wiinst->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&wiinst->lock);
tasklet_init(&wiinst->timer.tasklet, emu10k1_wavein_bh, (unsigned long) wave_dev);
wave_dev->wiinst = wiinst;
emu10k1_wavein_setformat(wave_dev, &wiinst->format);
struct woinst *woinst;
int i;
- if ((woinst = (struct woinst *) kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) {
+ if ((woinst = kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) {
ERROR();
kfree(wave_dev);
return -ENOMEM;
woinst->total_copied = 0;
woinst->total_played = 0;
woinst->blocks = 0;
- woinst->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&woinst->lock);
tasklet_init(&woinst->timer.tasklet, emu10k1_waveout_bh, (unsigned long) wave_dev);
wave_dev->woinst = woinst;
emu10k1_waveout_setformat(wave_dev, &woinst->format);
return;
}
-void emu10k1_wavein_bh(unsigned long refdata)
+static void emu10k1_wavein_bh(unsigned long refdata)
{
struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) refdata;
struct wiinst *wiinst = wave_dev->wiinst;
return;
}
-void emu10k1_waveout_bh(unsigned long refdata)
+static void emu10k1_waveout_bh(unsigned long refdata)
{
struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) refdata;
struct woinst *woinst = wave_dev->woinst;