[SOUND] ice1712: build fixes

Previous thread: RSDL v0.28 for 2.6.20 -> backport to 2.6.18.8 by Fortier,Vincent [Montreal] on Saturday, March 10, 2007 - 11:15 am. (1 message)

Next thread: Kernel BUG at fs/jbd/journal.c:1786 by Paul Kosinski on Saturday, March 10, 2007 - 1:06 pm. (1 message)
From: Ralf Baechle
Date: Saturday, March 10, 2007 - 12:05 pm

CC [M]  sound/pci/hda/hda_intel.o
sound/pci/hda/hda_intel.c:1508: error: position_fix_list causes a section type conflict

Gcc like its __devinitdata readable not const, it seems.  An alternative
fix would be to remove the __devinitdata attribute but that would result
in slight runtime bloat.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b9a8e23..63b6854 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1505,7 +1505,7 @@ static int azx_dev_free(struct snd_device *device)
 /*
  * white/black-listing for position_fix
  */
-static const struct snd_pci_quirk position_fix_list[] __devinitdata = {
+static struct snd_pci_quirk position_fix_list[] __devinitdata = {
 	SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_NONE),
 	{}
 };
-

From: Ralf Baechle
Date: Saturday, March 10, 2007 - 12:26 pm

CC [M]  sound/pci/ice1712/ice1712.o
sound/pci/ice1712/ice1712.c:290: error: snd_ice1712_mixer_digmix_route_ac97 causes a section type conflict
sound/pci/ice1712/ice1712.c:1630: error: snd_ice1712_eeprom causes a section type conflict
sound/pci/ice1712/ice1712.c:1894: error: snd_ice1712_pro_internal_clock causes a section type conflict
sound/pci/ice1712/ice1712.c:1965: error: snd_ice1712_pro_internal_clock_default causes a section type conflict
sound/pci/ice1712/ice1712.c:2004: error: snd_ice1712_pro_rate_locking causes a section type conflict
sound/pci/ice1712/ice1712.c:2043: error: snd_ice1712_pro_rate_reset causes a section type conflict
sound/pci/ice1712/ice1712.c:2210: error: snd_ice1712_mixer_pro_analog_route causes a section type conflict
sound/pci/ice1712/ice1712.c:2218: error: snd_ice1712_mixer_pro_spdif_route causes a section type conflict
sound/pci/ice1712/ice1712.c:2260: error: snd_ice1712_mixer_pro_volume_rate causes a section type conflict
sound/pci/ice1712/ice1712.c:2293: error: snd_ice1712_mixer_pro_peak causes a section type conflict
sound/pci/ice1712/ice1712.c:1666: error: snd_ice1712_spdif_default causes a section type conflict
sound/pci/ice1712/ice1712.c:1717: error: snd_ice1712_spdif_maskc causes a section type conflict
sound/pci/ice1712/ice1712.c:1726: error: snd_ice1712_spdif_maskp causes a section type conflict
sound/pci/ice1712/ice1712.c:1753: error: snd_ice1712_spdif_stream causes a section type conflict

Gcc like its __devinitdata readable not const, it seems.  An alternative
fix would be to remove the __devinitdata attribute but that would result
in slight runtime bloat.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 3eeb36c..a48140b 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -735,7 +735,7 @@ static int __devinit snd_ice1712_delta_add_controls(struct snd_ice1712 *ice)
 
 
 /* entry point */
-const struct snd_ice1712_card_info ...
From: Ralf Baechle
Date: Saturday, March 10, 2007 - 12:27 pm

On Sat, Mar 10, 2007 at 07:26:41PM +0000, Ralf Baechle wrote:

Whops, please ignore this one, I send the wrong file.

  Ralf
-

From: Ralf Baechle
Date: Saturday, March 10, 2007 - 12:35 pm

CC [M]  sound/pci/ice1712/ice1712.o
sound/pci/ice1712/ice1712.c:290: error: snd_ice1712_mixer_digmix_route_ac97 causes a section type conflict
sound/pci/ice1712/ice1712.c:1630: error: snd_ice1712_eeprom causes a section type conflict
sound/pci/ice1712/ice1712.c:1894: error: snd_ice1712_pro_internal_clock causes a section type conflict
sound/pci/ice1712/ice1712.c:1965: error: snd_ice1712_pro_internal_clock_default causes a section type conflict
sound/pci/ice1712/ice1712.c:2004: error: snd_ice1712_pro_rate_locking causes a section type conflict
sound/pci/ice1712/ice1712.c:2043: error: snd_ice1712_pro_rate_reset causes a section type conflict
sound/pci/ice1712/ice1712.c:2210: error: snd_ice1712_mixer_pro_analog_route causes a section type conflict
sound/pci/ice1712/ice1712.c:2218: error: snd_ice1712_mixer_pro_spdif_route causes a section type conflict
sound/pci/ice1712/ice1712.c:2260: error: snd_ice1712_mixer_pro_volume_rate causes a section type conflict
sound/pci/ice1712/ice1712.c:2293: error: snd_ice1712_mixer_pro_peak causes a section type conflict
sound/pci/ice1712/ice1712.c:1666: error: snd_ice1712_spdif_default causes a section type conflict
sound/pci/ice1712/ice1712.c:1717: error: snd_ice1712_spdif_maskc causes a section type conflict
sound/pci/ice1712/ice1712.c:1726: error: snd_ice1712_spdif_maskp causes a section type conflict
sound/pci/ice1712/ice1712.c:1753: error: snd_ice1712_spdif_stream causes a section type conflict

Gcc like its __devinitdata readable not const, it seems.  An alternative
fix would be to remove the __devinitdata attribute but that would result
in slight runtime bloat.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

---

Take 2, the complete version of the patch.

diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 3eeb36c..af65980 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -416,7 +416,7 @@ static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kco
 	return 0;
 }
 ...
From: Takashi Iwai
Date: Monday, March 12, 2007 - 4:04 am

At Sat, 10 Mar 2007 19:05:13 +0000,

It's no big problem to remove const in these cases, but allowing const
with __devinitdata seems the right fix to me...


-

From: Ralf Baechle
Date: Monday, March 12, 2007 - 6:53 am

Gccs derives the readability of a section used with __attribute(section())
from the first use, which in case of this driver was a non-const use, so
gcc made .init.data a r/w section.  Later uses were marked with const,
so did conflict.  Having to ensure that all members of a section are const
or are not const is painful, so this is clearly less than desirable
behaviour on gcc's side.  I think gcc picking the most permissive
attributes for a section, that is r/w in this case would be far preferable.

Here is a small test case btw:

int foo __attribute__ ((__section__ (".init.data"))) = 23;
const int bar __attribute__ ((__section__ (".init.data"))) = 42;

Now I'm not a great fan of the patch I've posted but it reflects what real
world gcc is doing so for the time being I don't see much of a chance to
The Right Thing (TM).  And the gain from const in this case will be small
anyway.

  Ralf
-

From: Takashi Iwai
Date: Monday, March 12, 2007 - 7:43 am

At Mon, 12 Mar 2007 13:53:51 +0000,

Fair enough.  I agree that removing const is the only reasonable fix
right now.   But from semantics, const is a good thing, and people may
try to add it again later if we get rid of them now.  So, how about to
comment out such as /*const*/ in each place to remind that it's
intentional?

Also, in your patch to ice1712, you don't have to remove const from the
codes in snd_ice1712_read_eeprom() and snd_ice1712_probe() functions.
They should work as const pointer.


Takashi
-

From: Ralf Baechle
Date: Monday, March 12, 2007 - 8:46 am

I consider that harder to read and uglier.  If anything maybe something
like:

#define __const_devinit
[...]
static __const_devinit struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status __devinitdata =


No, that results in warnings:

  CC      sound/pci/ice1712/ice1712.o
sound/pci/ice1712/ice1712.c: In function ‘snd_ice1712_read_eeprom’:
sound/pci/ice1712/ice1712.c:2354: warning: assignment from incompatible pointer type
sound/pci/ice1712/ice1712.c: In function ‘snd_ice1712_probe’:
sound/pci/ice1712/ice1712.c:2693: warning: assignment from incompatible pointer type

  Ralf
-

From: Takashi Iwai
Date: Monday, March 12, 2007 - 9:38 am

At Mon, 12 Mar 2007 15:46:47 +0000,


Ah, that's a nasty part of C const.  It should be like
	const struct snd_ice1712_card_info *c;
but for pointer-of-pointer, something like
	struct snd_ice1712_card_info * const *tbl;
...?


Takashi
-

From: Ralf Baechle
Date: Tuesday, March 13, 2007 - 5:42 am

Well, that works.

Andrew, I'm going to post an updated patch in separate email.

  Ralf
-

Previous thread: RSDL v0.28 for 2.6.20 -> backport to 2.6.18.8 by Fortier,Vincent [Montreal] on Saturday, March 10, 2007 - 11:15 am. (1 message)

Next thread: Kernel BUG at fs/jbd/journal.c:1786 by Paul Kosinski on Saturday, March 10, 2007 - 1:06 pm. (1 message)