mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/video/backlight/mbp_nvidia_bl.c:114: error: storage size of '__mod_dmi_device_table' isn't known
@ 2008-11-14 23:41 Alexey Dobriyan
  2008-11-15 11:14 ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2008-11-14 23:41 UTC (permalink / raw)
  To: dwmw2; +Cc: linux-kernel

How can this work, given that MODULE_DEVICE_TABLE line expands into

	extern const struct dmi_device_id __mod_dmi_device_table __attribute__ ((unused, alias("mbp_device_table")));
				^^^^^^
but there is no struct dmi_device_id, there is struct dmi_system_id?

commit 239cfbde1f5843c4a24199f117d5f67f637d72d5
Author: David Woodhouse <dwmw2@infradead.org>
Date:   Tue Sep 16 16:25:24 2008 -0700

    Fix autoloading of MacBook Pro backlight driver.
    
    Use new MODULE_DEVICE_TABLE(dmi, ...) facility. There's no need for
    every driver to screw it up for themselves, when the alias can be
    generated automatically.
    
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c
index 385cba4..06964af 100644
--- a/drivers/video/backlight/mbp_nvidia_bl.c
+++ b/drivers/video/backlight/mbp_nvidia_bl.c
@@ -111,6 +111,4 @@ module_exit(mbp_exit);
 MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
 MODULE_DESCRIPTION("Nvidia-based Macbook Pro Backlight Driver");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("svnAppleInc.:pnMacBookPro3,1");
-MODULE_ALIAS("svnAppleInc.:pnMacBookPro3,2");
-MODULE_ALIAS("svnAppleInc.:pnMacBookPro4,1");
+MODULE_DEVICE_TABLE(dmi, mbp_device_table);

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

* Re: drivers/video/backlight/mbp_nvidia_bl.c:114: error: storage size of '__mod_dmi_device_table' isn't known
  2008-11-14 23:41 drivers/video/backlight/mbp_nvidia_bl.c:114: error: storage size of '__mod_dmi_device_table' isn't known Alexey Dobriyan
@ 2008-11-15 11:14 ` David Woodhouse
  2008-11-21  1:55   ` [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...) Alexey Dobriyan
  0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2008-11-15 11:14 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-kernel

On Sat, 2008-11-15 at 02:41 +0300, Alexey Dobriyan wrote:
> How can this work, given that MODULE_DEVICE_TABLE line expands into
> 
>         extern const struct dmi_device_id __mod_dmi_device_table
> __attribute__ ((unused, alias("mbp_device_table")));
>                                 ^^^^^^
> but there is no struct dmi_device_id, there is struct dmi_system_id?

Interesting question ;)

It actually looks like this...

static struct dmi_system_id __initdata mbp_device_table[] = {
	...
};

extern const struct dmi_device_id __mod_dmi_device_table \
		__attribute__ ((unused, alias("mbp_device_table")));

So 'struct dmi_device_id' isn't ever really used -- it's just like a
forward declaration of a struct, and the compiler doesn't care because
it never needs to know anything more about that struct.

Not ideal though -- we should probably see if we can fix it. I suspect
it's not worth a global change of dmi_system_id to dmi_device_id
though... got any better ideas?

Maybe we could change MODULE_GENERIC_TABLE to be more agnostic about the
datatype -- just call it and 'extern char'. After all, it's only for the
linker.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

* [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...)
  2008-11-15 11:14 ` David Woodhouse
@ 2008-11-21  1:55   ` Alexey Dobriyan
  2008-12-03  8:41     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2008-11-21  1:55 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-kernel, akpm

On Sat, Nov 15, 2008 at 11:14:52AM +0000, David Woodhouse wrote:
> On Sat, 2008-11-15 at 02:41 +0300, Alexey Dobriyan wrote:
> > How can this work, given that MODULE_DEVICE_TABLE line expands into
> > 
> >         extern const struct dmi_device_id __mod_dmi_device_table
> > __attribute__ ((unused, alias("mbp_device_table")));
> >                                 ^^^^^^
> > but there is no struct dmi_device_id, there is struct dmi_system_id?
> 
> Interesting question ;)
> 
> It actually looks like this...
> 
> static struct dmi_system_id __initdata mbp_device_table[] = {
> 	...
> };
> 
> extern const struct dmi_device_id __mod_dmi_device_table \
> 		__attribute__ ((unused, alias("mbp_device_table")));
> 
> So 'struct dmi_device_id' isn't ever really used -- it's just like a
> forward declaration of a struct, and the compiler doesn't care because
> it never needs to know anything more about that struct.
> 
> Not ideal though -- we should probably see if we can fix it. I suspect
> it's not worth a global change of dmi_system_id to dmi_device_id
> though... got any better ideas?
> 
> Maybe we could change MODULE_GENERIC_TABLE to be more agnostic about the
> datatype -- just call it and 'extern char'. After all, it's only for the
> linker.

Let's do it the most staightforward way :-)


[PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...)

drivers/video/backlight/mbp_nvidia_bl.c:114: error: storage size of '__mod_dmi_device_table' isn't known

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 include/linux/mod_devicetable.h |    1 +
 1 file changed, 1 insertion(+)

--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -443,6 +443,7 @@ struct dmi_system_id {
 	struct dmi_strmatch matches[4];
 	void *driver_data;
 };
+#define dmi_device_id dmi_system_id	/* fixup MODULE_DEVICE_TABLE(dmi,...); */
 #endif
 
 #define DMI_MATCH(a, b)	{ a, b }

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

* Re: [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...)
  2008-11-21  1:55   ` [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...) Alexey Dobriyan
@ 2008-12-03  8:41     ` Andrew Morton
  2008-12-03  9:03       ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2008-12-03  8:41 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: David Woodhouse, linux-kernel

On Fri, 21 Nov 2008 04:55:59 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:

> On Sat, Nov 15, 2008 at 11:14:52AM +0000, David Woodhouse wrote:
> > On Sat, 2008-11-15 at 02:41 +0300, Alexey Dobriyan wrote:
> > > How can this work, given that MODULE_DEVICE_TABLE line expands into
> > > 
> > >         extern const struct dmi_device_id __mod_dmi_device_table
> > > __attribute__ ((unused, alias("mbp_device_table")));
> > >                                 ^^^^^^
> > > but there is no struct dmi_device_id, there is struct dmi_system_id?
> > 
> > Interesting question ;)
> > 
> > It actually looks like this...
> > 
> > static struct dmi_system_id __initdata mbp_device_table[] = {
> > 	...
> > };
> > 
> > extern const struct dmi_device_id __mod_dmi_device_table \
> > 		__attribute__ ((unused, alias("mbp_device_table")));
> > 
> > So 'struct dmi_device_id' isn't ever really used -- it's just like a
> > forward declaration of a struct, and the compiler doesn't care because
> > it never needs to know anything more about that struct.
> > 
> > Not ideal though -- we should probably see if we can fix it. I suspect
> > it's not worth a global change of dmi_system_id to dmi_device_id
> > though... got any better ideas?
> > 
> > Maybe we could change MODULE_GENERIC_TABLE to be more agnostic about the
> > datatype -- just call it and 'extern char'. After all, it's only for the
> > linker.
> 
> Let's do it the most staightforward way :-)
> 

What happened with all this?

> [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...)
> 
> drivers/video/backlight/mbp_nvidia_bl.c:114: error: storage size of '__mod_dmi_device_table' isn't known
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  include/linux/mod_devicetable.h |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -443,6 +443,7 @@ struct dmi_system_id {
>  	struct dmi_strmatch matches[4];
>  	void *driver_data;
>  };
> +#define dmi_device_id dmi_system_id	/* fixup MODULE_DEVICE_TABLE(dmi,...); */
>  #endif
>  
>  #define DMI_MATCH(a, b)	{ a, b }

The changelog is too crappy for me.  Why did that error occur, and how
does the patch fix it?


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

* Re: [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...)
  2008-12-03  8:41     ` Andrew Morton
@ 2008-12-03  9:03       ` David Woodhouse
  2008-12-03 22:56         ` Alexey Dobriyan
  0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2008-12-03  9:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Alexey Dobriyan, linux-kernel

On Wed, 2008-12-03 at 00:41 -0800, Andrew Morton wrote:
> The changelog is too crappy for me.  Why did that error occur, and how
> does the patch fix it?

Well, you repeated the explanation of what's wrong -- although I don't
see how it actually causes an _error_; it works here.

The problem is that the MODULE_DEVICE_TABLE(dmi, foo) line expands to...

extern const struct dmi_device_id __mod_dmi_device_table
      __attribute__ ((unused, alias("foo")));

And 'struct dmi_device_id' doesn't exist -- what we have is 'struct
dmi_system_id'.

In practice, this doesn't seem to matter because we never ask the
compiler to look _inside_ that struct -- it's just like a forward
declaration of 'struct foo' and then using pointers to it.

But it looks like Alexey's managed to find a way to actually make a
compiler barf on it, so that increases the motivation to fix it
promptly...

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

* Re: [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...)
  2008-12-03  9:03       ` David Woodhouse
@ 2008-12-03 22:56         ` Alexey Dobriyan
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2008-12-03 22:56 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Andrew Morton, linux-kernel

On Wed, Dec 03, 2008 at 09:03:21AM +0000, David Woodhouse wrote:
> On Wed, 2008-12-03 at 00:41 -0800, Andrew Morton wrote:
> > The changelog is too crappy for me.  Why did that error occur, and how
> > does the patch fix it?
> 
> Well, you repeated the explanation of what's wrong -- although I don't
> see how it actually causes an _error_; it works here.

It's just gcc version,

	gcc version 3.4.6 (Gentoo 3.4.6-r2 p1.5)

which is 5-10% faster than 4.1.2, that's why I switched back to it.

> The problem is that the MODULE_DEVICE_TABLE(dmi, foo) line expands to...
> 
> extern const struct dmi_device_id __mod_dmi_device_table
>       __attribute__ ((unused, alias("foo")));
> 
> And 'struct dmi_device_id' doesn't exist -- what we have is 'struct
> dmi_system_id'.
> 
> In practice, this doesn't seem to matter because we never ask the
> compiler to look _inside_ that struct -- it's just like a forward
> declaration of 'struct foo' and then using pointers to it.
> 
> But it looks like Alexey's managed to find a way to actually make a
> compiler barf on it, so that increases the motivation to fix it
> promptly...

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

end of thread, other threads:[~2008-12-03 22:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14 23:41 drivers/video/backlight/mbp_nvidia_bl.c:114: error: storage size of '__mod_dmi_device_table' isn't known Alexey Dobriyan
2008-11-15 11:14 ` David Woodhouse
2008-11-21  1:55   ` [PATCH] Fixup MODULE_DEVICE_TABLE(dmi, ...) Alexey Dobriyan
2008-12-03  8:41     ` Andrew Morton
2008-12-03  9:03       ` David Woodhouse
2008-12-03 22:56         ` Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome