Loading Documentation/sound/alsa/ALSA-Configuration.txt +20 −9 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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 Loading @@ -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. Loading Loading @@ -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) Loading @@ -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 Loading Loading @@ -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 Loading @@ -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. Loading Loading @@ -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. Loading Loading @@ -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* Loading Loading @@ -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 Loading Loading @@ -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. Loading Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +15 −41 Original line number Diff line number Diff line Loading @@ -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> Loading @@ -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> Loading Loading @@ -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> Loading Loading @@ -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 */ Loading Loading @@ -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 Loading Loading @@ -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> Loading drivers/char/rtc.c +38 −27 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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. Loading @@ -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. */ Loading Loading @@ -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. Loading @@ -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; Loading @@ -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 Loading Loading @@ -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 } Loading Loading @@ -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 Loading include/sound/ac97_codec.h +0 −10 Original line number Diff line number Diff line Loading @@ -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 }; /* * */ Loading Loading @@ -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; }; Loading include/sound/core.h +14 −80 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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))); Loading Loading @@ -431,32 +399,22 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) */ #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));\ 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 */ Loading @@ -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 */ Loading Loading
Documentation/sound/alsa/ALSA-Configuration.txt +20 −9 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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 Loading @@ -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. Loading Loading @@ -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) Loading @@ -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 Loading Loading @@ -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 Loading @@ -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. Loading Loading @@ -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. Loading Loading @@ -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* Loading Loading @@ -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 Loading Loading @@ -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. Loading
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +15 −41 Original line number Diff line number Diff line Loading @@ -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> Loading @@ -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> Loading Loading @@ -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> Loading Loading @@ -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 */ Loading Loading @@ -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 Loading Loading @@ -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> Loading
drivers/char/rtc.c +38 −27 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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. Loading @@ -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. */ Loading Loading @@ -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. Loading @@ -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; Loading @@ -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 Loading Loading @@ -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 } Loading Loading @@ -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 Loading
include/sound/ac97_codec.h +0 −10 Original line number Diff line number Diff line Loading @@ -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 }; /* * */ Loading Loading @@ -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; }; Loading
include/sound/core.h +14 −80 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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))); Loading Loading @@ -431,32 +399,22 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) */ #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));\ 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 */ Loading @@ -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 */ Loading