From: Andreas Schwab <schwab@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Bjørn Mork" <bjorn@mork.no>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"USB list" <linux-usb@vger.kernel.org>,
linux-kernel@vger.kernel.org,
Linux-Next <linux-next@vger.kernel.org>,
linux-kbuild <linux-kbuild@vger.kernel.org>,
Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH] mod/file2alias: make modalias generation safe for cross compiling
Date: Mon, 25 Jun 2012 23:43:15 +0200 [thread overview]
Message-ID: <m28vfb130s.fsf@igel.home> (raw)
In-Reply-To: <alpine.DEB.2.00.1206252217580.21346@ayla.of.borg> (Geert Uytterhoeven's message of "Mon, 25 Jun 2012 22:32:53 +0200 (CEST)")
Geert Uytterhoeven <geert@linux-m68k.org> writes:
> Hi Andreas,
>
> On Mon, 25 Jun 2012, Andreas Schwab wrote:
>> --- /dev/null
>> +++ b/scripts/mod/devicetable-offsets.c
>> @@ -0,0 +1,171 @@
>> +#include <linux/kbuild.h>
>> +#include <linux/mod_devicetable.h>
>> +
>> +#define DEVID(devid) DEFINE(SIZE_##devid, sizeof(struct devid))
>> +#define DEVID_FIELD(devid, field) \
>> + DEFINE(OFF_##devid##_##field, offsetof(struct devid, field))
>> +
>> +int main(void)
>> +{
>> + DEVID(usb_device_id);
>> + DEVID_FIELD(usb_device_id, match_flags);
>> + DEVID_FIELD(usb_device_id, idVendor);
>> + DEVID_FIELD(usb_device_id, idProduct);
>> + DEVID_FIELD(usb_device_id, bcdDevice_lo);
>> + DEVID_FIELD(usb_device_id, bcdDevice_hi);
>> + DEVID_FIELD(usb_device_id, bDeviceClass);
>> + DEVID_FIELD(usb_device_id, bDeviceSubClass);
>> + DEVID_FIELD(usb_device_id, bDeviceProtocol);
>> + DEVID_FIELD(usb_device_id, bInterfaceClass);
>> + DEVID_FIELD(usb_device_id, bInterfaceSubClass);
>> + DEVID_FIELD(usb_device_id, bInterfaceProtocol);
>
> These are all duplicates of the structures in <linux/mod_devicetable.h>.
> Can't you get rid of the duplication by putting e.g. the following
> in <linux/mod_devicetable.h>:
>
> DEVID_START(usb_device_id);
> DEVID_FIELD(usb_device_id, __u16, match_flags);
> DEVID_FIELD(usb_device_id, __u16, idVendor);
> DEVID_FIELD(usb_device_id, __u16, idProduct);
> DEVID_FIELD(usb_device_id, __u16, bcdDevice_lo);
> DEVID_FIELD(usb_device_id, __u16, bcdDevice_hi);
> DEVID_FIELD(usb_device_id, __u8, bDeviceClass);
> DEVID_FIELD(usb_device_id, __u8, bDeviceSubClass);
> DEVID_FIELD(usb_device_id, __u8, bDeviceProtocol);
> DEVID_FIELD(usb_device_id, __u8, bInterfaceClass);
> DEVID_FIELD(usb_device_id, __u8, bInterfaceSubClass);
> DEVID_FIELD(usb_device_id, __u8, bInterfaceProtocol);
> DEVID_END();
>
> and redefining the DEVID_*() macros depending on
> 1. __KERNEL__, to generate the C struct definitions for kernel builds,
> 2. first inclusion by devicetable-offsets.c, also to generate C struct
> definitions,
> 3. second inclusion by devicetable-offsets.c, to generate the sizes and
> offset definitions for modalias?
That requires some reorganisation of the struct pnp_card_device_id which
has a somewhat complicated structure (which also accounts for the
ugliest part of the patch).
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2012-06-25 21:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 17:42 [-next] FATAL: drivers/gpu/drm/udl/udl: sizeof(struct usb_device_id)=24 is not a modulo of the size of section __mod_usb_device_table=44 Geert Uytterhoeven
2012-06-15 20:10 ` Greg Kroah-Hartman
2012-06-15 21:02 ` Geert Uytterhoeven
2012-06-15 23:12 ` Greg Kroah-Hartman
2012-06-16 13:23 ` Bjørn Mork
2012-06-16 15:43 ` Andreas Schwab
2012-06-17 14:00 ` Bjørn Mork
2012-06-17 15:42 ` Andreas Schwab
2012-06-25 12:22 ` [PATCH] mod/file2alias: make modalias generation safe for cross compiling Andreas Schwab
2012-06-25 20:32 ` Geert Uytterhoeven
2012-06-25 21:43 ` Andreas Schwab [this message]
2012-06-26 5:00 ` Sam Ravnborg
2012-06-26 13:27 ` [PATCH v2] " Andreas Schwab
2012-06-16 18:33 ` [-next] FATAL: drivers/gpu/drm/udl/udl: sizeof(struct usb_device_id)=24 is not a modulo of the size of section __mod_usb_device_table=44 Philippe De Muyter
2012-06-16 19:11 ` Greg Kroah-Hartman
2012-06-16 19:30 ` Geert Uytterhoeven
2012-06-16 18:51 ` Geert Uytterhoeven
-- strict thread matches above, loose matches on Subject: below --
2013-01-20 16:58 [PATCH] mod/file2alias: make modalias generation safe for cross compiling Andreas Schwab
2013-01-24 22:22 ` Michal Marek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m28vfb130s.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=bjorn@mork.no \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).