Update of /cvsroot/alsa/alsa-kernel/core
In directory sc8-pr-cvs1:/tmp/cvs-serv17151/core
Modified Files:
control.c info.c init.c pcm_native.c rawmidi.c rtctimer.c
timer.c
Log Message:
- rewritten with the new module functions for 2.5 kernel,
try_module_get() and module_put().
- clean up unnecessary MOD_INC_USE_COUNT and DEC_COUNT for 2.2 kernels.
Index: control.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/control.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- control.c 4 Dec 2002 09:40:45 -0000 1.23
+++ control.c 19 Dec 2002 15:59:17 -0000 1.24
@@ -40,12 +40,6 @@
static DECLARE_RWSEM(snd_ioctl_rwsem);
static LIST_HEAD(snd_control_ioctls);
-static inline void dec_mod_count(struct module *module)
-{
- if (module)
- __MOD_DEC_USE_COUNT(module);
-}
-
static int snd_ctl_open(struct inode *inode, struct file *file)
{
int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
@@ -54,9 +48,6 @@
snd_ctl_file_t *ctl;
int err;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
card = snd_cards[cardnum];
if (!card) {
err = -ENODEV;
@@ -67,7 +58,7 @@
err = -ENODEV;
goto __error1;
}
- if (!try_inc_mod_count(card->module)) {
+ if (!try_module_get(card->module)) {
err = -EFAULT;
goto __error2;
}
@@ -88,13 +79,10 @@
return 0;
__error:
- dec_mod_count(card->module);
+ module_put(card->module);
__error2:
snd_card_file_remove(card, file);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return err;
}
@@ -135,11 +123,8 @@
up_write(&card->controls_rwsem);
snd_ctl_empty_read_queue(ctl);
snd_magic_kfree(ctl);
- dec_mod_count(card->module);
+ module_put(card->module);
snd_card_file_remove(card, file);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
Index: info.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/info.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- info.c 2 Dec 2002 15:11:44 -0000 1.26
+++ info.c 19 Dec 2002 15:59:17 -0000 1.27
@@ -36,12 +36,6 @@
*
*/
-static inline void dec_mod_count(struct module *module)
-{
- if (module)
- __MOD_DEC_USE_COUNT(module);
-}
-
int snd_info_check_reserved_words(const char *str)
{
static char *reserved[] =
@@ -299,10 +293,7 @@
up(&info_mutex);
return -ENODEV;
}
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
- if (entry->module && !try_inc_mod_count(entry->module)) {
+ if (!try_module_get(entry->module)) {
err = -EFAULT;
goto __error1;
}
@@ -407,11 +398,8 @@
return 0;
__error:
- dec_mod_count(entry->module);
+ module_put(entry->module);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
up(&info_mutex);
return err;
}
@@ -450,10 +438,7 @@
data->file_private_data);
break;
}
- dec_mod_count(entry->module);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
+ module_put(entry->module);
snd_magic_kfree(data);
return 0;
}
Index: init.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/init.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- init.c 11 Dec 2002 10:37:28 -0000 1.27
+++ init.c 19 Dec 2002 15:59:17 -0000 1.28
@@ -292,9 +292,9 @@
static void snd_card_free_thread(void * __card)
{
snd_card_t *card = __card;
- struct module * module;
+ struct module * module = card->module;
- if (!try_inc_mod_count(module = card->module)) {
+ if (!try_module_get(module)) {
snd_printk(KERN_ERR "unable to lock toplevel module for card %i in
free thread\n", card->number);
module = NULL;
}
@@ -303,8 +303,7 @@
snd_card_free(card);
- if (module)
- __MOD_DEC_USE_COUNT(module);
+ module_put(module);
}
/**
Index: pcm_native.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_native.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- pcm_native.c 29 Nov 2002 21:22:24 -0000 1.39
+++ pcm_native.c 19 Dec 2002 15:59:17 -0000 1.40
@@ -76,12 +76,6 @@
set_fs(fs);
}
-static inline void dec_mod_count(struct module *module)
-{
- if (module)
- __MOD_DEC_USE_COUNT(module);
-}
-
int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info)
@@ -1787,9 +1781,6 @@
snd_pcm_file_t *pcm_file;
wait_queue_t wait;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
snd_runtime_check(device >= SNDRV_MINOR_PCM_PLAYBACK && device <
SNDRV_MINOR_DEVICES, return -ENXIO);
pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + (device %
SNDRV_MINOR_PCMS)];
if (pcm == NULL) {
@@ -1799,7 +1790,7 @@
err = snd_card_file_add(pcm->card, file);
if (err < 0)
goto __error1;
- if (!try_inc_mod_count(pcm->card->module)) {
+ if (!try_module_get(pcm->card->module)) {
err = -EFAULT;
goto __error2;
}
@@ -1833,13 +1824,10 @@
return err;
__error:
- dec_mod_count(pcm->card->module);
+ module_put(pcm->card->module);
__error2:
snd_card_file_remove(pcm->card, file);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return err;
}
@@ -1863,11 +1851,8 @@
snd_pcm_release_file(pcm_file);
up(&pcm->open_mutex);
wake_up(&pcm->open_wait);
- dec_mod_count(pcm->card->module);
+ module_put(pcm->card->module);
snd_card_file_remove(pcm->card, file);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
Index: rawmidi.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/rawmidi.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- rawmidi.c 11 Dec 2002 17:59:46 -0000 1.28
+++ rawmidi.c 19 Dec 2002 15:59:17 -0000 1.29
@@ -58,12 +58,6 @@
static DECLARE_MUTEX(register_mutex);
-static inline void dec_mod_count(struct module *module)
-{
- if (module)
- __MOD_DEC_USE_COUNT(module);
-}
-
static inline unsigned short snd_rawmidi_file_flags(struct file *file)
{
switch (file->f_mode & (FMODE_READ | FMODE_WRITE)) {
@@ -187,15 +181,12 @@
if (rfile)
rfile->input = rfile->output = NULL;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
rmidi = snd_rawmidi_devices[(cardnum * SNDRV_RAWMIDI_DEVICES) + device];
if (rmidi == NULL) {
err = -ENODEV;
goto __error1;
}
- if (!try_inc_mod_count(rmidi->card->module)) {
+ if (!try_module_get(rmidi->card->module)) {
err = -EFAULT;
goto __error1;
}
@@ -345,12 +336,9 @@
snd_rawmidi_done_buffer(output);
kfree(output);
}
- dec_mod_count(rmidi->card->module);
+ module_put(rmidi->card->module);
up(&rmidi->open_mutex);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return err;
}
@@ -504,10 +492,7 @@
rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened--;
}
up(&rmidi->open_mutex);
- dec_mod_count(rmidi->card->module);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
+ module_put(rmidi->card->module);
return 0;
}
Index: rtctimer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/rtctimer.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- rtctimer.c 13 Aug 2002 16:13:34 -0000 1.15
+++ rtctimer.c 19 Dec 2002 15:59:17 -0000 1.16
@@ -83,7 +83,6 @@
if (err < 0)
return err;
t->private_data = &rtc_task;
- MOD_INC_USE_COUNT;
return 0;
}
@@ -95,7 +94,6 @@
rtc_unregister(rtc);
t->private_data = NULL;
}
- MOD_DEC_USE_COUNT;
return 0;
}
Index: timer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/timer.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- timer.c 10 Nov 2002 19:04:44 -0000 1.18
+++ timer.c 19 Dec 2002 15:59:17 -0000 1.19
@@ -80,12 +80,6 @@
static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left);
-static inline void dec_mod_count(struct module *module)
-{
- if (module)
- __MOD_DEC_USE_COUNT(module);
-}
-
/*
* create a timer instance with the given owner string.
* when timer is not NULL, increments the module counter
@@ -108,7 +102,7 @@
timeri->in_use = (atomic_t)ATOMIC_INIT(0);
timeri->timer = timer;
- if (timer && timer->card && !try_inc_mod_count(timer->card->module)) {
+ if (timer && timer->card && !try_module_get(timer->card->module)) {
kfree(timeri->owner);
kfree(timeri);
return NULL;
@@ -325,7 +319,7 @@
kfree(timeri->owner);
kfree(timeri);
if (timer && timer->card)
- dec_mod_count(timer->card->module);
+ module_put(timer->card->module);
return 0;
}
@@ -948,9 +942,6 @@
return -ENOMEM;
}
file->private_data = tu;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
return 0;
}
@@ -967,9 +958,6 @@
kfree(tu->queue);
snd_magic_kfree(tu);
}
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now! Before the Holidays pass you by.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog