* [patch 4/6] ACPI processor: extract return values using PTR_ERR
@ 2008-02-15 5:24 Thomas, Sujith
2008-02-15 6:51 ` Zhao Yakui
0 siblings, 1 reply; 4+ messages in thread
From: Thomas, Sujith @ 2008-02-15 5:24 UTC (permalink / raw)
To: Andrew Morton; +Cc: lenb, mingo, linux-acpi, linux-kernel, linux-pm, Zhang, Rui
[-- Attachment #1: Type: text/plain, Size: 1715 bytes --]
From: Thomas Sujith <sujith.thomas@intel.com>
Need to extract errors using PTR_ERR macro and
process accordingly.thermal_cooling_device_register
returning NULL means that CONFIG_THERMAL=n and in that
case no need to create symbolic links.
Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
---
drivers/acpi/processor_core.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
Index: linux-2.6.24/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.24.orig/drivers/acpi/processor_core.c
+++ linux-2.6.24/drivers/acpi/processor_core.c
@@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_star
pr->cdev = thermal_cooling_device_register("Processor", device,
&processor_cooling_ops);
- if (pr->cdev)
+ if (IS_ERR(pr->cdev)) {
+ result = PTR_ERR(pr->cdev);
+ goto end;
+ }
+ if (pr->cdev) {
printk(KERN_INFO PREFIX
"%s is registered as cooling_device%d\n",
device->dev.bus_id, pr->cdev->id);
- else
- goto end;
- result = sysfs_create_link(&device->dev.kobj,
&pr->cdev->device.kobj,
- "thermal_cooling");
- if (result)
- return result;
- result = sysfs_create_link(&pr->cdev->device.kobj,
&device->dev.kobj,
- "device");
- if (result)
- return result;
+ result = sysfs_create_link(&device->dev.kobj,
+ &pr->cdev->device.kobj,
+ "thermal_cooling");
+ if (result)
+ return result;
+ result = sysfs_create_link(&pr->cdev->device.kobj,
+ &device->dev.kobj,
+ "device");
+ if (result)
+ return result;
+ }
if (pr->flags.throttling) {
printk(KERN_INFO PREFIX "%s [%s] (supports",
[-- Attachment #2: [patch 4 of 6] ACPI processor - extract return value using PTR_ERR --]
[-- Type: application/octet-stream, Size: 1658 bytes --]
From: Thomas Sujith <sujith.thomas@intel.com>
Need to extract errors using PTR_ERR macro and
process accordingly.thermal_cooling_device_register
returning NULL means that CONFIG_THERMAL=n and in that
case no need to create symbolic links.
Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
---
drivers/acpi/processor_core.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
Index: linux-2.6.24/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.24.orig/drivers/acpi/processor_core.c
+++ linux-2.6.24/drivers/acpi/processor_core.c
@@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_star
pr->cdev = thermal_cooling_device_register("Processor", device,
&processor_cooling_ops);
- if (pr->cdev)
+ if (IS_ERR(pr->cdev)) {
+ result = PTR_ERR(pr->cdev);
+ goto end;
+ }
+ if (pr->cdev) {
printk(KERN_INFO PREFIX
"%s is registered as cooling_device%d\n",
device->dev.bus_id, pr->cdev->id);
- else
- goto end;
- result = sysfs_create_link(&device->dev.kobj, &pr->cdev->device.kobj,
- "thermal_cooling");
- if (result)
- return result;
- result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj,
- "device");
- if (result)
- return result;
+ result = sysfs_create_link(&device->dev.kobj,
+ &pr->cdev->device.kobj,
+ "thermal_cooling");
+ if (result)
+ return result;
+ result = sysfs_create_link(&pr->cdev->device.kobj,
+ &device->dev.kobj,
+ "device");
+ if (result)
+ return result;
+ }
if (pr->flags.throttling) {
printk(KERN_INFO PREFIX "%s [%s] (supports",
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 4/6] ACPI processor: extract return values using PTR_ERR
2008-02-15 5:24 [patch 4/6] ACPI processor: extract return values using PTR_ERR Thomas, Sujith
@ 2008-02-15 6:51 ` Zhao Yakui
2008-02-15 10:46 ` Thomas, Sujith
0 siblings, 1 reply; 4+ messages in thread
From: Zhao Yakui @ 2008-02-15 6:51 UTC (permalink / raw)
To: Thomas, Sujith; +Cc: lenb, linux-acpi, Zhang, Rui
On Fri, 2008-02-15 at 10:54 +0530, Thomas, Sujith wrote:
> From: Thomas Sujith <sujith.thomas@intel.com>
>
> Need to extract errors using PTR_ERR macro and
> process accordingly.thermal_cooling_device_register
> returning NULL means that CONFIG_THERMAL=n and in that
> case no need to create symbolic links.
>
> Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
> ---
>
> drivers/acpi/processor_core.c | 27 ++++++++++++++++-----------
> 1 files changed, 16 insertions(+), 11 deletions(-)
>
> Index: linux-2.6.24/drivers/acpi/processor_core.c
> ===================================================================
> --- linux-2.6.24.orig/drivers/acpi/processor_core.c
> +++ linux-2.6.24/drivers/acpi/processor_core.c
> @@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_star
>
> pr->cdev = thermal_cooling_device_register("Processor", device,
> &processor_cooling_ops);
> - if (pr->cdev)
> + if (IS_ERR(pr->cdev)) {
> + result = PTR_ERR(pr->cdev);
> + goto end;
> + }
> + if (pr->cdev) {
> printk(KERN_INFO PREFIX
> "%s is registered as cooling_device%d\n",
> device->dev.bus_id, pr->cdev->id);
> - else
> - goto end;
>
> - result = sysfs_create_link(&device->dev.kobj,
> &pr->cdev->device.kobj,
> - "thermal_cooling");
> - if (result)
> - return result;
> - result = sysfs_create_link(&pr->cdev->device.kobj,
> &device->dev.kobj,
> - "device");
> - if (result)
> - return result;
> + result = sysfs_create_link(&device->dev.kobj,
> + &pr->cdev->device.kobj,
> + "thermal_cooling");
> + if (result)
> + return result;
> + result = sysfs_create_link(&pr->cdev->device.kobj,
> + &device->dev.kobj,
> + "device");
> + if (result)
> + return result;
> + }
Very good. But is it necessary to check whether the cooling device
exists before it is unregistered?
>
> if (pr->flags.throttling) {
> printk(KERN_INFO PREFIX "%s [%s] (supports",
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch 4/6] ACPI processor: extract return values using PTR_ERR
2008-02-15 6:51 ` Zhao Yakui
@ 2008-02-15 10:46 ` Thomas, Sujith
2008-02-15 23:30 ` Len Brown
0 siblings, 1 reply; 4+ messages in thread
From: Thomas, Sujith @ 2008-02-15 10:46 UTC (permalink / raw)
To: Zhao, Yakui, Andrew Morton; +Cc: lenb, linux-acpi, Zhang, Rui
[-- Attachment #1: Type: text/plain, Size: 3069 bytes --]
> -----Original Message-----
> From: Zhao, Yakui
> Sent: Friday, February 15, 2008 12:21 PM
> To: Thomas, Sujith
> Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; Zhang, Rui
> Subject: Re: [patch 4/6] ACPI processor: extract return
> values using PTR_ERR
>
> On Fri, 2008-02-15 at 10:54 +0530, Thomas, Sujith wrote:
> > From: Thomas Sujith <sujith.thomas@intel.com>
> >
> > Need to extract errors using PTR_ERR macro and
> > process accordingly.thermal_cooling_device_register
> > returning NULL means that CONFIG_THERMAL=n and in that
> > case no need to create symbolic links.
> Very good. But is it necessary to check whether the cooling device
> exists before it is unregistered?
I agree; resending the patch
Subject: ACPI processor : extract return values using PTR_ERR
From: Thomas Sujith <sujith.thomas@intel.com>
Need to extract errors using PTR_ERR macro and
process accordingly.thermal_cooling_device_register
returning NULL means that CONFIG_THERMAL=n and in that
case no need to create symbolic links.
Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
drivers/acpi/processor_core.c | 37
++++++++++++++++++++++---------------
1 files changed, 22 insertions(+), 15 deletions(-)
Index: linux-2.6.24/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.24.orig/drivers/acpi/processor_core.c
+++ linux-2.6.24/drivers/acpi/processor_core.c
@@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_star
pr->cdev = thermal_cooling_device_register("Processor", device,
&processor_cooling_ops);
- if (pr->cdev)
+ if (IS_ERR(pr->cdev)) {
+ result = PTR_ERR(pr->cdev);
+ goto end;
+ }
+ if (pr->cdev) {
printk(KERN_INFO PREFIX
"%s is registered as cooling_device%d\n",
device->dev.bus_id, pr->cdev->id);
- else
- goto end;
- result = sysfs_create_link(&device->dev.kobj,
&pr->cdev->device.kobj,
- "thermal_cooling");
- if (result)
- return result;
- result = sysfs_create_link(&pr->cdev->device.kobj,
&device->dev.kobj,
- "device");
- if (result)
- return result;
+ result = sysfs_create_link(&device->dev.kobj,
+ &pr->cdev->device.kobj,
+ "thermal_cooling");
+ if (result)
+ return result;
+ result = sysfs_create_link(&pr->cdev->device.kobj,
+ &device->dev.kobj,
+ "device");
+ if (result)
+ return result;
+ }
if (pr->flags.throttling) {
printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -809,10 +814,12 @@ static int acpi_processor_remove(struct
acpi_processor_remove_fs(device);
- sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
- sysfs_remove_link(&pr->cdev->device.kobj, "device");
- thermal_cooling_device_unregister(pr->cdev);
- pr->cdev = NULL;
+ if (pr->cdev) {
+ sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+ sysfs_remove_link(&pr->cdev->device.kobj, "device");
+ thermal_cooling_device_unregister(pr->cdev);
+ pr->cdev = NULL;
+ }
processors[pr->id] = NULL;
[-- Attachment #2: [patch 4 of 6] ACPI processor - extract return value using PTR_ERR --]
[-- Type: application/octet-stream, Size: 2247 bytes --]
Subject: ACPI processor : extract return values using PTR_ERR
From: Thomas Sujith <sujith.thomas@intel.com>
Need to extract errors using PTR_ERR macro and
process accordingly.thermal_cooling_device_register
returning NULL means that CONFIG_THERMAL=n and in that
case no need to create symbolic links.
Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
drivers/acpi/processor_core.c | 37 ++++++++++++++++++++++---------------
1 files changed, 22 insertions(+), 15 deletions(-)
Index: linux-2.6.24/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.24.orig/drivers/acpi/processor_core.c
+++ linux-2.6.24/drivers/acpi/processor_core.c
@@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_star
pr->cdev = thermal_cooling_device_register("Processor", device,
&processor_cooling_ops);
- if (pr->cdev)
+ if (IS_ERR(pr->cdev)) {
+ result = PTR_ERR(pr->cdev);
+ goto end;
+ }
+ if (pr->cdev) {
printk(KERN_INFO PREFIX
"%s is registered as cooling_device%d\n",
device->dev.bus_id, pr->cdev->id);
- else
- goto end;
- result = sysfs_create_link(&device->dev.kobj, &pr->cdev->device.kobj,
- "thermal_cooling");
- if (result)
- return result;
- result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj,
- "device");
- if (result)
- return result;
+ result = sysfs_create_link(&device->dev.kobj,
+ &pr->cdev->device.kobj,
+ "thermal_cooling");
+ if (result)
+ return result;
+ result = sysfs_create_link(&pr->cdev->device.kobj,
+ &device->dev.kobj,
+ "device");
+ if (result)
+ return result;
+ }
if (pr->flags.throttling) {
printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -809,10 +814,12 @@ static int acpi_processor_remove(struct
acpi_processor_remove_fs(device);
- sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
- sysfs_remove_link(&pr->cdev->device.kobj, "device");
- thermal_cooling_device_unregister(pr->cdev);
- pr->cdev = NULL;
+ if (pr->cdev) {
+ sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+ sysfs_remove_link(&pr->cdev->device.kobj, "device");
+ thermal_cooling_device_unregister(pr->cdev);
+ pr->cdev = NULL;
+ }
processors[pr->id] = NULL;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 4/6] ACPI processor: extract return values using PTR_ERR
2008-02-15 10:46 ` Thomas, Sujith
@ 2008-02-15 23:30 ` Len Brown
0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2008-02-15 23:30 UTC (permalink / raw)
To: Thomas, Sujith; +Cc: Zhao, Yakui, Andrew Morton, linux-acpi, Zhang, Rui
refreshed in acpi-test branch.
thanks,
-len
On Friday 15 February 2008 05:46, Thomas, Sujith wrote:
>
> > -----Original Message-----
> > From: Zhao, Yakui
> > Sent: Friday, February 15, 2008 12:21 PM
> > To: Thomas, Sujith
> > Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; Zhang, Rui
> > Subject: Re: [patch 4/6] ACPI processor: extract return
> > values using PTR_ERR
> >
> > On Fri, 2008-02-15 at 10:54 +0530, Thomas, Sujith wrote:
> > > From: Thomas Sujith <sujith.thomas@intel.com>
> > >
> > > Need to extract errors using PTR_ERR macro and
> > > process accordingly.thermal_cooling_device_register
> > > returning NULL means that CONFIG_THERMAL=n and in that
> > > case no need to create symbolic links.
>
> > Very good. But is it necessary to check whether the cooling device
> > exists before it is unregistered?
>
> I agree; resending the patch
>
> Subject: ACPI processor : extract return values using PTR_ERR
> From: Thomas Sujith <sujith.thomas@intel.com>
>
> Need to extract errors using PTR_ERR macro and
> process accordingly.thermal_cooling_device_register
> returning NULL means that CONFIG_THERMAL=n and in that
> case no need to create symbolic links.
>
> Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
> drivers/acpi/processor_core.c | 37
> ++++++++++++++++++++++---------------
> 1 files changed, 22 insertions(+), 15 deletions(-)
>
> Index: linux-2.6.24/drivers/acpi/processor_core.c
> ===================================================================
> --- linux-2.6.24.orig/drivers/acpi/processor_core.c
> +++ linux-2.6.24/drivers/acpi/processor_core.c
> @@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_star
>
> pr->cdev = thermal_cooling_device_register("Processor", device,
> &processor_cooling_ops);
> - if (pr->cdev)
> + if (IS_ERR(pr->cdev)) {
> + result = PTR_ERR(pr->cdev);
> + goto end;
> + }
> + if (pr->cdev) {
> printk(KERN_INFO PREFIX
> "%s is registered as cooling_device%d\n",
> device->dev.bus_id, pr->cdev->id);
> - else
> - goto end;
>
> - result = sysfs_create_link(&device->dev.kobj,
> &pr->cdev->device.kobj,
> - "thermal_cooling");
> - if (result)
> - return result;
> - result = sysfs_create_link(&pr->cdev->device.kobj,
> &device->dev.kobj,
> - "device");
> - if (result)
> - return result;
> + result = sysfs_create_link(&device->dev.kobj,
> + &pr->cdev->device.kobj,
> + "thermal_cooling");
> + if (result)
> + return result;
> + result = sysfs_create_link(&pr->cdev->device.kobj,
> + &device->dev.kobj,
> + "device");
> + if (result)
> + return result;
> + }
>
> if (pr->flags.throttling) {
> printk(KERN_INFO PREFIX "%s [%s] (supports",
> @@ -809,10 +814,12 @@ static int acpi_processor_remove(struct
>
> acpi_processor_remove_fs(device);
>
> - sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
> - sysfs_remove_link(&pr->cdev->device.kobj, "device");
> - thermal_cooling_device_unregister(pr->cdev);
> - pr->cdev = NULL;
> + if (pr->cdev) {
> + sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
> + sysfs_remove_link(&pr->cdev->device.kobj, "device");
> + thermal_cooling_device_unregister(pr->cdev);
> + pr->cdev = NULL;
> + }
>
> processors[pr->id] = NULL;
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-15 23:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-15 5:24 [patch 4/6] ACPI processor: extract return values using PTR_ERR Thomas, Sujith
2008-02-15 6:51 ` Zhao Yakui
2008-02-15 10:46 ` Thomas, Sujith
2008-02-15 23:30 ` Len Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox