linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: fix a regression of ACPI device driver autoloading
@ 2008-03-20  8:40 Zhang, Rui
  2008-03-20 10:27 ` Thomas Renninger
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Rui @ 2008-03-20  8:40 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, kasievers, fseidel, Brown, Len, Thomas Renninger

From: Zhang Rui <rui.zhang@intel.com>

Fix a regression of ACPI driver autoloading.

commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 sets the cid of
ACPI video/dock/bay device and leaves the hid empty.
As a result, "modalias" should export the cid for
devices which don't have a hid.

ACPI Video driver is not autoloaded with
commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 applied.
"cat /sys/.../device:03(acpi video bus)/modalias" shows nothing.

ACPI Video driver is autoloaded after revert that commit.
"cat /sys/.../LNXVIDEO:0x/modalias" shows "acpi:LNXVIDEO:"

ACPI Video driver is autoloaded with commit
3620f2f2f39e7870cf1a4fb2e34063a142f28716 and this patch applied.
"cat /sys/.../device:03(acpi video bus)/modalias"
shows "acpi:LNXVIDEO:"

CC: Thomas Renninger <trenn@novell.com>
CC: Kay Sievers <kasievers@novell.com>
CC: Frank Seidel <fseidel@suse.de>
CC: Len Brown: <len.brown@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/scan.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Index: linux-2.6/drivers/acpi/scan.c
===================================================================
--- linux-2.6.orig/drivers/acpi/scan.c
+++ linux-2.6/drivers/acpi/scan.c
@@ -39,20 +39,26 @@ static int create_modalias(struct acpi_d
 			   int size)
 {
 	int len;
+	int count;
 
-	if (!acpi_dev->flags.hardware_id)
+	if (!acpi_dev->flags.hardware_id && !acpi_dev->flags.compatible_ids)
 		return -ENODEV;
 
-	len = snprintf(modalias, size, "acpi:%s:",
-		       acpi_dev->pnp.hardware_id);
-	if (len < 0 || len >= size)
-		return -EINVAL;
+	len = snprintf(modalias, size, "acpi:");
 	size -= len;
 
+	if (acpi_dev->flags.hardware_id) {
+		count = snprintf(&modalias[len], size, "%s:",
+				 acpi_dev->pnp.hardware_id);
+		if (count < 0 || count >= size)
+			return -EINVAL;
+		len += count;
+		size -= count;
+	}
+
 	if (acpi_dev->flags.compatible_ids) {
 		struct acpi_compatible_id_list *cid_list;
 		int i;
-		int count;
 
 		cid_list = acpi_dev->pnp.cid_list;
 		for (i = 0; i < cid_list->count; i++) {



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

* Re: [PATCH] ACPI: fix a regression of ACPI device driver autoloading
  2008-03-20  8:40 [PATCH] ACPI: fix a regression of ACPI device driver autoloading Zhang, Rui
@ 2008-03-20 10:27 ` Thomas Renninger
  2008-03-26  2:49   ` Len Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Renninger @ 2008-03-20 10:27 UTC (permalink / raw)
  To: Zhang, Rui; +Cc: Len Brown, linux-acpi, kasievers, fseidel, Brown, Len

On Thu, 2008-03-20 at 16:40 +0800, Zhang, Rui wrote:
> From: Zhang Rui <rui.zhang@intel.com>
> 
> Fix a regression of ACPI driver autoloading.
Good catch.
Patch looks correct.
This should still be 2.6.25 material?

> commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 sets the cid of
> ACPI video/dock/bay device and leaves the hid empty.
> As a result, "modalias" should export the cid for
> devices which don't have a hid.
> 
> ACPI Video driver is not autoloaded with
> commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 applied.
> "cat /sys/.../device:03(acpi video bus)/modalias" shows nothing.
> 
> ACPI Video driver is autoloaded after revert that commit.
> "cat /sys/.../LNXVIDEO:0x/modalias" shows "acpi:LNXVIDEO:"
> 
> ACPI Video driver is autoloaded with commit
> 3620f2f2f39e7870cf1a4fb2e34063a142f28716 and this patch applied.
> "cat /sys/.../device:03(acpi video bus)/modalias"
> shows "acpi:LNXVIDEO:"
> 
> CC: Thomas Renninger <trenn@novell.com>
> CC: Kay Sievers <kasievers@novell.com>
> CC: Frank Seidel <fseidel@suse.de>
> CC: Len Brown: <len.brown@intel.com>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>

Signed-off-by: Thomas Renninger <trenn@suse.de>

Thanks,

    Thomas
> 
> ---
>  drivers/acpi/scan.c |   18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> Index: linux-2.6/drivers/acpi/scan.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/scan.c
> +++ linux-2.6/drivers/acpi/scan.c
> @@ -39,20 +39,26 @@ static int create_modalias(struct acpi_d
>  			   int size)
>  {
>  	int len;
> +	int count;
>  
> -	if (!acpi_dev->flags.hardware_id)
> +	if (!acpi_dev->flags.hardware_id && !acpi_dev->flags.compatible_ids)
>  		return -ENODEV;
>  
> -	len = snprintf(modalias, size, "acpi:%s:",
> -		       acpi_dev->pnp.hardware_id);
> -	if (len < 0 || len >= size)
> -		return -EINVAL;
> +	len = snprintf(modalias, size, "acpi:");
>  	size -= len;
>  
> +	if (acpi_dev->flags.hardware_id) {
> +		count = snprintf(&modalias[len], size, "%s:",
> +				 acpi_dev->pnp.hardware_id);
> +		if (count < 0 || count >= size)
> +			return -EINVAL;
> +		len += count;
> +		size -= count;
> +	}
> +
>  	if (acpi_dev->flags.compatible_ids) {
>  		struct acpi_compatible_id_list *cid_list;
>  		int i;
> -		int count;
>  
>  		cid_list = acpi_dev->pnp.cid_list;
>  		for (i = 0; i < cid_list->count; i++) {
> 
> 


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

* Re: [PATCH] ACPI: fix a regression of ACPI device driver autoloading
  2008-03-20 10:27 ` Thomas Renninger
@ 2008-03-26  2:49   ` Len Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Len Brown @ 2008-03-26  2:49 UTC (permalink / raw)
  To: trenn; +Cc: Zhang, Rui, linux-acpi, kasievers, fseidel, Brown, Len

applied

thanks,
-Len

On Thursday 20 March 2008, Thomas Renninger wrote:
> On Thu, 2008-03-20 at 16:40 +0800, Zhang, Rui wrote:
> > From: Zhang Rui <rui.zhang@intel.com>
> > 
> > Fix a regression of ACPI driver autoloading.
> Good catch.
> Patch looks correct.
> This should still be 2.6.25 material?
> 
> > commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 sets the cid of
> > ACPI video/dock/bay device and leaves the hid empty.
> > As a result, "modalias" should export the cid for
> > devices which don't have a hid.
> > 
> > ACPI Video driver is not autoloaded with
> > commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 applied.
> > "cat /sys/.../device:03(acpi video bus)/modalias" shows nothing.
> > 
> > ACPI Video driver is autoloaded after revert that commit.
> > "cat /sys/.../LNXVIDEO:0x/modalias" shows "acpi:LNXVIDEO:"
> > 
> > ACPI Video driver is autoloaded with commit
> > 3620f2f2f39e7870cf1a4fb2e34063a142f28716 and this patch applied.
> > "cat /sys/.../device:03(acpi video bus)/modalias"
> > shows "acpi:LNXVIDEO:"
> > 
> > CC: Thomas Renninger <trenn@novell.com>
> > CC: Kay Sievers <kasievers@novell.com>
> > CC: Frank Seidel <fseidel@suse.de>
> > CC: Len Brown: <len.brown@intel.com>
> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> 
> Signed-off-by: Thomas Renninger <trenn@suse.de>
> 
> Thanks,
> 
>     Thomas
> > 
> > ---
> >  drivers/acpi/scan.c |   18 ++++++++++++------
> >  1 file changed, 12 insertions(+), 6 deletions(-)
> > 
> > Index: linux-2.6/drivers/acpi/scan.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/acpi/scan.c
> > +++ linux-2.6/drivers/acpi/scan.c
> > @@ -39,20 +39,26 @@ static int create_modalias(struct acpi_d
> >  			   int size)
> >  {
> >  	int len;
> > +	int count;
> >  
> > -	if (!acpi_dev->flags.hardware_id)
> > +	if (!acpi_dev->flags.hardware_id && !acpi_dev->flags.compatible_ids)
> >  		return -ENODEV;
> >  
> > -	len = snprintf(modalias, size, "acpi:%s:",
> > -		       acpi_dev->pnp.hardware_id);
> > -	if (len < 0 || len >= size)
> > -		return -EINVAL;
> > +	len = snprintf(modalias, size, "acpi:");
> >  	size -= len;
> >  
> > +	if (acpi_dev->flags.hardware_id) {
> > +		count = snprintf(&modalias[len], size, "%s:",
> > +				 acpi_dev->pnp.hardware_id);
> > +		if (count < 0 || count >= size)
> > +			return -EINVAL;
> > +		len += count;
> > +		size -= count;
> > +	}
> > +
> >  	if (acpi_dev->flags.compatible_ids) {
> >  		struct acpi_compatible_id_list *cid_list;
> >  		int i;
> > -		int count;
> >  
> >  		cid_list = acpi_dev->pnp.cid_list;
> >  		for (i = 0; i < cid_list->count; i++) {
> > 
> > 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



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

end of thread, other threads:[~2008-03-26  4:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20  8:40 [PATCH] ACPI: fix a regression of ACPI device driver autoloading Zhang, Rui
2008-03-20 10:27 ` Thomas Renninger
2008-03-26  2:49   ` Len Brown

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).