public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: Thomas Renninger <trenn@suse.de>
Cc: "lenb@kernel.org" <lenb@kernel.org>,
	"kay.sievers@vrfy.org" <kay.sievers@vrfy.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Bjorn Helgaas <bjorn.helgaas@hp.com>
Subject: Re: [PATCH 1/2] ACPI: Do not export hid/modalias sysfs file for ACPI objects without a HID
Date: Fri, 08 Oct 2010 08:26:21 +0800	[thread overview]
Message-ID: <1286497581.2111.3753.camel@rui> (raw)
In-Reply-To: <1285923240-31671-1-git-send-email-trenn@suse.de>

On Fri, 2010-10-01 at 16:53 +0800, Thomas Renninger wrote:
> Boot and compile tested.
> The fact that pnp.ids can now be empty needs testing on some
> further machines, though.
> 
> This should handle a "modprobe is wrongly called by udev" issue:
> https://bugzilla.kernel.org/show_bug.cgi?id=19162
> 
> Modaliase files in
> /sys/devices/LNXSYSTM:00/
> went down from 113 to 71 on my tested system.
> 
> This is a sysfs change, but userspace must already be able to handle it.
> 
> Also do not fill up pnp.ids list with a "struct hid"
> entry. This comment:
>      * This generic ID isn't useful for driver binding, but it provides
>      * the useful property that "every acpi_device has an ID."
> is still half way true:
> Best you never touch pnp.ids list directly or make sure it can be empty,
> instead use:
> char *acpi_device_hid()
> which always returns a value ("device" as a dummy if the object
> has no hid).
> 
> Signed-off-by: Thomas Renninger <trenn@suse.de>
> CC: Zhang Rui <rui.zhang@intel.com>
> CC: kay.sievers@vrfy.org
> CC: <linux-acpi@vger.kernel.org>
> CC: Bjorn Helgaas <bjorn.helgaas@hp.com>
> ---
>  drivers/acpi/scan.c |   36 ++++++++++++++++++++----------------
>  1 files changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index b23825e..d281afb 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -26,6 +26,9 @@ extern struct acpi_device *acpi_root;
>  
>  #define ACPI_IS_ROOT_DEVICE(device)    (!(device)->parent)
>  
> +/* Should be const */
> +static char* dummy_hid = "device";
> +
>  static LIST_HEAD(acpi_device_list);
>  static LIST_HEAD(acpi_bus_id_list);
>  DEFINE_MUTEX(acpi_device_lock);
> @@ -49,6 +52,9 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
>  	int count;
>  	struct acpi_hardware_id *id;
>  
> +	if (list_empty(&acpi_dev->pnp.ids))
> +		return 0;
> +
>  	len = snprintf(modalias, size, "acpi:");
>  	size -= len;
>  
> @@ -202,13 +208,15 @@ static int acpi_device_setup_files(struct acpi_device *dev)
>  			goto end;
>  	}
>  
> -	result = device_create_file(&dev->dev, &dev_attr_hid);
> -	if (result)
> -		goto end;
> +	if (!list_empty(&dev->pnp.ids)) {
> +		result = device_create_file(&dev->dev, &dev_attr_hid);
> +		if (result)
> +			goto end;
>  
> -	result = device_create_file(&dev->dev, &dev_attr_modalias);
> -	if (result)
> -		goto end;
> +		result = device_create_file(&dev->dev, &dev_attr_modalias);
> +		if (result)
> +			goto end;
> +	}
>  

the "hid" attribute exports the first entry of the device.pnp..ids list,
while "modalias" exports all the entries.
now it seems that the "hid" file is redundant, right?

thanks,
rui



  parent reply	other threads:[~2010-10-08  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-01  8:53 [PATCH 1/2] ACPI: Do not export hid/modalias sysfs file for ACPI objects without a HID Thomas Renninger
2010-10-01  8:54 ` [PATCH 2/2] ACPI/PNP: A HID value of an object never changes -> make it const Thomas Renninger
2010-10-01 19:49   ` Len Brown
2010-10-01 19:48 ` [PATCH 1/2] ACPI: Do not export hid/modalias sysfs file for ACPI objects without a HID Len Brown
2010-10-08  0:26 ` Zhang Rui [this message]
2010-10-08  7:27   ` Thomas Renninger

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=1286497581.2111.3753.camel@rui \
    --to=rui.zhang@intel.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=kay.sievers@vrfy.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=trenn@suse.de \
    /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