PAS16 sound detection bug+patch

From: Paul Gortmaker (p_gortmaker@yahoo.com)
Date: Thu Mar 23 2000 - 05:13:33 EST


Hi,

I was looking at the pas16 driver the other day and noted that
detect_pas_hw was being called twice for each time the driver
probe was executed. Flow looks like the following:

init_pas2()
        if (detect_pas_hw) return ENODEV
                ....
        if (detect_pas_hw) conf_printf(hw_config)

The function probe_pas() is a superfluous redirection and can be removed.
Patch would be smaller but nuking extra if removes a level of indentation...

Thanks,
Paul.

--- pas2_card.c~ Thu Mar 9 15:06:54 2000
+++ pas2_card.c Sun Mar 12 21:18:17 2000
@@ -2,6 +2,11 @@
  * sound/pas2_card.c
  *
  * Detection routine for the Pro Audio Spectrum cards.
+ *
+ * Changelog:
+ *
+ * Paul Gortmaker: remove probe_pas, fix bug where detect_pas_hw called 2x.
+ *
  */
 
 #include <linux/config.h>
@@ -331,37 +336,27 @@
 {
         pas_irq = hw_config->irq;
 
- if (detect_pas_hw(hw_config))
- {
 
- if ((pas_model = pas_read(0xFF88)))
- {
- char temp[100];
+ if ((pas_model = pas_read(0xFF88)))
+ {
+ char temp[100];
 
- sprintf(temp,
- "%s rev %d", pas_model_names[(int) pas_model],
+ sprintf(temp, "%s rev %d", pas_model_names[(int) pas_model],
                                     pas_read(0x2789));
- conf_printf(temp, hw_config);
- }
- if (config_pas_hw(hw_config))
- {
- pas_pcm_init(hw_config);
+ conf_printf(temp, hw_config);
+ }
+ if (config_pas_hw(hw_config))
+ {
+ pas_pcm_init(hw_config);
 
 #if !defined(MODULE) && !defined(DISABLE_SB_EMULATION)
- sb_dsp_disable_midi(pas_sb_base); /* No MIDI capability */
+ sb_dsp_disable_midi(pas_sb_base); /* No MIDI capability */
 #endif
-
- pas_midi_init();
- pas_init_mixer();
- }
+ pas_midi_init();
+ pas_init_mixer();
         }
 }
 
-static inline int __init probe_pas(struct address_info *hw_config)
-{
- return detect_pas_hw(hw_config);
-}
-
 static void __exit unload_pas(struct address_info *hw_config)
 {
         extern int pas_audiodev;
@@ -423,7 +418,7 @@
                 return -EINVAL;
         }
 
- if (!probe_pas(&cfg))
+ if (!detect_pas_hw(&cfg))
                 return -ENODEV;
         attach_pas_card(&cfg);
         SOUND_LOCK;

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:38 EST