public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: <lenb@kernel.org>
Cc: <toshi.kani@hp.com>, <liuj97@gmail.com>,
	<linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] create sun sysfs file
Date: Thu, 30 Aug 2012 10:34:03 +0900	[thread overview]
Message-ID: <503EC30B.2070900@jp.fujitsu.com> (raw)
In-Reply-To: <502062FB.7030502@jp.fujitsu.com>

Hi Len,

Three weeks passed after I post the patch.
All comments have already been applied to it. And I think there is no
comments about it. So I want you to merge it into your tree.

Thanks,
Yasuaki Ishimatsu

2012/08/07 9:36, Yasuaki Ishimatsu wrote:
> Even if a device has _SUN method, there is no way to know the slot unique-ID.
> Thus the patch creates "sun" file in sysfs so that we can recognize it.
> 
> Reviewed-by: Toshi Kani <toshi.kani@hp.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> 
> ---
>   drivers/acpi/scan.c     |   24 ++++++++++++++++++++++++
>   include/acpi/acpi_bus.h |    1 +
>   2 files changed, 25 insertions(+)
> 
> Index: linux-3.5/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-3.5.orig/include/acpi/acpi_bus.h	2012-07-30 10:06:49.722171575 +0900
> +++ linux-3.5/include/acpi/acpi_bus.h	2012-08-07 08:57:45.678204360 +0900
> @@ -209,6 +209,7 @@ struct acpi_device_pnp {
>   	struct list_head ids;		/* _HID and _CIDs */
>   	acpi_device_name device_name;	/* Driver-determined */
>   	acpi_device_class device_class;	/*        "          */
> +	unsigned long sun;		/* _SUN */
>   };
>   
>   #define acpi_device_bid(d)	((d)->pnp.bus_id)
> Index: linux-3.5/drivers/acpi/scan.c
> ===================================================================
> --- linux-3.5.orig/drivers/acpi/scan.c	2012-07-30 10:06:49.713171688 +0900
> +++ linux-3.5/drivers/acpi/scan.c	2012-08-07 09:01:38.196203659 +0900
> @@ -192,10 +192,20 @@ end:
>   }
>   static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
>   
> +static ssize_t
> +acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
> +		     char *buf) {
> +	struct acpi_device *acpi_dev = to_acpi_device(dev);
> +
> +	return sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
> +}
> +static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
> +
>   static int acpi_device_setup_files(struct acpi_device *dev)
>   {
>   	acpi_status status;
>   	acpi_handle temp;
> +	unsigned long long sun;
>   	int result = 0;
>   
>   	/*
> @@ -217,6 +227,16 @@ static int acpi_device_setup_files(struc
>   			goto end;
>   	}
>   
> +	status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun);
> +	if (ACPI_SUCCESS(status)) {
> +		dev->pnp.sun = (unsigned long)sun;
> +		result = device_create_file(&dev->dev, &dev_attr_sun);
> +		if (result)
> +			goto end;
> +	} else {
> +		dev->pnp.sun = (unsigned long)-1;
> +	}
> +
>           /*
>            * If device has _EJ0, 'eject' file is created that is used to trigger
>            * hot-removal function from userland.
> @@ -241,6 +261,10 @@ static void acpi_device_remove_files(str
>   	if (ACPI_SUCCESS(status))
>   		device_remove_file(&dev->dev, &dev_attr_eject);
>   
> +	status = acpi_get_handle(dev->handle, "_SUN", &temp);
> +	if (ACPI_SUCCESS(status))
> +		device_remove_file(&dev->dev, &dev_attr_sun);
> +
>   	device_remove_file(&dev->dev, &dev_attr_modalias);
>   	device_remove_file(&dev->dev, &dev_attr_hid);
>   	if (dev->handle)
> 
> --
> 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
> 



  reply	other threads:[~2012-08-30  1:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07  0:36 [PATCH v4] create sun sysfs file Yasuaki Ishimatsu
2012-08-30  1:34 ` Yasuaki Ishimatsu [this message]
2012-09-24  2:31   ` Yasuaki Ishimatsu
2012-10-03  9:54     ` Yasuaki Ishimatsu
2012-10-08 23:57       ` Yasuaki Ishimatsu
2012-10-09  5:05         ` Len Brown
2012-10-09  5:13           ` Yasuaki Ishimatsu

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=503EC30B.2070900@jp.fujitsu.com \
    --to=isimatu.yasuaki@jp.fujitsu.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuj97@gmail.com \
    --cc=toshi.kani@hp.com \
    /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