linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the thermal tree with the pm tree
@ 2014-01-06  3:14 Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2014-01-06  3:14 UTC (permalink / raw)
  To: Zhang Rui, Rafael J. Wysocki
  Cc: linux-next, linux-kernel, Mark Brown, Eduardo Valentin

[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]

Hi Zhang,

Today's linux-next merge of the thermal tree got a conflict in
drivers/cpufreq/Kconfig between commit 109df086e002 ("cpufreq: Select
PM_OPP rather than depending on it") from the pm tree and commit
77cff5926a14 ("cpufreq: cpufreq-cpu0: add dt node parsing for cooling
device properties") from the thermal tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/cpufreq/Kconfig
index 386dbc9ccdfd,6b8cde5f98af..000000000000
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@@ -181,8 -181,7 +181,8 @@@ config CPU_FREQ_GOV_CONSERVATIV
  
  config GENERIC_CPUFREQ_CPU0
  	tristate "Generic CPU0 cpufreq driver"
- 	depends on HAVE_CLK && REGULATOR && OF
 -	depends on HAVE_CLK && REGULATOR && PM_OPP && OF && THERMAL && CPU_THERMAL
++	depends on HAVE_CLK && REGULATOR && OF && THERMAL && CPU_THERMAL
 +	select PM_OPP
  	help
  	  This adds a generic cpufreq driver for CPU0 frequency management.
  	  It supports both uniprocessor (UP) and symmetric multiprocessor (SMP)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: linux-next: manual merge of the thermal tree with the pm tree
  2014-10-10  1:10 Stephen Rothwell
@ 2014-10-10  8:40 ` Zhang Rui
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2014-10-10  8:40 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Rafael J. Wysocki, linux-next, linux-kernel, Sudip Mukherjee, Aaron Lu

Hi, Stephen,

On Fri, 2014-10-10 at 12:10 +1100, Stephen Rothwell wrote:
> Hi Zhang,
> 
> Today's linux-next merge of the thermal tree got a conflict in
> drivers/acpi/fan.c between commit 88989fd26a74 ("ACPI / fan: printk
> replacement") from the pm tree and commits 71532a58d2b0 ("ACPI / fan:
> remove unused macro") and ff39c76855e8 ("ACPI / fan: convert to
> platform driver") from the thermal tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).
> 
thanks a lot for your patch, I don't know why but it seems that you
missed one conflict? how about the patch below?

thanks,
rui

diff --cc drivers/acpi/fan.c
index e007c49,5328b10..e0ba2af
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@@ -27,11 -27,15 +27,11 @@@
  #include <linux/module.h>
  #include <linux/init.h>
  #include <linux/types.h>
- #include <asm/uaccess.h>
+ #include <linux/uaccess.h>
  #include <linux/thermal.h>
  #include <linux/acpi.h>
 -
 -#define ACPI_FAN_CLASS			"fan"
 -#define ACPI_FAN_FILE_STATE		"state"
 -
 -#define _COMPONENT		ACPI_FAN_COMPONENT
 -ACPI_MODULE_NAME("fan");
 +#include <linux/platform_device.h>
 +#include <linux/sort.h>
  
  MODULE_AUTHOR("Paul Diefenbaugh");
  MODULE_DESCRIPTION("ACPI Fan Driver");
@@@ -221,128 -125,25 +221,129 @@@ static const struct thermal_cooling_dev
  };
  
  /* --------------------------------------------------------------------------
-                                  Driver Interface
-    -------------------------------------------------------------------------- */
+  *                               Driver Interface
+  * --------------------------------------------------------------------------
+ */
  
 -static int acpi_fan_add(struct acpi_device *device)
 +static bool acpi_fan_is_acpi4(struct acpi_device *device)
  {
 -	int result = 0;
 -	struct thermal_cooling_device *cdev;
 +	return acpi_has_method(device->handle, "_FIF") &&
 +	       acpi_has_method(device->handle, "_FPS") &&
 +	       acpi_has_method(device->handle, "_FSL") &&
 +	       acpi_has_method(device->handle, "_FST");
 +}
  
 -	if (!device)
 -		return -EINVAL;
 +static int acpi_fan_get_fif(struct acpi_device *device)
 +{
 +	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 +	struct acpi_fan *fan = acpi_driver_data(device);
 +	struct acpi_buffer format = { sizeof("NNNN"), "NNNN" };
 +	struct acpi_buffer fif = { sizeof(fan->fif), &fan->fif };
 +	union acpi_object *obj;
 +	acpi_status status;
 +
 +	status = acpi_evaluate_object(device->handle, "_FIF", NULL, &buffer);
 +	if (ACPI_FAILURE(status))
 +		return status;
 +
 +	obj = buffer.pointer;
 +	if (!obj || obj->type != ACPI_TYPE_PACKAGE) {
 +		dev_err(&device->dev, "Invalid _FIF data\n");
 +		status = -EINVAL;
 +		goto err;
 +	}
  
 -	strcpy(acpi_device_name(device), "Fan");
 -	strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
 +	status = acpi_extract_package(obj, &format, &fif);
 +	if (ACPI_FAILURE(status)) {
 +		dev_err(&device->dev, "Invalid _FIF element\n");
 +		status = -EINVAL;
 +	}
  
 -	result = acpi_bus_update_power(device->handle, NULL);
 -	if (result) {
 -		dev_err(&device->dev, "Setting initial power state\n");
 -		goto end;
 +err:
 +	kfree(obj);
 +	return status;
 +}
 +
 +static int acpi_fan_speed_cmp(const void *a, const void *b)
 +{
 +	const struct acpi_fan_fps *fps1 = a;
 +	const struct acpi_fan_fps *fps2 = b;
 +	return fps1->speed - fps2->speed;
 +}
 +
 +static int acpi_fan_get_fps(struct acpi_device *device)
 +{
 +	struct acpi_fan *fan = acpi_driver_data(device);
 +	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 +	union acpi_object *obj;
 +	acpi_status status;
 +	int i;
 +
 +	status = acpi_evaluate_object(device->handle, "_FPS", NULL, &buffer);
 +	if (ACPI_FAILURE(status))
 +		return status;
 +
 +	obj = buffer.pointer;
 +	if (!obj || obj->type != ACPI_TYPE_PACKAGE || obj->package.count < 2) {
 +		dev_err(&device->dev, "Invalid _FPS data\n");
 +		status = -EINVAL;
 +		goto err;
 +	}
 +
 +	fan->fps_count = obj->package.count - 1; /* minus revision field */
 +	fan->fps = devm_kzalloc(&device->dev,
 +				fan->fps_count * sizeof(struct acpi_fan_fps),
 +				GFP_KERNEL);
 +	if (!fan->fps) {
 +		dev_err(&device->dev, "Not enough memory\n");
 +		status = -ENOMEM;
 +		goto err;
 +	}
 +	for (i = 0; i < fan->fps_count; i++) {
 +		struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" };
 +		struct acpi_buffer fps = { sizeof(fan->fps[i]), &fan->fps[i] };
 +		status = acpi_extract_package(&obj->package.elements[i + 1],
 +					      &format, &fps);
 +		if (ACPI_FAILURE(status)) {
 +			dev_err(&device->dev, "Invalid _FPS element\n");
 +			break;
 +		}
 +	}
 +
 +	/* sort the state array according to fan speed in increase order */
 +	sort(fan->fps, fan->fps_count, sizeof(*fan->fps),
 +	     acpi_fan_speed_cmp, NULL);
 +
 +err:
 +	kfree(obj);
 +	return status;
 +}
 +
 +static int acpi_fan_probe(struct platform_device *pdev)
 +{
 +	int result = 0;
 +	struct thermal_cooling_device *cdev;
 +	struct acpi_fan *fan;
 +	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 +
 +	fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
 +	if (!fan) {
 +		dev_err(&device->dev, "No memory for fan\n");
 +		return -ENOMEM;
 +	}
 +	device->driver_data = fan;
 +	platform_set_drvdata(pdev, fan);
 +
 +	if (acpi_fan_is_acpi4(device)) {
 +		if (acpi_fan_get_fif(device) || acpi_fan_get_fps(device))
 +			goto end;
 +		fan->acpi4 = true;
 +	} else {
 +		result = acpi_device_update_power(device, NULL);
 +		if (result) {
 +			dev_err(&device->dev, "Setting initial power state\n");
 +			goto end;
 +		}
  	}
  
  	cdev = thermal_cooling_device_register("Fan", device,
@@@ -363,12 -164,15 +364,11 @@@
  			"'thermal_cooling'\n");
  
  	result = sysfs_create_link(&cdev->device.kobj,
 -				   &device->dev.kobj,
 +				   &pdev->dev.kobj,
  				   "device");
  	if (result)
- 		dev_err(&pdev->dev, "Failed to create sysfs link "
- 			"'device'\n");
+ 		dev_err(&device->dev, "Failed to create sysfs link 'device'\n");
  
 -	dev_info(&device->dev, "ACPI: %s [%s] (%s)\n",
 -	       acpi_device_name(device), acpi_device_bid(device),
 -	       !device->power.state ? "on" : "off");
 -
  end:
  	return result;
  }

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

* linux-next: manual merge of the thermal tree with the pm tree
@ 2014-10-10  1:10 Stephen Rothwell
  2014-10-10  8:40 ` Zhang Rui
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2014-10-10  1:10 UTC (permalink / raw)
  To: Zhang Rui, Rafael J. Wysocki
  Cc: linux-next, linux-kernel, Sudip Mukherjee, Aaron Lu

[-- Attachment #1: Type: text/plain, Size: 5686 bytes --]

Hi Zhang,

Today's linux-next merge of the thermal tree got a conflict in
drivers/acpi/fan.c between commit 88989fd26a74 ("ACPI / fan: printk
replacement") from the pm tree and commits 71532a58d2b0 ("ACPI / fan:
remove unused macro") and ff39c76855e8 ("ACPI / fan: convert to
platform driver") from the thermal tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/acpi/fan.c
index 5328b1090e08,e007c4987bea..000000000000
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@@ -27,15 -27,11 +27,11 @@@
  #include <linux/module.h>
  #include <linux/init.h>
  #include <linux/types.h>
 -#include <asm/uaccess.h>
 +#include <linux/uaccess.h>
  #include <linux/thermal.h>
  #include <linux/acpi.h>
- 
- #define ACPI_FAN_CLASS			"fan"
- #define ACPI_FAN_FILE_STATE		"state"
- 
- #define _COMPONENT		ACPI_FAN_COMPONENT
- ACPI_MODULE_NAME("fan");
+ #include <linux/platform_device.h>
+ #include <linux/sort.h>
  
  MODULE_AUTHOR("Paul Diefenbaugh");
  MODULE_DESCRIPTION("ACPI Fan Driver");
@@@ -125,25 -221,128 +221,129 @@@ static const struct thermal_cooling_dev
  };
  
  /* --------------------------------------------------------------------------
 -                                 Driver Interface
 -   -------------------------------------------------------------------------- */
 + *                               Driver Interface
 + * --------------------------------------------------------------------------
 +*/
  
- static int acpi_fan_add(struct acpi_device *device)
+ static bool acpi_fan_is_acpi4(struct acpi_device *device)
  {
- 	int result = 0;
- 	struct thermal_cooling_device *cdev;
+ 	return acpi_has_method(device->handle, "_FIF") &&
+ 	       acpi_has_method(device->handle, "_FPS") &&
+ 	       acpi_has_method(device->handle, "_FSL") &&
+ 	       acpi_has_method(device->handle, "_FST");
+ }
  
- 	if (!device)
- 		return -EINVAL;
+ static int acpi_fan_get_fif(struct acpi_device *device)
+ {
+ 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ 	struct acpi_fan *fan = acpi_driver_data(device);
+ 	struct acpi_buffer format = { sizeof("NNNN"), "NNNN" };
+ 	struct acpi_buffer fif = { sizeof(fan->fif), &fan->fif };
+ 	union acpi_object *obj;
+ 	acpi_status status;
+ 
+ 	status = acpi_evaluate_object(device->handle, "_FIF", NULL, &buffer);
+ 	if (ACPI_FAILURE(status))
+ 		return status;
+ 
+ 	obj = buffer.pointer;
+ 	if (!obj || obj->type != ACPI_TYPE_PACKAGE) {
+ 		dev_err(&device->dev, "Invalid _FIF data\n");
+ 		status = -EINVAL;
+ 		goto err;
+ 	}
  
- 	strcpy(acpi_device_name(device), "Fan");
- 	strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
+ 	status = acpi_extract_package(obj, &format, &fif);
+ 	if (ACPI_FAILURE(status)) {
+ 		dev_err(&device->dev, "Invalid _FIF element\n");
+ 		status = -EINVAL;
+ 	}
  
- 	result = acpi_bus_update_power(device->handle, NULL);
- 	if (result) {
- 		dev_err(&device->dev, "Setting initial power state\n");
- 		goto end;
+ err:
+ 	kfree(obj);
+ 	return status;
+ }
+ 
+ static int acpi_fan_speed_cmp(const void *a, const void *b)
+ {
+ 	const struct acpi_fan_fps *fps1 = a;
+ 	const struct acpi_fan_fps *fps2 = b;
+ 	return fps1->speed - fps2->speed;
+ }
+ 
+ static int acpi_fan_get_fps(struct acpi_device *device)
+ {
+ 	struct acpi_fan *fan = acpi_driver_data(device);
+ 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ 	union acpi_object *obj;
+ 	acpi_status status;
+ 	int i;
+ 
+ 	status = acpi_evaluate_object(device->handle, "_FPS", NULL, &buffer);
+ 	if (ACPI_FAILURE(status))
+ 		return status;
+ 
+ 	obj = buffer.pointer;
+ 	if (!obj || obj->type != ACPI_TYPE_PACKAGE || obj->package.count < 2) {
+ 		dev_err(&device->dev, "Invalid _FPS data\n");
+ 		status = -EINVAL;
+ 		goto err;
+ 	}
+ 
+ 	fan->fps_count = obj->package.count - 1; /* minus revision field */
+ 	fan->fps = devm_kzalloc(&device->dev,
+ 				fan->fps_count * sizeof(struct acpi_fan_fps),
+ 				GFP_KERNEL);
+ 	if (!fan->fps) {
+ 		dev_err(&device->dev, "Not enough memory\n");
+ 		status = -ENOMEM;
+ 		goto err;
+ 	}
+ 	for (i = 0; i < fan->fps_count; i++) {
+ 		struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" };
+ 		struct acpi_buffer fps = { sizeof(fan->fps[i]), &fan->fps[i] };
+ 		status = acpi_extract_package(&obj->package.elements[i + 1],
+ 					      &format, &fps);
+ 		if (ACPI_FAILURE(status)) {
+ 			dev_err(&device->dev, "Invalid _FPS element\n");
+ 			break;
+ 		}
+ 	}
+ 
+ 	/* sort the state array according to fan speed in increase order */
+ 	sort(fan->fps, fan->fps_count, sizeof(*fan->fps),
+ 	     acpi_fan_speed_cmp, NULL);
+ 
+ err:
+ 	kfree(obj);
+ 	return status;
+ }
+ 
+ static int acpi_fan_probe(struct platform_device *pdev)
+ {
+ 	int result = 0;
+ 	struct thermal_cooling_device *cdev;
+ 	struct acpi_fan *fan;
+ 	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+ 
+ 	fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
+ 	if (!fan) {
+ 		dev_err(&device->dev, "No memory for fan\n");
+ 		return -ENOMEM;
+ 	}
+ 	device->driver_data = fan;
+ 	platform_set_drvdata(pdev, fan);
+ 
+ 	if (acpi_fan_is_acpi4(device)) {
+ 		if (acpi_fan_get_fif(device) || acpi_fan_get_fps(device))
+ 			goto end;
+ 		fan->acpi4 = true;
+ 	} else {
+ 		result = acpi_device_update_power(device, NULL);
+ 		if (result) {
+ 			dev_err(&device->dev, "Setting initial power state\n");
+ 			goto end;
+ 		}
  	}
  
  	cdev = thermal_cooling_device_register("Fan", device,

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-10-10  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-06  3:14 linux-next: manual merge of the thermal tree with the pm tree Stephen Rothwell
2014-10-10  1:10 Stephen Rothwell
2014-10-10  8:40 ` Zhang Rui

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