[PATCH] powerpc dmasound compilation fix (TRIVIAL), kernel 2.6.11

From: Per Christian Henden
Date: Mon Mar 21 2005 - 18:59:04 EST


The patch below fixes the following problem:
Compile error when compiling with CONFIG_DMASOUND_PMAC defined
and CONFIG_NVRAM not defined.

The 2.6 kernel has had this problem since 2.6.8 [1], possibly longer.

Details:

The error is

  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
sound/built-in.o(.init.text+0xb68): In function `dmasound_awacs_init':
: undefined reference to `pmac_xpram_read'
make[1]: *** [.tmp_vmlinux1] Error 1

sound/oss/dmasound/dmasound_awacs.c calls the function pmac_xpram_read(int) in
the function dmasound_awacs_init() without making sure that CONFIG_NVRAM (the
"provider" of this function) is defined. Other users of pmac_xpram_read(int)
checks for this.

The specific call is

vol = ((pmac_xpram_read( 8 ) & 7 ) << 1 );
 -- it just sets the volume, so we don't need to force users of
CONFIG_DMASOUND_PMAC to use CONFIG_NVRAM, IMHO.


Patch against 2.6.11.5:

--- linux-2.6.11.5-orig/sound/oss/dmasound/dmasound_awacs.c 2005-03-22
00:32:10.000000000 +0100
+++ linux-2.6.11.5-new/sound/oss/dmasound/dmasound_awacs.c 2005-03-22
00:30:50.000000000 +0100
@@ -2987,10 +2987,13 @@

set_hw_byteswap(io) ; /* figure out if the h/w can do it */

- /* get default volume from nvram
- * vol = (~nvram_read_byte(0x1308) & 7) << 1;
- */
+#ifdef CONFIG_NVRAM
+ /* get default volume from nvram */
vol = ((pmac_xpram_read( 8 ) & 7 ) << 1 );
+#else
+ vol = 0;
+#endif
+
/* set up tracking values */
spk_vol = vol * 100 ;
spk_vol /= 7 ; /* get set value to a percentage */


-----------

I've tested the new case when vol gets set to 0, and it has no ill effects.
It's how it's done in dmasound_atari.c:TTMixerInit().
The test was limited to compile and boot the patched kernel, test
that sound and boot-up worked as normal (as it did earlier without the patch
applied).


[1] see http://lists.debian.org/debian-powerpc/2005/03/msg00482.html


PS: Please CC me if replying, as I'm not subscribed to the lkml.


Cheers,

Per Christian Henden
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/