linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Regression: commit "ide: constify struct ide_port_info" causes breakage
@ 2007-10-26 15:56 Russell King
  2007-10-26 16:10 ` Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Russell King @ 2007-10-26 15:56 UTC (permalink / raw)
  To: linux-ide, Bartlomiej Zolnierkiewicz, Jeff Garzik, Alan Cox
  Cc: Linux Kernel List, Andrew Morton, Linus Torvalds

commit 8562043606430185cad26d085d46adcc7ad67fd1 is broken, causing:

  CC      drivers/ide/pci/cmd64x.o
  CC      drivers/ide/pci/hpt366.o
drivers/ide/pci/hpt366.c:1428: error: hpt366_chipsets causes a section type conflict

and therefore should be reverted.

The problem arises because hpt366 has other data marked with __devinitdata,
so the compiler tries to define the initdata section with read-write
attributes at one point, and read-only attributes when encountering the
const-but-devinitdata declaration:

static struct hpt_info hpt36x __devinitdata = {
static struct hpt_info hpt370 __devinitdata = {
static struct hpt_info hpt370a __devinitdata = {
...
static const struct ide_port_info hpt366_chipsets[] __devinitdata = {

If we want ide_port_info to be read-only initdata, then we need
__devroinitdata and __roinitdata tags.

Note: it doesn't show up in cmd64x.c because that file contains no other
data marked as initdata or devinitdata.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression: commit "ide: constify struct ide_port_info" causes breakage
  2007-10-26 15:56 Regression: commit "ide: constify struct ide_port_info" causes breakage Russell King
@ 2007-10-26 16:10 ` Sergei Shtylyov
  2007-10-26 16:30   ` Linus Torvalds
  2007-10-26 16:12 ` Linus Torvalds
  2007-10-26 18:18 ` Bartlomiej Zolnierkiewicz
  2 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2007-10-26 16:10 UTC (permalink / raw)
  To: Russell King
  Cc: linux-ide, Bartlomiej Zolnierkiewicz, Jeff Garzik, Alan Cox,
	Linux Kernel List, Andrew Morton, Linus Torvalds

Hello.

Russell King wrote:

> commit 8562043606430185cad26d085d46adcc7ad67fd1 is broken, causing:

>   CC      drivers/ide/pci/cmd64x.o
>   CC      drivers/ide/pci/hpt366.o
> drivers/ide/pci/hpt366.c:1428: error: hpt366_chipsets causes a section type conflict

> and therefore should be reverted.
> 
> The problem arises because hpt366 has other data marked with __devinitdata,
> so the compiler tries to define the initdata section with read-write
> attributes at one point, and read-only attributes when encountering the
> const-but-devinitdata declaration:
> 
> static struct hpt_info hpt36x __devinitdata = {
> static struct hpt_info hpt370 __devinitdata = {
> static struct hpt_info hpt370a __devinitdata = {
> ...
> static const struct ide_port_info hpt366_chipsets[] __devinitdata = {

> If we want ide_port_info to be read-only initdata, then we need
> __devroinitdata and __roinitdata tags.

    We can just convert cariables declared as 'struct hpt_info' to const too 
-- they are read-only templates.

MBR, Sergei

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression: commit "ide: constify struct ide_port_info" causes breakage
  2007-10-26 15:56 Regression: commit "ide: constify struct ide_port_info" causes breakage Russell King
  2007-10-26 16:10 ` Sergei Shtylyov
@ 2007-10-26 16:12 ` Linus Torvalds
  2007-10-26 18:18 ` Bartlomiej Zolnierkiewicz
  2 siblings, 0 replies; 7+ messages in thread
From: Linus Torvalds @ 2007-10-26 16:12 UTC (permalink / raw)
  To: Russell King
  Cc: linux-ide, Bartlomiej Zolnierkiewicz, Jeff Garzik, Alan Cox,
	Linux Kernel List, Andrew Morton



On Fri, 26 Oct 2007, Russell King wrote:
>
> commit 8562043606430185cad26d085d46adcc7ad67fd1 is broken, causing:
> 
>   CC      drivers/ide/pci/cmd64x.o
>   CC      drivers/ide/pci/hpt366.o
> drivers/ide/pci/hpt366.c:1428: error: hpt366_chipsets causes a section type conflict
> 
> and therefore should be reverted.
> 
> The problem arises because hpt366 has other data marked with __devinitdata,
> so the compiler tries to define the initdata section with read-write
> attributes at one point, and read-only attributes when encountering the
> const-but-devinitdata declaration:

Sad. This is not too uncommon, but yeah, it's really sad that we cannot 
use "const" (as a compiler type safety marker) together with section 
definitions (to get it put in special init sections).

Bartlomiej - I don't think we need to revert the whole commit, but all 
those "static const xyz __devinitdata = { .." things probably do need to 
have the const removed, even if it would be otherwise correct ;(

		Linus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression: commit "ide: constify struct ide_port_info" causes breakage
  2007-10-26 16:10 ` Sergei Shtylyov
@ 2007-10-26 16:30   ` Linus Torvalds
  2007-10-26 16:38     ` Sergei Shtylyov
  2007-10-26 17:05     ` Arjan van de Ven
  0 siblings, 2 replies; 7+ messages in thread
From: Linus Torvalds @ 2007-10-26 16:30 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Russell King, linux-ide, Bartlomiej Zolnierkiewicz, Jeff Garzik,
	Alan Cox, Linux Kernel List, Andrew Morton



On Fri, 26 Oct 2007, Sergei Shtylyov wrote:
> 
>    We can just convert cariables declared as 'struct hpt_info' to const too -- 
> they are read-only templates.

Generally "__devinitdata" is better than "const", since it means that the 
data may be thrown away.

So if you drop one over the other, it's generally the "const" that should 
be dropped ;/

		Linus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression: commit "ide: constify struct ide_port_info" causes breakage
  2007-10-26 16:30   ` Linus Torvalds
@ 2007-10-26 16:38     ` Sergei Shtylyov
  2007-10-26 17:05     ` Arjan van de Ven
  1 sibling, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2007-10-26 16:38 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Russell King, linux-ide, Bartlomiej Zolnierkiewicz, Jeff Garzik,
	Alan Cox, Linux Kernel List, Andrew Morton

Hello.

Linus Torvalds wrote:

>>   We can just convert cariables declared as 'struct hpt_info' to const too -- 
>>they are read-only templates.

> Generally "__devinitdata" is better than "const", since it means that the 
> data may be thrown away.

    Agreed.

> So if you drop one over the other,

    No, just add 'const' to already __devinitdata data to make gcc happy again.

> it's generally the "const" that should be dropped ;/

    Well, this may break when/if we need to add __devinitdata that is actually 
r/w -- not likely with this driver but still...

> 		Linus

WBR, Sergei

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression: commit "ide: constify struct ide_port_info" causes breakage
  2007-10-26 16:30   ` Linus Torvalds
  2007-10-26 16:38     ` Sergei Shtylyov
@ 2007-10-26 17:05     ` Arjan van de Ven
  1 sibling, 0 replies; 7+ messages in thread
From: Arjan van de Ven @ 2007-10-26 17:05 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Sergei Shtylyov, Russell King, linux-ide,
	Bartlomiej Zolnierkiewicz, Jeff Garzik, Alan Cox,
	Linux Kernel List, Andrew Morton

On Fri, 26 Oct 2007 09:30:20 -0700 (PDT)
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> 
> 
> On Fri, 26 Oct 2007, Sergei Shtylyov wrote:
> > 
> >    We can just convert cariables declared as 'struct hpt_info' to
> > const too -- they are read-only templates.
> 
> Generally "__devinitdata" is better than "const", since it means that
> the data may be thrown away.
> 
> So if you drop one over the other, it's generally the "const" that
> should be dropped ;/
> 

we could do a
__constdevinitdata
that translate to "const" for the "not throw away" cases, and to the
throw-away secontion for the other cases...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression: commit "ide: constify struct ide_port_info" causes breakage
  2007-10-26 15:56 Regression: commit "ide: constify struct ide_port_info" causes breakage Russell King
  2007-10-26 16:10 ` Sergei Shtylyov
  2007-10-26 16:12 ` Linus Torvalds
@ 2007-10-26 18:18 ` Bartlomiej Zolnierkiewicz
  2 siblings, 0 replies; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-10-26 18:18 UTC (permalink / raw)
  To: Russell King
  Cc: linux-ide, Jeff Garzik, Alan Cox, Linux Kernel List,
	Andrew Morton, Linus Torvalds

On Friday 26 October 2007, Russell King wrote:
> commit 8562043606430185cad26d085d46adcc7ad67fd1 is broken, causing:
> 
>   CC      drivers/ide/pci/cmd64x.o
>   CC      drivers/ide/pci/hpt366.o
> drivers/ide/pci/hpt366.c:1428: error: hpt366_chipsets causes a section type conflict
> 
> and therefore should be reverted.

Fixed 3 days ago, patch was posted to LKML.

http://lkml.org/lkml/2007/10/23/411

[ Will be pushed to Linus together with few other fixes soon. ]

> The problem arises because hpt366 has other data marked with __devinitdata,
> so the compiler tries to define the initdata section with read-write
> attributes at one point, and read-only attributes when encountering the
> const-but-devinitdata declaration:
> 
> static struct hpt_info hpt36x __devinitdata = {
> static struct hpt_info hpt370 __devinitdata = {
> static struct hpt_info hpt370a __devinitdata = {
> ...
> static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
> 
> If we want ide_port_info to be read-only initdata, then we need
> __devroinitdata and __roinitdata tags.

http://lkml.org/lkml/2007/10/23/412

Thanks,
Bart

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-10-26 18:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 15:56 Regression: commit "ide: constify struct ide_port_info" causes breakage Russell King
2007-10-26 16:10 ` Sergei Shtylyov
2007-10-26 16:30   ` Linus Torvalds
2007-10-26 16:38     ` Sergei Shtylyov
2007-10-26 17:05     ` Arjan van de Ven
2007-10-26 16:12 ` Linus Torvalds
2007-10-26 18:18 ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).