From: Adrian M. <ad...@mc...> - 2002-01-26 11:45:10
|
This patch merely cleans up some (more) dead code, it should not have any impact on the functuality, (though the open command should execute a bit faster, but that is not a performance critical issue for this driver). Given the minor nature of this I will commit to the CVS in the next few hours - I've tested it already - but anyone spots an error please let me know ASAP. Adrian --- main.c Fri Jan 18 19:08:42 2002 +++ aica.c Sat Jan 26 11:36:22 2002 @@ -31,7 +31,6 @@ #include <linux/ioctl.h> #include <asm/semaphore.h> #include <asm/dc_sysasic.h> - #include "../sound_config.h" #include "arm7.h" //static array of ARM 7 code @@ -43,14 +42,10 @@ #define AICA_CMD_VOL 3 /* Sound modes */ - #define SM_8BIT 1 #define SM_16BIT 0 #define SM_ADPCM 2 -#define _BUILD_DEBUG_ - - #ifdef _BUILD_DEBUG_ #define DEBGM(fmt, args...) (printk(KERN_ERR fmt, ##args)) @@ -269,49 +264,23 @@ static aica_dev_t *aica_dev_list; - -static struct aica_dev *aica_walk_devlist(void) -{ - //first get the current device - walking the device list - aica_dev_t *devc = aica_dev_list; - if (!devc) { - DEBGM("Failed to get an AICA device in walk through\n"); - return NULL; // for some reason it doesn't exist - } - while (devc->next_dev != NULL) - devc = devc->next_dev; - return devc; -} - - - - static int aica_audio_open(struct inode *inode, struct file *file) { - - aica_dev_t *devc; dev_t minor = MINOR(inode->i_rdev); MOD_INC_USE_COUNT; + /* open the channel * locking the memory as appropriate - * - * first get the current device - walking the list */ - - devc = aica_walk_devlist(); - if (!devc) { - MOD_DEC_USE_COUNT; - DEBGM("AICA: Could not walk list\n"); - return -ENODEV; - } + devc = aica_dev_list; + if (down_interruptible(&dsp_mutex)) return -ERESTARTSYS; //Lock channels 1 & 2 request_mem_region(0xa0700000, 0x100, "AICA Channels"); - //sample type - based on which device has been opened chanh = kmalloc(sizeof(aica_channel), GFP_KERNEL); if (chanh == NULL) @@ -334,7 +303,6 @@ return -EINVAL; } - devc->last_write_length = 0; file->private_data = devc; @@ -388,7 +356,6 @@ (devc-> open_wait), 1); - spu_write_wait(); playpoint = readl(0xa0810004 + 4); if ((playpoint * samplelength) > currentpoint) @@ -495,7 +462,6 @@ const char *buffer, size_t count, loff_t * ppos) { - aica_dev_t *devc = (aica_dev_t *) (file->private_data); stereo = chanh->flags & 1; BUFFER = kmalloc(count, GFP_KERNEL); @@ -726,9 +692,6 @@ } - - - static struct file_operations aica_audio_fops = { owner:THIS_MODULE, open:aica_audio_open, @@ -794,11 +757,10 @@ ioctl:aica_mixer_ioctl, }; - static int __init attach_aica(void) { printk - ("AICA audio device driver for Dreamcast Linux - ver 0.1-pre13\n"); + ("AICA audio device driver for Dreamcast Linux - ver 0.1-pre14\n"); //initialise data holder for device aica_dev_t *devc = NULL; sema_init(&dsp_mutex, 1); @@ -873,7 +835,6 @@ return 0; } - static int __init init_aica(void) { @@ -906,9 +867,6 @@ return 0; } - - - static void __exit exit_aica(void) { //set low bit of register to 1 @@ -928,16 +886,8 @@ } - - - - module_init(init_aica); module_exit(exit_aica); - - - - MODULE_AUTHOR("Adrian McMenamin"); MODULE_DESCRIPTION("Basic OSS sound driver for Linux/DC"); |