Re: [RFC] [PATCH] rtc-cmos PNPBIOS module autoload broken

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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);
 			}
 		}
 	}



--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux