mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
Merge master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
This commit is contained in:
@@ -167,7 +167,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
spdif - Support SPDIF I/O
|
||||
- Default: disabled
|
||||
|
||||
Module supports autoprobe and multiple chips (max 8).
|
||||
This module supports one chip and autoprobe.
|
||||
|
||||
The power-management is supported.
|
||||
|
||||
@@ -206,7 +206,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
See "AC97 Quirk Option" section below.
|
||||
spdif_aclink - S/PDIF transfer over AC-link (default = 1)
|
||||
|
||||
This module supports up to 8 cards and autoprobe.
|
||||
This module supports one card and autoprobe.
|
||||
|
||||
ATI IXP has two different methods to control SPDIF output. One is
|
||||
over AC-link and another is over the "direct" SPDIF output. The
|
||||
@@ -218,7 +218,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
|
||||
Module for ATI IXP 150/200/250 AC97 modem controllers.
|
||||
|
||||
Module supports up to 8 cards.
|
||||
This module supports one card and autoprobe.
|
||||
|
||||
Note: The default index value of this module is -2, i.e. the first
|
||||
slot is excluded.
|
||||
@@ -637,7 +637,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
model - force the model name
|
||||
position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)
|
||||
|
||||
Module supports up to 8 cards.
|
||||
This module supports one card and autoprobe.
|
||||
|
||||
Each codec may have a model table for different configurations.
|
||||
If your machine isn't listed there, the default (usually minimal)
|
||||
@@ -663,6 +663,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
adjusted. Appearing only when compiled with
|
||||
$CONFIG_SND_DEBUG=y
|
||||
|
||||
ALC260
|
||||
hp HP machines
|
||||
fujitsu Fujitsu S7020
|
||||
|
||||
CMI9880
|
||||
minimal 3-jack in back
|
||||
min_fp 3-jack in back, 2-jack in front
|
||||
@@ -811,7 +815,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
semaphores (e.g. on some ASUS laptops)
|
||||
(default off)
|
||||
|
||||
Module supports autoprobe and multiple bus-master chips (max 8).
|
||||
This module supports one chip and autoprobe.
|
||||
|
||||
Note: the latest driver supports auto-detection of chip clock.
|
||||
if you still encounter too fast playback, specify the clock
|
||||
@@ -830,7 +834,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
|
||||
ac97_clock - AC'97 codec clock base (0 = auto-detect)
|
||||
|
||||
This module supports up to 8 cards and autoprobe.
|
||||
This module supports one card and autoprobe.
|
||||
|
||||
Note: The default index value of this module is -2, i.e. the first
|
||||
slot is excluded.
|
||||
@@ -950,8 +954,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
use_cache - 0 or 1 (disabled by default)
|
||||
vaio_hack - alias buffer_top=0x25a800
|
||||
reset_workaround - enable AC97 RESET workaround for some laptops
|
||||
reset_workaround2 - enable extended AC97 RESET workaround for some
|
||||
other laptops
|
||||
|
||||
Module supports autoprobe and multiple chips (max 8).
|
||||
This module supports one chip and autoprobe.
|
||||
|
||||
The power-management is supported.
|
||||
|
||||
@@ -980,6 +986,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
workaround is enabled automatically. For other laptops with a
|
||||
hard freeze, you can try reset_workaround=1 option.
|
||||
|
||||
Note: Dell Latitude CSx laptops have another problem regarding
|
||||
AC97 RESET. On these laptops, reset_workaround2 option is
|
||||
turned on as default. This option is worth to try if the
|
||||
previous reset_workaround option doesn't help.
|
||||
|
||||
Note: This driver is really crappy. It's a porting from the
|
||||
OSS driver, which is a result of black-magic reverse engineering.
|
||||
The detection of codec will fail if the driver is loaded *after*
|
||||
@@ -1310,7 +1321,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
ac97_quirk - AC'97 workaround for strange hardware
|
||||
See "AC97 Quirk Option" section below.
|
||||
|
||||
Module supports autoprobe and multiple bus-master chips (max 8).
|
||||
This module supports one chip and autoprobe.
|
||||
|
||||
Note: on some SMP motherboards like MSI 694D the interrupts might
|
||||
not be generated properly. In such a case, please try to
|
||||
@@ -1352,7 +1363,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
|
||||
ac97_clock - AC'97 codec clock base (default 48000Hz)
|
||||
|
||||
Module supports up to 8 cards.
|
||||
This module supports one card and autoprobe.
|
||||
|
||||
Note: The default index value of this module is -2, i.e. the first
|
||||
slot is excluded.
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
</affiliation>
|
||||
</author>
|
||||
|
||||
<date>March 6, 2005</date>
|
||||
<edition>0.3.4</edition>
|
||||
<date>October 6, 2005</date>
|
||||
<edition>0.3.5</edition>
|
||||
|
||||
<abstract>
|
||||
<para>
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<legalnotice>
|
||||
<para>
|
||||
Copyright (c) 2002-2004 Takashi Iwai <email>tiwai@suse.de</email>
|
||||
Copyright (c) 2002-2005 Takashi Iwai <email>tiwai@suse.de</email>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -1433,25 +1433,10 @@
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
if (chip->res_port) {
|
||||
release_resource(chip->res_port);
|
||||
kfree_nocheck(chip->res_port);
|
||||
}
|
||||
release_and_free_resource(chip->res_port);
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
||||
As you can see, the resource pointer is also to be freed
|
||||
via <function>kfree_nocheck()</function> after
|
||||
<function>release_resource()</function> is called. You
|
||||
cannot use <function>kfree()</function> here, because on ALSA,
|
||||
<function>kfree()</function> may be a wrapper to its own
|
||||
allocator with the memory debugging. Since the resource pointer
|
||||
is allocated externally outside the ALSA, it must be released
|
||||
via the native
|
||||
<function>kfree()</function>.
|
||||
<function>kfree_nocheck()</function> is used for that; it calls
|
||||
the native <function>kfree()</function> without wrapper.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -2190,8 +2175,7 @@ struct _snd_pcm_runtime {
|
||||
unsigned int rate_den;
|
||||
|
||||
/* -- SW params -- */
|
||||
int tstamp_timespec; /* use timeval (0) or timespec (1) */
|
||||
snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */
|
||||
struct timespec tstamp_mode; /* mmap timestamp is updated */
|
||||
unsigned int period_step;
|
||||
unsigned int sleep_min; /* min ticks to sleep */
|
||||
snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
|
||||
@@ -3709,8 +3693,7 @@ struct _snd_pcm_runtime {
|
||||
<para>
|
||||
Here, the chip instance is retrieved via
|
||||
<function>snd_kcontrol_chip()</function> macro. This macro
|
||||
converts from kcontrol->private_data to the type defined by
|
||||
<type>chip_t</type>. The
|
||||
just accesses to kcontrol->private_data. The
|
||||
kcontrol->private_data field is
|
||||
given as the argument of <function>snd_ctl_new()</function>
|
||||
(see the later subsection
|
||||
@@ -5998,32 +5981,23 @@ struct _snd_pcm_runtime {
|
||||
The first argument is the expression to evaluate, and the
|
||||
second argument is the action if it fails. When
|
||||
<constant>CONFIG_SND_DEBUG</constant>, is set, it will show an
|
||||
error message such as <computeroutput>BUG? (xxx) (called from
|
||||
yyy)</computeroutput>. When no debug flag is set, this is
|
||||
ignored.
|
||||
error message such as <computeroutput>BUG? (xxx)</computeroutput>
|
||||
together with stack trace.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="useful-functions-snd-runtime-check">
|
||||
<title><function>snd_runtime_check()</function></title>
|
||||
<para>
|
||||
This macro is quite similar with
|
||||
<function>snd_assert()</function>. Unlike
|
||||
<function>snd_assert()</function>, the expression is always
|
||||
evaluated regardless of
|
||||
<constant>CONFIG_SND_DEBUG</constant>. When
|
||||
<constant>CONFIG_SND_DEBUG</constant> is set, the macro will
|
||||
show a message like <computeroutput>ERROR (xx) (called from
|
||||
yyy)</computeroutput>.
|
||||
When no debug flag is set, this macro is ignored.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="useful-functions-snd-bug">
|
||||
<title><function>snd_BUG()</function></title>
|
||||
<para>
|
||||
It calls <function>snd_assert(0,)</function> -- that is, just
|
||||
prints the error message at the point. It's useful to show that
|
||||
a fatal error happens there.
|
||||
It shows <computeroutput>BUG?</computeroutput> message and
|
||||
stack trace as well as <function>snd_assert</function> at the point.
|
||||
It's useful to show that a fatal error happens there.
|
||||
</para>
|
||||
<para>
|
||||
When no debug flag is set, this macro is ignored.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
@@ -149,8 +149,22 @@ static void get_rtc_alm_time (struct rtc_time *alm_tm);
|
||||
#ifdef RTC_IRQ
|
||||
static void rtc_dropped_irq(unsigned long data);
|
||||
|
||||
static void set_rtc_irq_bit(unsigned char bit);
|
||||
static void mask_rtc_irq_bit(unsigned char bit);
|
||||
static void set_rtc_irq_bit_locked(unsigned char bit);
|
||||
static void mask_rtc_irq_bit_locked(unsigned char bit);
|
||||
|
||||
static inline void set_rtc_irq_bit(unsigned char bit)
|
||||
{
|
||||
spin_lock_irq(&rtc_lock);
|
||||
set_rtc_irq_bit_locked(bit);
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
}
|
||||
|
||||
static void mask_rtc_irq_bit(unsigned char bit)
|
||||
{
|
||||
spin_lock_irq(&rtc_lock);
|
||||
mask_rtc_irq_bit_locked(bit);
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int rtc_proc_open(struct inode *inode, struct file *file);
|
||||
@@ -401,18 +415,19 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
|
||||
}
|
||||
case RTC_PIE_OFF: /* Mask periodic int. enab. bit */
|
||||
{
|
||||
mask_rtc_irq_bit(RTC_PIE);
|
||||
unsigned long flags; /* can be called from isr via rtc_control() */
|
||||
spin_lock_irqsave (&rtc_lock, flags);
|
||||
mask_rtc_irq_bit_locked(RTC_PIE);
|
||||
if (rtc_status & RTC_TIMER_ON) {
|
||||
spin_lock_irq (&rtc_lock);
|
||||
rtc_status &= ~RTC_TIMER_ON;
|
||||
del_timer(&rtc_irq_timer);
|
||||
spin_unlock_irq (&rtc_lock);
|
||||
}
|
||||
spin_unlock_irqrestore (&rtc_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
case RTC_PIE_ON: /* Allow periodic ints */
|
||||
{
|
||||
|
||||
unsigned long flags; /* can be called from isr via rtc_control() */
|
||||
/*
|
||||
* We don't really want Joe User enabling more
|
||||
* than 64Hz of interrupts on a multi-user machine.
|
||||
@@ -421,14 +436,14 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
|
||||
(!capable(CAP_SYS_RESOURCE)))
|
||||
return -EACCES;
|
||||
|
||||
spin_lock_irqsave (&rtc_lock, flags);
|
||||
if (!(rtc_status & RTC_TIMER_ON)) {
|
||||
spin_lock_irq (&rtc_lock);
|
||||
rtc_irq_timer.expires = jiffies + HZ/rtc_freq + 2*HZ/100;
|
||||
add_timer(&rtc_irq_timer);
|
||||
rtc_status |= RTC_TIMER_ON;
|
||||
spin_unlock_irq (&rtc_lock);
|
||||
}
|
||||
set_rtc_irq_bit(RTC_PIE);
|
||||
set_rtc_irq_bit_locked(RTC_PIE);
|
||||
spin_unlock_irqrestore (&rtc_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
case RTC_UIE_OFF: /* Mask ints from RTC updates. */
|
||||
@@ -609,6 +624,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
|
||||
{
|
||||
int tmp = 0;
|
||||
unsigned char val;
|
||||
unsigned long flags; /* can be called from isr via rtc_control() */
|
||||
|
||||
/*
|
||||
* The max we can do is 8192Hz.
|
||||
@@ -631,9 +647,9 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
|
||||
if (arg != (1<<tmp))
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irq(&rtc_lock);
|
||||
spin_lock_irqsave(&rtc_lock, flags);
|
||||
if (hpet_set_periodic_freq(arg)) {
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
rtc_freq = arg;
|
||||
@@ -641,7 +657,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
|
||||
val = CMOS_READ(RTC_FREQ_SELECT) & 0xf0;
|
||||
val |= (16 - tmp);
|
||||
CMOS_WRITE(val, RTC_FREQ_SELECT);
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -844,12 +860,15 @@ int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg)
|
||||
#ifndef RTC_IRQ
|
||||
return -EIO;
|
||||
#else
|
||||
spin_lock_irq(&rtc_task_lock);
|
||||
unsigned long flags;
|
||||
if (cmd != RTC_PIE_ON && cmd != RTC_PIE_OFF && cmd != RTC_IRQP_SET)
|
||||
return -EINVAL;
|
||||
spin_lock_irqsave(&rtc_task_lock, flags);
|
||||
if (rtc_callback != task) {
|
||||
spin_unlock_irq(&rtc_task_lock);
|
||||
spin_unlock_irqrestore(&rtc_task_lock, flags);
|
||||
return -ENXIO;
|
||||
}
|
||||
spin_unlock_irq(&rtc_task_lock);
|
||||
spin_unlock_irqrestore(&rtc_task_lock, flags);
|
||||
return rtc_do_ioctl(cmd, arg, 1);
|
||||
#endif
|
||||
}
|
||||
@@ -1306,40 +1325,32 @@ static void get_rtc_alm_time(struct rtc_time *alm_tm)
|
||||
* meddles with the interrupt enable/disable bits.
|
||||
*/
|
||||
|
||||
static void mask_rtc_irq_bit(unsigned char bit)
|
||||
static void mask_rtc_irq_bit_locked(unsigned char bit)
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
spin_lock_irq(&rtc_lock);
|
||||
if (hpet_mask_rtc_irq_bit(bit)) {
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
if (hpet_mask_rtc_irq_bit(bit))
|
||||
return;
|
||||
}
|
||||
val = CMOS_READ(RTC_CONTROL);
|
||||
val &= ~bit;
|
||||
CMOS_WRITE(val, RTC_CONTROL);
|
||||
CMOS_READ(RTC_INTR_FLAGS);
|
||||
|
||||
rtc_irq_data = 0;
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
}
|
||||
|
||||
static void set_rtc_irq_bit(unsigned char bit)
|
||||
static void set_rtc_irq_bit_locked(unsigned char bit)
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
spin_lock_irq(&rtc_lock);
|
||||
if (hpet_set_rtc_irq_bit(bit)) {
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
if (hpet_set_rtc_irq_bit(bit))
|
||||
return;
|
||||
}
|
||||
val = CMOS_READ(RTC_CONTROL);
|
||||
val |= bit;
|
||||
CMOS_WRITE(val, RTC_CONTROL);
|
||||
CMOS_READ(RTC_INTR_FLAGS);
|
||||
|
||||
rtc_irq_data = 0;
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -387,15 +387,6 @@
|
||||
#define AC97_RATES_MIC_ADC 4
|
||||
#define AC97_RATES_SPDIF 5
|
||||
|
||||
/* shared controllers */
|
||||
enum {
|
||||
AC97_SHARED_TYPE_NONE,
|
||||
AC97_SHARED_TYPE_ICH,
|
||||
AC97_SHARED_TYPE_ATIIXP,
|
||||
AC97_SHARED_TYPE_VIA,
|
||||
AC97_SHARED_TYPES
|
||||
};
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
@@ -468,7 +459,6 @@ struct _snd_ac97_bus {
|
||||
unsigned short used_slots[2][4]; /* actually used PCM slots */
|
||||
unsigned short pcms_count; /* count of PCMs */
|
||||
struct ac97_pcm *pcms;
|
||||
unsigned int shared_type; /* type of shared controller betwen audio and modem */
|
||||
ac97_t *codec[4];
|
||||
snd_info_entry_t *proc;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <linux/pm.h> /* pm_message_t */
|
||||
|
||||
/* Typedef's */
|
||||
typedef struct timespec snd_timestamp_t;
|
||||
typedef struct sndrv_interval snd_interval_t;
|
||||
typedef enum sndrv_card_type snd_card_type;
|
||||
typedef struct sndrv_xferi snd_xferi_t;
|
||||
@@ -256,6 +255,7 @@ typedef struct _snd_minor snd_minor_t;
|
||||
|
||||
/* sound.c */
|
||||
|
||||
extern int snd_major;
|
||||
extern int snd_ecards_limit;
|
||||
|
||||
void snd_request_card(int card);
|
||||
@@ -285,39 +285,6 @@ int snd_oss_init_module(void);
|
||||
|
||||
/* memory.c */
|
||||
|
||||
#ifdef CONFIG_SND_DEBUG_MEMORY
|
||||
void snd_memory_init(void);
|
||||
void snd_memory_done(void);
|
||||
int snd_memory_info_init(void);
|
||||
int snd_memory_info_done(void);
|
||||
void *snd_hidden_kmalloc(size_t size, gfp_t flags);
|
||||
void *snd_hidden_kzalloc(size_t size, gfp_t flags);
|
||||
void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags);
|
||||
void snd_hidden_kfree(const void *obj);
|
||||
void *snd_hidden_vmalloc(unsigned long size);
|
||||
void snd_hidden_vfree(void *obj);
|
||||
char *snd_hidden_kstrdup(const char *s, gfp_t flags);
|
||||
#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
|
||||
#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags)
|
||||
#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
|
||||
#define kfree(obj) snd_hidden_kfree(obj)
|
||||
#define vmalloc(size) snd_hidden_vmalloc(size)
|
||||
#define vfree(obj) snd_hidden_vfree(obj)
|
||||
#define kmalloc_nocheck(size, flags) snd_wrapper_kmalloc(size, flags)
|
||||
#define vmalloc_nocheck(size) snd_wrapper_vmalloc(size)
|
||||
#define kfree_nocheck(obj) snd_wrapper_kfree(obj)
|
||||
#define vfree_nocheck(obj) snd_wrapper_vfree(obj)
|
||||
#define kstrdup(s, flags) snd_hidden_kstrdup(s, flags)
|
||||
#else
|
||||
#define snd_memory_init() /*NOP*/
|
||||
#define snd_memory_done() /*NOP*/
|
||||
#define snd_memory_info_init() /*NOP*/
|
||||
#define snd_memory_info_done() /*NOP*/
|
||||
#define kmalloc_nocheck(size, flags) kmalloc(size, flags)
|
||||
#define vmalloc_nocheck(size) vmalloc(size)
|
||||
#define kfree_nocheck(obj) kfree(obj)
|
||||
#define vfree_nocheck(obj) vfree(obj)
|
||||
#endif
|
||||
int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count);
|
||||
int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count);
|
||||
|
||||
@@ -373,8 +340,9 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size);
|
||||
#endif
|
||||
|
||||
/* misc.c */
|
||||
struct resource;
|
||||
void release_and_free_resource(struct resource *res);
|
||||
|
||||
int snd_task_name(struct task_struct *task, char *name, size_t size);
|
||||
#ifdef CONFIG_SND_VERBOSE_PRINTK
|
||||
void snd_verbose_printk(const char *file, int line, const char *format, ...)
|
||||
__attribute__ ((format (printf, 3, 4)));
|
||||
@@ -429,34 +397,24 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
|
||||
* When CONFIG_SND_DEBUG is not set, the expression is executed but
|
||||
* not checked.
|
||||
*/
|
||||
#define snd_assert(expr, args...) do {\
|
||||
if (unlikely(!(expr))) { \
|
||||
snd_printk(KERN_ERR "BUG? (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\
|
||||
args;\
|
||||
}\
|
||||
#define snd_assert(expr, args...) do { \
|
||||
if (unlikely(!(expr))) { \
|
||||
snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \
|
||||
dump_stack(); \
|
||||
args; \
|
||||
} \
|
||||
} while (0)
|
||||
/**
|
||||
* snd_runtime_check - run-time assertion macro
|
||||
* @expr: expression
|
||||
* @args...: the action
|
||||
*
|
||||
* This macro checks the expression in run-time and invokes the commands
|
||||
* given in the rest arguments if the assertion is failed.
|
||||
* Unlike snd_assert(), the action commands are executed even if
|
||||
* CONFIG_SND_DEBUG is not set but without any error messages.
|
||||
*/
|
||||
#define snd_runtime_check(expr, args...) do {\
|
||||
if (unlikely(!(expr))) { \
|
||||
snd_printk(KERN_ERR "ERROR (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\
|
||||
args;\
|
||||
}\
|
||||
|
||||
#define snd_BUG() do { \
|
||||
snd_printk(KERN_ERR "BUG?\n"); \
|
||||
dump_stack(); \
|
||||
} while (0)
|
||||
|
||||
#else /* !CONFIG_SND_DEBUG */
|
||||
|
||||
#define snd_printd(fmt, args...) /* nothing */
|
||||
#define snd_assert(expr, args...) (void)(expr)
|
||||
#define snd_runtime_check(expr, args...) do { if (!(expr)) { args; } } while (0)
|
||||
#define snd_BUG() /* nothing */
|
||||
|
||||
#endif /* CONFIG_SND_DEBUG */
|
||||
|
||||
@@ -473,30 +431,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
|
||||
#define snd_printdd(format, args...) /* nothing */
|
||||
#endif
|
||||
|
||||
#define snd_BUG() snd_assert(0, )
|
||||
|
||||
|
||||
static inline void snd_timestamp_now(struct timespec *tstamp, int timespec)
|
||||
{
|
||||
struct timeval val;
|
||||
/* FIXME: use a linear time source */
|
||||
do_gettimeofday(&val);
|
||||
tstamp->tv_sec = val.tv_sec;
|
||||
tstamp->tv_nsec = val.tv_usec;
|
||||
if (timespec)
|
||||
tstamp->tv_nsec *= 1000L;
|
||||
}
|
||||
|
||||
static inline void snd_timestamp_zero(struct timespec *tstamp)
|
||||
{
|
||||
tstamp->tv_sec = 0;
|
||||
tstamp->tv_nsec = 0;
|
||||
}
|
||||
|
||||
static inline int snd_timestamp_null(struct timespec *tstamp)
|
||||
{
|
||||
return tstamp->tv_sec == 0 && tstamp->tv_nsec == 0;
|
||||
}
|
||||
|
||||
#define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */
|
||||
|
||||
|
||||
@@ -44,21 +44,4 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
/*
|
||||
* ==========================================================================
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SND_DEBUG_MEMORY
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
void *snd_wrapper_kmalloc(size_t, gfp_t);
|
||||
#undef kmalloc
|
||||
void snd_wrapper_kfree(const void *);
|
||||
#undef kfree
|
||||
void *snd_wrapper_vmalloc(size_t);
|
||||
#undef vmalloc
|
||||
void snd_wrapper_vfree(void *);
|
||||
#undef vfree
|
||||
#endif
|
||||
|
||||
#endif /* __SOUND_DRIVER_H */
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
/* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */
|
||||
#define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */
|
||||
#define AUDIGY_DMA_MASK 0xffffffffUL /* 32bit */
|
||||
#define AUDIGY_DMA_MASK 0x7fffffffUL /* 31bit FIXME - 32 should work? */
|
||||
/* See ALSA bug #1276 - rlrevell */
|
||||
|
||||
#define TMEMSIZE 256*1024
|
||||
#define TMEMSIZEREG 4
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev))
|
||||
|
||||
#define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */
|
||||
#define SNDRV_MINOR_SEQUENCER 1
|
||||
#define SNDRV_MINOR_TIMER (1+32)
|
||||
#define SNDRV_MINOR_GLOBAL 1 /* 1 */
|
||||
#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32)
|
||||
#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32)
|
||||
#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */
|
||||
#define SNDRV_MINOR_HWDEPS 4
|
||||
#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */
|
||||
@@ -39,12 +40,9 @@
|
||||
|
||||
#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL
|
||||
#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP
|
||||
#define SNDRV_DEVICE_TYPE_MIXER SNDRV_MINOR_MIXER
|
||||
#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI
|
||||
#define SNDRV_DEVICE_TYPE_PCM_PLAYBACK SNDRV_MINOR_PCM_PLAYBACK
|
||||
#define SNDRV_DEVICE_TYPE_PCM_PLOOP SNDRV_MINOR_PCM_PLOOP
|
||||
#define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE
|
||||
#define SNDRV_DEVICE_TYPE_PCM_CLOOP SNDRV_MINOR_PCM_CLOOP
|
||||
#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER
|
||||
#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ typedef struct {
|
||||
struct _snd_pcm_runtime {
|
||||
/* -- Status -- */
|
||||
snd_pcm_substream_t *trigger_master;
|
||||
snd_timestamp_t trigger_tstamp; /* trigger timestamp */
|
||||
struct timespec trigger_tstamp; /* trigger timestamp */
|
||||
int overrange;
|
||||
snd_pcm_uframes_t avail_max;
|
||||
snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
|
||||
@@ -306,7 +306,6 @@ struct _snd_pcm_runtime {
|
||||
unsigned int rate_den;
|
||||
|
||||
/* -- SW params -- */
|
||||
int tstamp_timespec; /* use timeval (0) or timespec (1) */
|
||||
snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */
|
||||
unsigned int period_step;
|
||||
unsigned int sleep_min; /* min ticks to sleep */
|
||||
|
||||
@@ -88,6 +88,7 @@ struct _snd_timer_hardware {
|
||||
struct _snd_timer {
|
||||
snd_timer_class_t tmr_class;
|
||||
snd_card_t *card;
|
||||
struct module *module;
|
||||
int tmr_device;
|
||||
int tmr_subdevice;
|
||||
char id[64];
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
/* include/version.h. Generated by configure. */
|
||||
#define CONFIG_SND_VERSION "1.0.10rc1"
|
||||
#define CONFIG_SND_DATE " (Mon Sep 12 08:13:09 2005 UTC)"
|
||||
#define CONFIG_SND_VERSION "1.0.10rc3"
|
||||
#define CONFIG_SND_DATE " (Mon Nov 07 13:30:21 2005 UTC)"
|
||||
|
||||
@@ -48,6 +48,14 @@ config SND
|
||||
|
||||
For more information, see <http://www.alsa-project.org/>
|
||||
|
||||
config SND_AC97_CODEC
|
||||
tristate
|
||||
select SND_PCM
|
||||
select SND_AC97_BUS
|
||||
|
||||
config SND_AC97_BUS
|
||||
tristate
|
||||
|
||||
source "sound/core/Kconfig"
|
||||
|
||||
source "sound/drivers/Kconfig"
|
||||
|
||||
@@ -127,12 +127,6 @@ config SND_DEBUG
|
||||
help
|
||||
Say Y here to enable ALSA debug code.
|
||||
|
||||
config SND_DEBUG_MEMORY
|
||||
bool "Debug memory"
|
||||
depends on SND_DEBUG
|
||||
help
|
||||
Say Y here to enable debugging of memory allocations.
|
||||
|
||||
config SND_DEBUG_DETECT
|
||||
bool "Debug detection"
|
||||
depends on SND_DEBUG
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
# Copyright (c) 1999,2001 by Jaroslav Kysela <perex@suse.cz>
|
||||
#
|
||||
|
||||
snd-objs := sound.o init.o memory.o info.o control.o misc.o \
|
||||
device.o wrappers.o
|
||||
snd-objs := sound.o init.o memory.o info.o control.o misc.o device.o
|
||||
ifeq ($(CONFIG_ISA_DMA_API),y)
|
||||
snd-objs += isadma.o
|
||||
endif
|
||||
|
||||
@@ -144,7 +144,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id)
|
||||
snd_ctl_file_t *ctl;
|
||||
snd_kctl_event_t *ev;
|
||||
|
||||
snd_runtime_check(card != NULL && id != NULL, return);
|
||||
snd_assert(card != NULL && id != NULL, return);
|
||||
read_lock(&card->ctl_files_rwlock);
|
||||
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
|
||||
card->mixer_oss_change_count++;
|
||||
@@ -193,8 +193,8 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access)
|
||||
snd_kcontrol_t *kctl;
|
||||
unsigned int idx;
|
||||
|
||||
snd_runtime_check(control != NULL, return NULL);
|
||||
snd_runtime_check(control->count > 0, return NULL);
|
||||
snd_assert(control != NULL, return NULL);
|
||||
snd_assert(control->count > 0, return NULL);
|
||||
kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL);
|
||||
if (kctl == NULL)
|
||||
return NULL;
|
||||
@@ -220,7 +220,7 @@ snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * ncontrol, void *private_
|
||||
snd_kcontrol_t kctl;
|
||||
unsigned int access;
|
||||
|
||||
snd_runtime_check(ncontrol != NULL, return NULL);
|
||||
snd_assert(ncontrol != NULL, return NULL);
|
||||
snd_assert(ncontrol->info != NULL, return NULL);
|
||||
memset(&kctl, 0, sizeof(kctl));
|
||||
kctl.id.iface = ncontrol->iface;
|
||||
@@ -309,7 +309,7 @@ int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol)
|
||||
snd_ctl_elem_id_t id;
|
||||
unsigned int idx;
|
||||
|
||||
snd_runtime_check(card != NULL && kcontrol != NULL, return -EINVAL);
|
||||
snd_assert(card != NULL && kcontrol != NULL, return -EINVAL);
|
||||
snd_assert(kcontrol->info != NULL, return -EINVAL);
|
||||
id = kcontrol->id;
|
||||
down_write(&card->controls_rwsem);
|
||||
@@ -355,7 +355,7 @@ int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol)
|
||||
snd_ctl_elem_id_t id;
|
||||
unsigned int idx;
|
||||
|
||||
snd_runtime_check(card != NULL && kcontrol != NULL, return -EINVAL);
|
||||
snd_assert(card != NULL && kcontrol != NULL, return -EINVAL);
|
||||
list_del(&kcontrol->list);
|
||||
card->controls_count -= kcontrol->count;
|
||||
id = kcontrol->id;
|
||||
@@ -468,7 +468,7 @@ snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid)
|
||||
struct list_head *list;
|
||||
snd_kcontrol_t *kctl;
|
||||
|
||||
snd_runtime_check(card != NULL && numid != 0, return NULL);
|
||||
snd_assert(card != NULL && numid != 0, return NULL);
|
||||
list_for_each(list, &card->controls) {
|
||||
kctl = snd_kcontrol(list);
|
||||
if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid)
|
||||
@@ -494,7 +494,7 @@ snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id)
|
||||
struct list_head *list;
|
||||
snd_kcontrol_t *kctl;
|
||||
|
||||
snd_runtime_check(card != NULL && id != NULL, return NULL);
|
||||
snd_assert(card != NULL && id != NULL, return NULL);
|
||||
if (id->numid != 0)
|
||||
return snd_ctl_find_numid(card, id->numid);
|
||||
list_for_each(list, &card->controls) {
|
||||
@@ -1215,7 +1215,7 @@ static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head
|
||||
struct list_head *list;
|
||||
snd_kctl_ioctl_t *p;
|
||||
|
||||
snd_runtime_check(fcn != NULL, return -EINVAL);
|
||||
snd_assert(fcn != NULL, return -EINVAL);
|
||||
down_write(&snd_ioctl_rwsem);
|
||||
list_for_each(list, lists) {
|
||||
p = list_entry(list, snd_kctl_ioctl_t, list);
|
||||
|
||||
@@ -81,20 +81,16 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
|
||||
int err;
|
||||
wait_queue_t wait;
|
||||
|
||||
switch (major) {
|
||||
case CONFIG_SND_MAJOR:
|
||||
if (major == snd_major) {
|
||||
cardnum = SNDRV_MINOR_CARD(iminor(inode));
|
||||
device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_HWDEP;
|
||||
break;
|
||||
#ifdef CONFIG_SND_OSSEMUL
|
||||
case SOUND_MAJOR:
|
||||
} else if (major == SOUND_MAJOR) {
|
||||
cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
|
||||
device = 0;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
} else
|
||||
return -ENXIO;
|
||||
}
|
||||
cardnum %= SNDRV_CARDS;
|
||||
device %= SNDRV_MINOR_HWDEPS;
|
||||
hw = snd_hwdep_devices[(cardnum * SNDRV_MINOR_HWDEPS) + device];
|
||||
|
||||
@@ -566,7 +566,6 @@ int __init snd_info_init(void)
|
||||
}
|
||||
#endif
|
||||
snd_info_version_init();
|
||||
snd_memory_info_init();
|
||||
snd_minor_info_init();
|
||||
snd_minor_info_oss_init();
|
||||
snd_card_info_init();
|
||||
@@ -578,7 +577,6 @@ int __exit snd_info_done(void)
|
||||
snd_card_info_done();
|
||||
snd_minor_info_oss_done();
|
||||
snd_minor_info_done();
|
||||
snd_memory_info_done();
|
||||
snd_info_version_done();
|
||||
if (snd_proc_root) {
|
||||
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
|
||||
|
||||
@@ -420,7 +420,7 @@ int snd_card_register(snd_card_t * card)
|
||||
int err;
|
||||
snd_info_entry_t *entry;
|
||||
|
||||
snd_runtime_check(card != NULL, return -EINVAL);
|
||||
snd_assert(card != NULL, return -EINVAL);
|
||||
if ((err = snd_device_register_all(card)) < 0)
|
||||
return err;
|
||||
write_lock(&snd_card_rwlock);
|
||||
@@ -524,7 +524,8 @@ int __init snd_card_info_init(void)
|
||||
snd_info_entry_t *entry;
|
||||
|
||||
entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL);
|
||||
snd_runtime_check(entry != NULL, return -ENOMEM);
|
||||
if (! entry)
|
||||
return -ENOMEM;
|
||||
entry->c.text.read_size = PAGE_SIZE;
|
||||
entry->c.text.read = snd_card_info_read;
|
||||
if (snd_info_register(entry) < 0) {
|
||||
@@ -840,7 +841,7 @@ static int snd_generic_resume(struct device *dev)
|
||||
card = get_snd_generic_card(dev);
|
||||
if (card->power_state == SNDRV_CTL_POWER_D0)
|
||||
return 0;
|
||||
if (card->pm_suspend)
|
||||
if (card->pm_resume)
|
||||
card->pm_resume(card);
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
return 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) by Jaroslav Kysela <perex@suse.cz>
|
||||
*
|
||||
* Memory allocation helpers.
|
||||
* Misc memory accessors
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -20,221 +20,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sound/driver.h>
|
||||
#include <linux/config.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/pci.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/info.h>
|
||||
|
||||
/*
|
||||
* memory allocation helpers and debug routines
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SND_DEBUG_MEMORY
|
||||
|
||||
struct snd_alloc_track {
|
||||
unsigned long magic;
|
||||
void *caller;
|
||||
size_t size;
|
||||
struct list_head list;
|
||||
long data[0];
|
||||
};
|
||||
|
||||
#define snd_alloc_track_entry(obj) (struct snd_alloc_track *)((char*)obj - (unsigned long)((struct snd_alloc_track *)0)->data)
|
||||
|
||||
static long snd_alloc_kmalloc;
|
||||
static long snd_alloc_vmalloc;
|
||||
static LIST_HEAD(snd_alloc_kmalloc_list);
|
||||
static LIST_HEAD(snd_alloc_vmalloc_list);
|
||||
static DEFINE_SPINLOCK(snd_alloc_kmalloc_lock);
|
||||
static DEFINE_SPINLOCK(snd_alloc_vmalloc_lock);
|
||||
#define KMALLOC_MAGIC 0x87654321
|
||||
#define VMALLOC_MAGIC 0x87654320
|
||||
static snd_info_entry_t *snd_memory_info_entry;
|
||||
|
||||
void __init snd_memory_init(void)
|
||||
{
|
||||
snd_alloc_kmalloc = 0;
|
||||
snd_alloc_vmalloc = 0;
|
||||
}
|
||||
|
||||
void snd_memory_done(void)
|
||||
{
|
||||
struct list_head *head;
|
||||
struct snd_alloc_track *t;
|
||||
|
||||
if (snd_alloc_kmalloc > 0)
|
||||
snd_printk(KERN_ERR "Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc);
|
||||
if (snd_alloc_vmalloc > 0)
|
||||
snd_printk(KERN_ERR "Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc);
|
||||
list_for_each_prev(head, &snd_alloc_kmalloc_list) {
|
||||
t = list_entry(head, struct snd_alloc_track, list);
|
||||
if (t->magic != KMALLOC_MAGIC) {
|
||||
snd_printk(KERN_ERR "Corrupted kmalloc\n");
|
||||
break;
|
||||
}
|
||||
snd_printk(KERN_ERR "kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
|
||||
}
|
||||
list_for_each_prev(head, &snd_alloc_vmalloc_list) {
|
||||
t = list_entry(head, struct snd_alloc_track, list);
|
||||
if (t->magic != VMALLOC_MAGIC) {
|
||||
snd_printk(KERN_ERR "Corrupted vmalloc\n");
|
||||
break;
|
||||
}
|
||||
snd_printk(KERN_ERR "vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
|
||||
}
|
||||
}
|
||||
|
||||
static void *__snd_kmalloc(size_t size, gfp_t flags, void *caller)
|
||||
{
|
||||
unsigned long cpu_flags;
|
||||
struct snd_alloc_track *t;
|
||||
void *ptr;
|
||||
|
||||
ptr = snd_wrapper_kmalloc(size + sizeof(struct snd_alloc_track), flags);
|
||||
if (ptr != NULL) {
|
||||
t = (struct snd_alloc_track *)ptr;
|
||||
t->magic = KMALLOC_MAGIC;
|
||||
t->caller = caller;
|
||||
spin_lock_irqsave(&snd_alloc_kmalloc_lock, cpu_flags);
|
||||
list_add_tail(&t->list, &snd_alloc_kmalloc_list);
|
||||
spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, cpu_flags);
|
||||
t->size = size;
|
||||
snd_alloc_kmalloc += size;
|
||||
ptr = t->data;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0));
|
||||
void *snd_hidden_kmalloc(size_t size, gfp_t flags)
|
||||
{
|
||||
return _snd_kmalloc(size, flags);
|
||||
}
|
||||
|
||||
void *snd_hidden_kzalloc(size_t size, gfp_t flags)
|
||||
{
|
||||
void *ret = _snd_kmalloc(size, flags);
|
||||
if (ret)
|
||||
memset(ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_hidden_kzalloc);
|
||||
|
||||
void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags)
|
||||
{
|
||||
void *ret = NULL;
|
||||
if (n != 0 && size > INT_MAX / n)
|
||||
return ret;
|
||||
return snd_hidden_kzalloc(n * size, flags);
|
||||
}
|
||||
|
||||
void snd_hidden_kfree(const void *obj)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct snd_alloc_track *t;
|
||||
if (obj == NULL)
|
||||
return;
|
||||
t = snd_alloc_track_entry(obj);
|
||||
if (t->magic != KMALLOC_MAGIC) {
|
||||
snd_printk(KERN_WARNING "bad kfree (called from %p)\n", __builtin_return_address(0));
|
||||
return;
|
||||
}
|
||||
spin_lock_irqsave(&snd_alloc_kmalloc_lock, flags);
|
||||
list_del(&t->list);
|
||||
spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, flags);
|
||||
t->magic = 0;
|
||||
snd_alloc_kmalloc -= t->size;
|
||||
obj = t;
|
||||
snd_wrapper_kfree(obj);
|
||||
}
|
||||
|
||||
void *snd_hidden_vmalloc(unsigned long size)
|
||||
{
|
||||
void *ptr;
|
||||
ptr = snd_wrapper_vmalloc(size + sizeof(struct snd_alloc_track));
|
||||
if (ptr) {
|
||||
struct snd_alloc_track *t = (struct snd_alloc_track *)ptr;
|
||||
t->magic = VMALLOC_MAGIC;
|
||||
t->caller = __builtin_return_address(0);
|
||||
spin_lock(&snd_alloc_vmalloc_lock);
|
||||
list_add_tail(&t->list, &snd_alloc_vmalloc_list);
|
||||
spin_unlock(&snd_alloc_vmalloc_lock);
|
||||
t->size = size;
|
||||
snd_alloc_vmalloc += size;
|
||||
ptr = t->data;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void snd_hidden_vfree(void *obj)
|
||||
{
|
||||
struct snd_alloc_track *t;
|
||||
if (obj == NULL)
|
||||
return;
|
||||
t = snd_alloc_track_entry(obj);
|
||||
if (t->magic != VMALLOC_MAGIC) {
|
||||
snd_printk(KERN_ERR "bad vfree (called from %p)\n", __builtin_return_address(0));
|
||||
return;
|
||||
}
|
||||
spin_lock(&snd_alloc_vmalloc_lock);
|
||||
list_del(&t->list);
|
||||
spin_unlock(&snd_alloc_vmalloc_lock);
|
||||
t->magic = 0;
|
||||
snd_alloc_vmalloc -= t->size;
|
||||
obj = t;
|
||||
snd_wrapper_vfree(obj);
|
||||
}
|
||||
|
||||
char *snd_hidden_kstrdup(const char *s, gfp_t flags)
|
||||
{
|
||||
int len;
|
||||
char *buf;
|
||||
|
||||
if (!s) return NULL;
|
||||
|
||||
len = strlen(s) + 1;
|
||||
buf = _snd_kmalloc(len, flags);
|
||||
if (buf)
|
||||
memcpy(buf, s, len);
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer)
|
||||
{
|
||||
snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc);
|
||||
snd_iprintf(buffer, "vmalloc: %li bytes\n", snd_alloc_vmalloc);
|
||||
}
|
||||
|
||||
int __init snd_memory_info_init(void)
|
||||
{
|
||||
snd_info_entry_t *entry;
|
||||
|
||||
entry = snd_info_create_module_entry(THIS_MODULE, "meminfo", NULL);
|
||||
if (entry) {
|
||||
entry->c.text.read_size = 256;
|
||||
entry->c.text.read = snd_memory_info_read;
|
||||
if (snd_info_register(entry) < 0) {
|
||||
snd_info_free_entry(entry);
|
||||
entry = NULL;
|
||||
}
|
||||
}
|
||||
snd_memory_info_entry = entry;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __exit snd_memory_info_done(void)
|
||||
{
|
||||
if (snd_memory_info_entry)
|
||||
snd_info_unregister(snd_memory_info_entry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SND_DEBUG_MEMORY */
|
||||
|
||||
/**
|
||||
* copy_to_user_fromio - copy data from mmio-space to user-space
|
||||
|
||||
@@ -23,17 +23,15 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <sound/core.h>
|
||||
|
||||
int snd_task_name(struct task_struct *task, char *name, size_t size)
|
||||
void release_and_free_resource(struct resource *res)
|
||||
{
|
||||
unsigned int idx;
|
||||
|
||||
snd_assert(task != NULL && name != NULL && size >= 2, return -EINVAL);
|
||||
for (idx = 0; idx < sizeof(task->comm) && idx + 1 < size; idx++)
|
||||
name[idx] = task->comm[idx];
|
||||
name[idx] = '\0';
|
||||
return 0;
|
||||
if (res) {
|
||||
release_resource(res);
|
||||
kfree(res);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SND_VERBOSE_PRINTK
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user