* Re: [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken
2008-12-21 23:53 [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken Bryan Kadzban
@ 2008-12-22 2:29 ` Kay Sievers
2008-12-22 6:05 ` Bryan Kadzban
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2008-12-22 2:29 UTC (permalink / raw)
To: linux-hotplug
2008/12/22 Bryan Kadzban <bryan@kadzban.is-a-geek.net>:
> Upgraded to kernel 2.6.27.8 about a week ago, along with udev 135. On
> the next boot, rtc-cmos did not load automatically. Tracked it down to
> two related changes: the PNPBIOS "id" shell hack was removed from udev,
> and ACPI modaliases were added to the kernel modules.
>
> The problem here is, the kernel hardware IDs have a different case,
> while the module aliases in rtc-cmos have the same case. The PNPBIOS ID
> for my RTC is "PNP0b00" (/sys/bus/pnp/devices/00:02/id). The ACPI ID
> for my RTC is "acpi:PNP0B00" (/sys/bus/acpi/devices/PNP0B00:00/modalias).
>
> The module aliases in the rtc-cmos driver, OTOH, are "pnp:dPNP0b00*",
> "acpi*:PNP0b00:*", and similar for 0b01 and 0b02. Obviously this isn't
> going to match.
I tested it only with the floppy module which is numeric only. :)
> I have a patch to change the kernel's file2alias.c program to convert
> the ACPI alias (for PNP device IDs) to uppercase (attached), but I don't
> know if this is the right approach. Are all ACPI IDs uppercase hex
> values? (For that matter, are all PNPBIOS IDs lowercase?) The other
> option would be to change the rtc-cmos driver to match both upper and
> lowercase (if both are seen in the wild).
I'm pretty sure, that these values are always uppercase. Not sure why
the pnp bus uses tolower() for char 4-7 of the 8 byte array, that
looks pretty broken.
> In case this is the right fix:
That looks like the right fix. Maybe you could use strdup()? Care to
send it to lkml and Cc: Greg, so he can pick it up?
Thanks a lot,
Kay
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken
2008-12-21 23:53 [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken Bryan Kadzban
2008-12-22 2:29 ` Kay Sievers
@ 2008-12-22 6:05 ` Bryan Kadzban
2008-12-22 8:38 ` Matthias Schwarzott
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Bryan Kadzban @ 2008-12-22 6:05 UTC (permalink / raw)
To: linux-hotplug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Kay Sievers wrote:
> I'm pretty sure, that these values are always uppercase. Not sure why
> the pnp bus uses tolower() for char 4-7 of the 8 byte array, that
> looks pretty broken.
Hmm. Sounds like pnp might need a fix then? Or whatever.
> That looks like the right fix. Maybe you could use strdup()?
I could (and that was what I did at first). Then I figured, since I'm
going through every byte anyway, why not copy and uppercase at the same
time. A naive strdup (malloc plus copy each byte), plus this loop to
convert, would take longer to run than just a malloc and this loop.
However, it's not like this code is a large chunk of a kernel compile,
either; I'm guessing strdup is more readable, so that's fine too.
Doesn't really matter to me.
> Care to send it to lkml and Cc: Greg, so he can pick it up?
I can, but it will be a while. (I'm about to take ~2 weeks off starting
Tuesday and fly back across a continent for the upcoming holidays. It
will be hard to keep up on something like that while I'm out, so I'll
probably just wait until I get back.)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEAREDAAYFAklPLjIACgkQYasYN+YI5W5g+ACeNCOyTmBcfASseCRfDnWMCxt+
NvMAnR7dLKAsqIXGIctjUuU4uBkxj/Cl
=3JZI
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken
2008-12-21 23:53 [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken Bryan Kadzban
2008-12-22 2:29 ` Kay Sievers
2008-12-22 6:05 ` Bryan Kadzban
@ 2008-12-22 8:38 ` Matthias Schwarzott
2008-12-22 17:16 ` Bryan Kadzban
2008-12-23 4:11 ` Kay Sievers
4 siblings, 0 replies; 6+ messages in thread
From: Matthias Schwarzott @ 2008-12-22 8:38 UTC (permalink / raw)
To: linux-hotplug
On Montag, 22. Dezember 2008, Bryan Kadzban wrote:
> Upgraded to kernel 2.6.27.8 about a week ago, along with udev 135. On
> the next boot, rtc-cmos did not load automatically. Tracked it down to
> two related changes: the PNPBIOS "id" shell hack was removed from udev,
> and ACPI modaliases were added to the kernel modules.
>
This sounds exactly like this bug report:
http://bugs.gentoo.org/show_bug.cgi?id%1453
Regards
Matthias
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken
2008-12-21 23:53 [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken Bryan Kadzban
` (2 preceding siblings ...)
2008-12-22 8:38 ` Matthias Schwarzott
@ 2008-12-22 17:16 ` Bryan Kadzban
2008-12-23 4:11 ` Kay Sievers
4 siblings, 0 replies; 6+ messages in thread
From: Bryan Kadzban @ 2008-12-22 17:16 UTC (permalink / raw)
To: linux-hotplug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Matthias Schwarzott wrote:
> On Montag, 22. Dezember 2008, Bryan Kadzban wrote:
>> Upgraded to kernel 2.6.27.8 about a week ago, along with udev 135.
>> On the next boot, rtc-cmos did not load automatically. Tracked it
>> down to two related changes: the PNPBIOS "id" shell hack was
>> removed from udev, and ACPI modaliases were added to the kernel
>> modules.
>
> This sounds exactly like this bug report:
> http://bugs.gentoo.org/show_bug.cgi?id%1453
Yep, that sounds like exactly the same symptoms. :-)
(You wouldn't happen to want to try pushing this patch for me over the
next several days, would you? I suspect not -- and I can get it too,
just later. Oh well. :-) )
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEAREDAAYFAklPy4kACgkQYasYN+YI5W5m5QCeLjWXO+HNo+hXJqteEzM7x1js
HEIAoJ/pdxORhRJUWj51U2uK8IHYeJwY
=cwxS
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken
2008-12-21 23:53 [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken Bryan Kadzban
` (3 preceding siblings ...)
2008-12-22 17:16 ` Bryan Kadzban
@ 2008-12-23 4:11 ` Kay Sievers
4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2008-12-23 4:11 UTC (permalink / raw)
To: linux-hotplug
On Sun, 2008-12-21 at 22:05 -0800, Bryan Kadzban wrote:
> Kay Sievers wrote:
> > I'm pretty sure, that these values are always uppercase. Not sure why
> > the pnp bus uses tolower() for char 4-7 of the 8 byte array, that
> > looks pretty broken.
>
> Hmm. Sounds like pnp might need a fix then? Or whatever.
We should not change it, it might confuse existing stuff. The pnp bus
has no proper modalias anyway, so we do not really care with the ACPI
stuff working properly.
> > That looks like the right fix. Maybe you could use strdup()?
>
> I could (and that was what I did at first). Then I figured, since I'm
> going through every byte anyway, why not copy and uppercase at the same
> time.
Ah, I see, missed that detail. We can drop the whole allocation, as the
string length is known, and always 8 bytes long.
> > Care to send it to lkml and Cc: Greg, so he can pick it up?
>
> I can, but it will be a while. (I'm about to take ~2 weeks off starting
> Tuesday and fly back across a continent for the upcoming holidays. It
> will be hard to keep up on something like that while I'm out, so I'll
> probably just wait until I get back.)
Here is an updated patch. Thanks a lot for the fix.
Kay
Subject: pnp: fix broken pnp lowercasing for acpi module aliases
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
---
file2alias.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index d4dc222..491b8b1 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -366,11 +366,17 @@ static void do_pnp_device_entry(void *symval, unsigned long size,
for (i = 0; i < count; i++) {
const char *id = (char *)devs[i].id;
+ char acpi_id[sizeof(devs[0].id)];
+ int j;
buf_printf(&mod->dev_table_buf,
"MODULE_ALIAS(\"pnp:d%s*\");\n", id);
+
+ /* fix broken pnp bus lowercasing */
+ for (j = 0; j < sizeof(acpi_id); j++)
+ acpi_id[j] = toupper(id[j]);
buf_printf(&mod->dev_table_buf,
- "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
+ "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id);
}
}
@@ -416,10 +422,17 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
/* add an individual alias for every device entry */
if (!dup) {
+ char acpi_id[sizeof(card->devs[0].id)];
+ int k;
+
buf_printf(&mod->dev_table_buf,
"MODULE_ALIAS(\"pnp:d%s*\");\n", id);
+
+ /* fix broken pnp bus lowercasing */
+ for (k = 0; k < sizeof(acpi_id); k++)
+ acpi_id[k] = toupper(id[k]);
buf_printf(&mod->dev_table_buf,
- "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
+ "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id);
}
}
}
^ permalink raw reply related [flat|nested] 6+ messages in thread