All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct dev_pm_ops
@ 2012-07-07 21:02 ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:02 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

Hi all,

As per

http://marc.info/?l=linux-kernel&m=133996733422413&w=4

the following patches convert the platform TPM drivers to the PM handling
based on struct dev_pm_ops:

[1/4] abituguru: Use struct dev_pm_ops for power management.
[2/4] abituguru3: Use struct dev_pm_ops for power management.
[3/4] gpio-fan: Use struct dev_pm_ops for power management.
[4/4] exynos4_tmu: Use struct dev_pm_ops for power management.

Thanks,
Rafael


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

* [lm-sensors] [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct d
@ 2012-07-07 21:02 ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:02 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

Hi all,

As per

http://marc.info/?l=linux-kernel&m\x133996733422413&w=4

the following patches convert the platform TPM drivers to the PM handling
based on struct dev_pm_ops:

[1/4] abituguru: Use struct dev_pm_ops for power management.
[2/4] abituguru3: Use struct dev_pm_ops for power management.
[3/4] gpio-fan: Use struct dev_pm_ops for power management.
[4/4] exynos4_tmu: Use struct dev_pm_ops for power management.

Thanks,
Rafael


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [PATCH 1/4] hwmon / abituguru: Use struct dev_pm_ops for power management
  2012-07-07 21:02 ` [lm-sensors] [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct d Rafael J. Wysocki
@ 2012-07-07 21:04   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:04 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Abit uGuru driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/abituguru.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru.c
===================================================================
--- linux.orig/drivers/hwmon/abituguru.c
+++ linux/drivers/hwmon/abituguru.c
@@ -1514,9 +1514,11 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru_suspend(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	/*
 	 * make sure all communications with the uguru are done and no new
 	 * ones are started
@@ -1525,29 +1527,32 @@ static int abituguru_suspend(struct plat
 	return 0;
 }
 
-static int abituguru_resume(struct platform_device *pdev)
+static int abituguru_resume(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	/* See if the uGuru is still ready */
 	if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
 		data->uguru_ready = 0;
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
+#define ABIT_UGURU_PM	(&abituguru_pm)
 #else
-#define abituguru_suspend	NULL
-#define abituguru_resume	NULL
+#define ABIT_UGURU_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU_NAME,
+		.pm	= ABIT_UGURU_PM,
 	},
 	.probe		= abituguru_probe,
 	.remove		= __devexit_p(abituguru_remove),
-	.suspend	= abituguru_suspend,
-	.resume		= abituguru_resume,
 };
 
 static int __init abituguru_detect(void)


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

* [lm-sensors] [PATCH 1/4] hwmon / abituguru: Use struct dev_pm_ops for power management
@ 2012-07-07 21:04   ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:04 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Abit uGuru driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/abituguru.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru.c
=================================--- linux.orig/drivers/hwmon/abituguru.c
+++ linux/drivers/hwmon/abituguru.c
@@ -1514,9 +1514,11 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru_suspend(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	/*
 	 * make sure all communications with the uguru are done and no new
 	 * ones are started
@@ -1525,29 +1527,32 @@ static int abituguru_suspend(struct plat
 	return 0;
 }
 
-static int abituguru_resume(struct platform_device *pdev)
+static int abituguru_resume(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	/* See if the uGuru is still ready */
 	if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
 		data->uguru_ready = 0;
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
+#define ABIT_UGURU_PM	(&abituguru_pm)
 #else
-#define abituguru_suspend	NULL
-#define abituguru_resume	NULL
+#define ABIT_UGURU_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU_NAME,
+		.pm	= ABIT_UGURU_PM,
 	},
 	.probe		= abituguru_probe,
 	.remove		= __devexit_p(abituguru_remove),
-	.suspend	= abituguru_suspend,
-	.resume		= abituguru_resume,
 };
 
 static int __init abituguru_detect(void)


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [PATCH 2/4] hwmon / abituguru3: Use struct dev_pm_ops for power management
  2012-07-07 21:02 ` [lm-sensors] [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct d Rafael J. Wysocki
@ 2012-07-07 21:04   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:04 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Abit uGuru rev. 3 driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/abituguru3.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru3.c
===================================================================
--- linux.orig/drivers/hwmon/abituguru3.c
+++ linux/drivers/hwmon/abituguru3.c
@@ -1142,9 +1142,11 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru3_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru3_suspend(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	/*
 	 * make sure all communications with the uguru3 are done and no new
 	 * ones are started
@@ -1153,26 +1155,29 @@ static int abituguru3_suspend(struct pla
 	return 0;
 }
 
-static int abituguru3_resume(struct platform_device *pdev)
+static int abituguru3_resume(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
+#define ABIT_UGURU3_PM	(&abituguru3_pm)
 #else
-#define abituguru3_suspend	NULL
-#define abituguru3_resume	NULL
+#define ABIT_UGURU3_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru3_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU3_NAME,
+		.pm	= ABIT_UGURU3_PM
 	},
 	.probe	= abituguru3_probe,
 	.remove	= __devexit_p(abituguru3_remove),
-	.suspend = abituguru3_suspend,
-	.resume = abituguru3_resume
 };
 
 static int __init abituguru3_dmi_detect(void)


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

* [lm-sensors] [PATCH 2/4] hwmon / abituguru3: Use struct dev_pm_ops for power management
@ 2012-07-07 21:04   ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:04 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Abit uGuru rev. 3 driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/abituguru3.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru3.c
=================================--- linux.orig/drivers/hwmon/abituguru3.c
+++ linux/drivers/hwmon/abituguru3.c
@@ -1142,9 +1142,11 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru3_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru3_suspend(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	/*
 	 * make sure all communications with the uguru3 are done and no new
 	 * ones are started
@@ -1153,26 +1155,29 @@ static int abituguru3_suspend(struct pla
 	return 0;
 }
 
-static int abituguru3_resume(struct platform_device *pdev)
+static int abituguru3_resume(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data;
+
+	data = platform_get_drvdata(to_platform_device(dev));
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
+#define ABIT_UGURU3_PM	(&abituguru3_pm)
 #else
-#define abituguru3_suspend	NULL
-#define abituguru3_resume	NULL
+#define ABIT_UGURU3_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru3_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU3_NAME,
+		.pm	= ABIT_UGURU3_PM
 	},
 	.probe	= abituguru3_probe,
 	.remove	= __devexit_p(abituguru3_remove),
-	.suspend = abituguru3_suspend,
-	.resume = abituguru3_resume
 };
 
 static int __init abituguru3_dmi_detect(void)


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [PATCH 3/4] hwmon / gpio-fan: Use struct dev_pm_ops for power management
  2012-07-07 21:02 ` [lm-sensors] [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct d Rafael J. Wysocki
@ 2012-07-07 21:05   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:05 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the gpio-fan driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/gpio-fan.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/gpio-fan.c
===================================================================
--- linux.orig/drivers/hwmon/gpio-fan.c
+++ linux/drivers/hwmon/gpio-fan.c
@@ -503,10 +503,11 @@ static int __devexit gpio_fan_remove(str
 }
 
 #ifdef CONFIG_PM
-static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state)
+static int gpio_fan_suspend(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data;
 
+	fan_data = platform_get_drvdata(to_platform_device(dev));
 	if (fan_data->ctrl) {
 		fan_data->resume_speed = fan_data->speed_index;
 		set_fan_speed(fan_data, 0);
@@ -515,27 +516,29 @@ static int gpio_fan_suspend(struct platf
 	return 0;
 }
 
-static int gpio_fan_resume(struct platform_device *pdev)
+static int gpio_fan_resume(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data;
 
+	fan_data = platform_get_drvdata(to_platform_device(dev));
 	if (fan_data->ctrl)
 		set_fan_speed(fan_data, fan_data->resume_speed);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
+#define GPIO_FAN_PM	(&gpio_fan_pm)
 #else
-#define gpio_fan_suspend NULL
-#define gpio_fan_resume NULL
+#define GPIO_FAN_PM	NULL
 #endif
 
 static struct platform_driver gpio_fan_driver = {
 	.probe		= gpio_fan_probe,
 	.remove		= __devexit_p(gpio_fan_remove),
-	.suspend	= gpio_fan_suspend,
-	.resume		= gpio_fan_resume,
 	.driver	= {
 		.name	= "gpio-fan",
+		.pm	= GPIO_FAN_PM,
 	},
 };
 


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

* [lm-sensors] [PATCH 3/4] hwmon / gpio-fan: Use struct dev_pm_ops for power management
@ 2012-07-07 21:05   ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:05 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the gpio-fan driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/gpio-fan.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/gpio-fan.c
=================================--- linux.orig/drivers/hwmon/gpio-fan.c
+++ linux/drivers/hwmon/gpio-fan.c
@@ -503,10 +503,11 @@ static int __devexit gpio_fan_remove(str
 }
 
 #ifdef CONFIG_PM
-static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state)
+static int gpio_fan_suspend(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data;
 
+	fan_data = platform_get_drvdata(to_platform_device(dev));
 	if (fan_data->ctrl) {
 		fan_data->resume_speed = fan_data->speed_index;
 		set_fan_speed(fan_data, 0);
@@ -515,27 +516,29 @@ static int gpio_fan_suspend(struct platf
 	return 0;
 }
 
-static int gpio_fan_resume(struct platform_device *pdev)
+static int gpio_fan_resume(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data;
 
+	fan_data = platform_get_drvdata(to_platform_device(dev));
 	if (fan_data->ctrl)
 		set_fan_speed(fan_data, fan_data->resume_speed);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
+#define GPIO_FAN_PM	(&gpio_fan_pm)
 #else
-#define gpio_fan_suspend NULL
-#define gpio_fan_resume NULL
+#define GPIO_FAN_PM	NULL
 #endif
 
 static struct platform_driver gpio_fan_driver = {
 	.probe		= gpio_fan_probe,
 	.remove		= __devexit_p(gpio_fan_remove),
-	.suspend	= gpio_fan_suspend,
-	.resume		= gpio_fan_resume,
 	.driver	= {
 		.name	= "gpio-fan",
+		.pm	= GPIO_FAN_PM,
 	},
 };
 


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [PATCH 4/4] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
  2012-07-07 21:02 ` [lm-sensors] [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct d Rafael J. Wysocki
@ 2012-07-07 21:06   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:06 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Exynos4 TMU driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/exynos4_tmu.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Index: linux/drivers/hwmon/exynos4_tmu.c
===================================================================
--- linux.orig/drivers/hwmon/exynos4_tmu.c
+++ linux/drivers/hwmon/exynos4_tmu.c
@@ -476,34 +476,37 @@ static int __devexit exynos4_tmu_remove(
 }
 
 #ifdef CONFIG_PM
-static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
+static int exynos4_tmu_suspend(struct device *dev)
 {
-	exynos4_tmu_control(pdev, false);
+	exynos4_tmu_control(to_platform_device(dev), false);
 
 	return 0;
 }
 
-static int exynos4_tmu_resume(struct platform_device *pdev)
+static int exynos4_tmu_resume(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
+
 	exynos4_tmu_initialize(pdev);
 	exynos4_tmu_control(pdev, true);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm, exynos4_tmu_suspend, exynos4_tmu_resume);
+#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
 #else
-#define exynos4_tmu_suspend NULL
-#define exynos4_tmu_resume NULL
+#define EXYNOS4_TMU_PM	NULL
 #endif
 
 static struct platform_driver exynos4_tmu_driver = {
 	.driver = {
 		.name   = "exynos4-tmu",
 		.owner  = THIS_MODULE,
+		.pm     = EXYNOS4_TMU_PM,
 	},
 	.probe = exynos4_tmu_probe,
 	.remove	= __devexit_p(exynos4_tmu_remove),
-	.suspend = exynos4_tmu_suspend,
-	.resume = exynos4_tmu_resume,
 };
 
 module_platform_driver(exynos4_tmu_driver);


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

* [lm-sensors] [PATCH 4/4] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
@ 2012-07-07 21:06   ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:06 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Exynos4 TMU driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/exynos4_tmu.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Index: linux/drivers/hwmon/exynos4_tmu.c
=================================--- linux.orig/drivers/hwmon/exynos4_tmu.c
+++ linux/drivers/hwmon/exynos4_tmu.c
@@ -476,34 +476,37 @@ static int __devexit exynos4_tmu_remove(
 }
 
 #ifdef CONFIG_PM
-static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
+static int exynos4_tmu_suspend(struct device *dev)
 {
-	exynos4_tmu_control(pdev, false);
+	exynos4_tmu_control(to_platform_device(dev), false);
 
 	return 0;
 }
 
-static int exynos4_tmu_resume(struct platform_device *pdev)
+static int exynos4_tmu_resume(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
+
 	exynos4_tmu_initialize(pdev);
 	exynos4_tmu_control(pdev, true);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm, exynos4_tmu_suspend, exynos4_tmu_resume);
+#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
 #else
-#define exynos4_tmu_suspend NULL
-#define exynos4_tmu_resume NULL
+#define EXYNOS4_TMU_PM	NULL
 #endif
 
 static struct platform_driver exynos4_tmu_driver = {
 	.driver = {
 		.name   = "exynos4-tmu",
 		.owner  = THIS_MODULE,
+		.pm     = EXYNOS4_TMU_PM,
 	},
 	.probe = exynos4_tmu_probe,
 	.remove	= __devexit_p(exynos4_tmu_remove),
-	.suspend = exynos4_tmu_suspend,
-	.resume = exynos4_tmu_resume,
 };
 
 module_platform_driver(exynos4_tmu_driver);


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [PATCH 1/4][update] hwmon / abituguru: Use struct dev_pm_ops for power management
  2012-07-07 21:04   ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-07 21:59     ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:59 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: hwmon / abituguru: Use struct dev_pm_ops for power management

Make the Abit uGuru driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

dev_get_drvdata() may be used directly instead of being wrapped in
platform_get_drvdata(to_platform_device()).

---
 drivers/hwmon/abituguru.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru.c
===================================================================
--- linux.orig/drivers/hwmon/abituguru.c
+++ linux/drivers/hwmon/abituguru.c
@@ -1514,9 +1514,9 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru_suspend(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data = dev_get_drvdata(dev);
 	/*
 	 * make sure all communications with the uguru are done and no new
 	 * ones are started
@@ -1525,29 +1525,30 @@ static int abituguru_suspend(struct plat
 	return 0;
 }
 
-static int abituguru_resume(struct platform_device *pdev)
+static int abituguru_resume(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data = dev_get_drvdata(dev);
 	/* See if the uGuru is still ready */
 	if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
 		data->uguru_ready = 0;
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
+#define ABIT_UGURU_PM	(&abituguru_pm)
 #else
-#define abituguru_suspend	NULL
-#define abituguru_resume	NULL
+#define ABIT_UGURU_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU_NAME,
+		.pm	= ABIT_UGURU_PM,
 	},
 	.probe		= abituguru_probe,
 	.remove		= __devexit_p(abituguru_remove),
-	.suspend	= abituguru_suspend,
-	.resume		= abituguru_resume,
 };
 
 static int __init abituguru_detect(void)


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

* [lm-sensors] [PATCH 1/4][update] hwmon / abituguru: Use struct dev_pm_ops for power management
@ 2012-07-07 21:59     ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:59 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: hwmon / abituguru: Use struct dev_pm_ops for power management

Make the Abit uGuru driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

dev_get_drvdata() may be used directly instead of being wrapped in
platform_get_drvdata(to_platform_device()).

---
 drivers/hwmon/abituguru.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru.c
=================================--- linux.orig/drivers/hwmon/abituguru.c
+++ linux/drivers/hwmon/abituguru.c
@@ -1514,9 +1514,9 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru_suspend(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data = dev_get_drvdata(dev);
 	/*
 	 * make sure all communications with the uguru are done and no new
 	 * ones are started
@@ -1525,29 +1525,30 @@ static int abituguru_suspend(struct plat
 	return 0;
 }
 
-static int abituguru_resume(struct platform_device *pdev)
+static int abituguru_resume(struct device *dev)
 {
-	struct abituguru_data *data = platform_get_drvdata(pdev);
+	struct abituguru_data *data = dev_get_drvdata(dev);
 	/* See if the uGuru is still ready */
 	if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
 		data->uguru_ready = 0;
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
+#define ABIT_UGURU_PM	(&abituguru_pm)
 #else
-#define abituguru_suspend	NULL
-#define abituguru_resume	NULL
+#define ABIT_UGURU_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU_NAME,
+		.pm	= ABIT_UGURU_PM,
 	},
 	.probe		= abituguru_probe,
 	.remove		= __devexit_p(abituguru_remove),
-	.suspend	= abituguru_suspend,
-	.resume		= abituguru_resume,
 };
 
 static int __init abituguru_detect(void)


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [lm-sensors] [PATCH 2/4][update] hwmon / abituguru3: Use struct dev_pm_ops for power management
  2012-07-07 21:04   ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-07 22:00     ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 21:59 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Abit uGuru rev. 3 driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

dev_get_drvdata() may be used directly instead of being wrapped in
platform_get_drvdata(to_platform_device()).

---
 drivers/hwmon/abituguru3.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru3.c
=================================--- linux.orig/drivers/hwmon/abituguru3.c
+++ linux/drivers/hwmon/abituguru3.c
@@ -1142,9 +1142,9 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru3_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru3_suspend(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data = dev_get_drvdata(dev);
 	/*
 	 * make sure all communications with the uguru3 are done and no new
 	 * ones are started
@@ -1153,26 +1153,27 @@ static int abituguru3_suspend(struct pla
 	return 0;
 }
 
-static int abituguru3_resume(struct platform_device *pdev)
+static int abituguru3_resume(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data = dev_get_drvdata(dev);
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
+#define ABIT_UGURU3_PM	(&abituguru3_pm)
 #else
-#define abituguru3_suspend	NULL
-#define abituguru3_resume	NULL
+#define ABIT_UGURU3_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru3_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU3_NAME,
+		.pm	= ABIT_UGURU3_PM
 	},
 	.probe	= abituguru3_probe,
 	.remove	= __devexit_p(abituguru3_remove),
-	.suspend = abituguru3_suspend,
-	.resume = abituguru3_resume
 };
 
 static int __init abituguru3_dmi_detect(void)


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [PATCH 2/4][update] hwmon / abituguru3: Use struct dev_pm_ops for power management
@ 2012-07-07 22:00     ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 22:00 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Abit uGuru rev. 3 driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

dev_get_drvdata() may be used directly instead of being wrapped in
platform_get_drvdata(to_platform_device()).

---
 drivers/hwmon/abituguru3.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru3.c
===================================================================
--- linux.orig/drivers/hwmon/abituguru3.c
+++ linux/drivers/hwmon/abituguru3.c
@@ -1142,9 +1142,9 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru3_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru3_suspend(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data = dev_get_drvdata(dev);
 	/*
 	 * make sure all communications with the uguru3 are done and no new
 	 * ones are started
@@ -1153,26 +1153,27 @@ static int abituguru3_suspend(struct pla
 	return 0;
 }
 
-static int abituguru3_resume(struct platform_device *pdev)
+static int abituguru3_resume(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data = dev_get_drvdata(dev);
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
+#define ABIT_UGURU3_PM	(&abituguru3_pm)
 #else
-#define abituguru3_suspend	NULL
-#define abituguru3_resume	NULL
+#define ABIT_UGURU3_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru3_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU3_NAME,
+		.pm	= ABIT_UGURU3_PM
 	},
 	.probe	= abituguru3_probe,
 	.remove	= __devexit_p(abituguru3_remove),
-	.suspend = abituguru3_suspend,
-	.resume = abituguru3_resume
 };
 
 static int __init abituguru3_dmi_detect(void)


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

* [PATCH 3/4][update] hwmon / gpio-fan: Use struct dev_pm_ops for power management
  2012-07-07 21:05   ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-07 22:01     ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 22:01 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the gpio-fan driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

dev_get_drvdata() may be used directly instead of being wrapped in
platform_get_drvdata(to_platform_device()).

---
 drivers/hwmon/gpio-fan.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/gpio-fan.c
===================================================================
--- linux.orig/drivers/hwmon/gpio-fan.c
+++ linux/drivers/hwmon/gpio-fan.c
@@ -503,9 +503,9 @@ static int __devexit gpio_fan_remove(str
 }
 
 #ifdef CONFIG_PM
-static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state)
+static int gpio_fan_suspend(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
 
 	if (fan_data->ctrl) {
 		fan_data->resume_speed = fan_data->speed_index;
@@ -515,27 +515,28 @@ static int gpio_fan_suspend(struct platf
 	return 0;
 }
 
-static int gpio_fan_resume(struct platform_device *pdev)
+static int gpio_fan_resume(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
 
 	if (fan_data->ctrl)
 		set_fan_speed(fan_data, fan_data->resume_speed);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
+#define GPIO_FAN_PM	(&gpio_fan_pm)
 #else
-#define gpio_fan_suspend NULL
-#define gpio_fan_resume NULL
+#define GPIO_FAN_PM	NULL
 #endif
 
 static struct platform_driver gpio_fan_driver = {
 	.probe		= gpio_fan_probe,
 	.remove		= __devexit_p(gpio_fan_remove),
-	.suspend	= gpio_fan_suspend,
-	.resume		= gpio_fan_resume,
 	.driver	= {
 		.name	= "gpio-fan",
+		.pm	= GPIO_FAN_PM,
 	},
 };
 


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

* [lm-sensors] [PATCH 3/4][update] hwmon / gpio-fan: Use struct dev_pm_ops for power management
@ 2012-07-07 22:01     ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 22:01 UTC (permalink / raw)
  To: LKML
  Cc: Linux PM list, Hans de Goede, Alistair John Strachan, lm-sensors,
	Jean Delvare, Guenter Roeck, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the gpio-fan driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

dev_get_drvdata() may be used directly instead of being wrapped in
platform_get_drvdata(to_platform_device()).

---
 drivers/hwmon/gpio-fan.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/gpio-fan.c
=================================--- linux.orig/drivers/hwmon/gpio-fan.c
+++ linux/drivers/hwmon/gpio-fan.c
@@ -503,9 +503,9 @@ static int __devexit gpio_fan_remove(str
 }
 
 #ifdef CONFIG_PM
-static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state)
+static int gpio_fan_suspend(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
 
 	if (fan_data->ctrl) {
 		fan_data->resume_speed = fan_data->speed_index;
@@ -515,27 +515,28 @@ static int gpio_fan_suspend(struct platf
 	return 0;
 }
 
-static int gpio_fan_resume(struct platform_device *pdev)
+static int gpio_fan_resume(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
 
 	if (fan_data->ctrl)
 		set_fan_speed(fan_data, fan_data->resume_speed);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
+#define GPIO_FAN_PM	(&gpio_fan_pm)
 #else
-#define gpio_fan_suspend NULL
-#define gpio_fan_resume NULL
+#define GPIO_FAN_PM	NULL
 #endif
 
 static struct platform_driver gpio_fan_driver = {
 	.probe		= gpio_fan_probe,
 	.remove		= __devexit_p(gpio_fan_remove),
-	.suspend	= gpio_fan_suspend,
-	.resume		= gpio_fan_resume,
 	.driver	= {
 		.name	= "gpio-fan",
+		.pm	= GPIO_FAN_PM,
 	},
 };
 


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [PATCH 4/4] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
  2012-07-07 21:06   ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-08 17:02     ` Guenter Roeck
  -1 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:02 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sat, Jul 07, 2012 at 11:06:08PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make the Exynos4 TMU driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Please fix:

WARNING: line over 80 characters
#313: FILE: drivers/hwmon/exynos4_tmu.c:496:
+static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm, exynos4_tmu_suspend, exynos4_tmu_resume);

Guenter

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

* Re: [lm-sensors] [PATCH 4/4] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
@ 2012-07-08 17:02     ` Guenter Roeck
  0 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:02 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sat, Jul 07, 2012 at 11:06:08PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make the Exynos4 TMU driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Please fix:

WARNING: line over 80 characters
#313: FILE: drivers/hwmon/exynos4_tmu.c:496:
+static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm, exynos4_tmu_suspend, exynos4_tmu_resume);

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [PATCH 1/4][update] hwmon / abituguru: Use struct dev_pm_ops for power management
  2012-07-07 21:59     ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-08 17:06       ` Guenter Roeck
  -1 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sat, Jul 07, 2012 at 11:59:12PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> Subject: hwmon / abituguru: Use struct dev_pm_ops for power management
> 
> Make the Abit uGuru driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Applied to -next.

Thanks,
Guenter

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

* Re: [lm-sensors] [PATCH 1/4][update] hwmon / abituguru: Use struct dev_pm_ops for power management
@ 2012-07-08 17:06       ` Guenter Roeck
  0 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sat, Jul 07, 2012 at 11:59:12PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> Subject: hwmon / abituguru: Use struct dev_pm_ops for power management
> 
> Make the Abit uGuru driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Applied to -next.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [PATCH 2/4][update] hwmon / abituguru3: Use struct dev_pm_ops for power management
  2012-07-07 22:00     ` Rafael J. Wysocki
@ 2012-07-08 17:06       ` Guenter Roeck
  -1 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 12:00:01AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make the Abit uGuru rev. 3 driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---

Applied to -next.

Thanks,
Guenter

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

* Re: [lm-sensors] [PATCH 2/4][update] hwmon / abituguru3: Use struct dev_pm_ops for power management
@ 2012-07-08 17:06       ` Guenter Roeck
  0 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 12:00:01AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make the Abit uGuru rev. 3 driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---

Applied to -next.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [PATCH 3/4][update] hwmon / gpio-fan: Use struct dev_pm_ops for power management
  2012-07-07 22:01     ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-08 17:07       ` Guenter Roeck
  -1 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:07 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 12:01:03AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make the gpio-fan driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Applied to -next.

Thanks,
Guenter

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

* Re: [lm-sensors] [PATCH 3/4][update] hwmon / gpio-fan: Use struct dev_pm_ops for power management
@ 2012-07-08 17:07       ` Guenter Roeck
  0 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 17:07 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 12:01:03AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make the gpio-fan driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Applied to -next.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
  2012-07-08 17:02     ` [lm-sensors] " Guenter Roeck
@ 2012-07-08 19:48       ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-08 19:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Exynos4 TMU driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Index: linux/drivers/hwmon/exynos4_tmu.c
===================================================================
--- linux.orig/drivers/hwmon/exynos4_tmu.c
+++ linux/drivers/hwmon/exynos4_tmu.c
@@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
 }
 
 #ifdef CONFIG_PM
-static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
+static int exynos4_tmu_suspend(struct device *dev)
 {
-	exynos4_tmu_control(pdev, false);
+	exynos4_tmu_control(to_platform_device(dev), false);
 
 	return 0;
 }
 
-static int exynos4_tmu_resume(struct platform_device *pdev)
+static int exynos4_tmu_resume(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
+
 	exynos4_tmu_initialize(pdev);
 	exynos4_tmu_control(pdev, true);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
+			 exynos4_tmu_suspend, exynos4_tmu_resume);
+#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
 #else
-#define exynos4_tmu_suspend NULL
-#define exynos4_tmu_resume NULL
+#define EXYNOS4_TMU_PM	NULL
 #endif
 
 static struct platform_driver exynos4_tmu_driver = {
 	.driver = {
 		.name   = "exynos4-tmu",
 		.owner  = THIS_MODULE,
+		.pm     = EXYNOS4_TMU_PM,
 	},
 	.probe = exynos4_tmu_probe,
 	.remove	= __devexit_p(exynos4_tmu_remove),
-	.suspend = exynos4_tmu_suspend,
-	.resume = exynos4_tmu_resume,
 };
 
 module_platform_driver(exynos4_tmu_driver);

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

* [lm-sensors] [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
@ 2012-07-08 19:48       ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-08 19:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Exynos4 TMU driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Index: linux/drivers/hwmon/exynos4_tmu.c
=================================--- linux.orig/drivers/hwmon/exynos4_tmu.c
+++ linux/drivers/hwmon/exynos4_tmu.c
@@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
 }
 
 #ifdef CONFIG_PM
-static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
+static int exynos4_tmu_suspend(struct device *dev)
 {
-	exynos4_tmu_control(pdev, false);
+	exynos4_tmu_control(to_platform_device(dev), false);
 
 	return 0;
 }
 
-static int exynos4_tmu_resume(struct platform_device *pdev)
+static int exynos4_tmu_resume(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
+
 	exynos4_tmu_initialize(pdev);
 	exynos4_tmu_control(pdev, true);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
+			 exynos4_tmu_suspend, exynos4_tmu_resume);
+#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
 #else
-#define exynos4_tmu_suspend NULL
-#define exynos4_tmu_resume NULL
+#define EXYNOS4_TMU_PM	NULL
 #endif
 
 static struct platform_driver exynos4_tmu_driver = {
 	.driver = {
 		.name   = "exynos4-tmu",
 		.owner  = THIS_MODULE,
+		.pm     = EXYNOS4_TMU_PM,
 	},
 	.probe = exynos4_tmu_probe,
 	.remove	= __devexit_p(exynos4_tmu_remove),
-	.suspend = exynos4_tmu_suspend,
-	.resume = exynos4_tmu_resume,
 };
 
 module_platform_driver(exynos4_tmu_driver);

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
  2012-07-08 19:48       ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-08 20:30         ` Guenter Roeck
  -1 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 20:30 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 09:48:15PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
Hi Rafael,

> Make the Exynos4 TMU driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
>  drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> Index: linux/drivers/hwmon/exynos4_tmu.c
> ===================================================================
> --- linux.orig/drivers/hwmon/exynos4_tmu.c
> +++ linux/drivers/hwmon/exynos4_tmu.c
> @@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
>  }
>  
>  #ifdef CONFIG_PM
> -static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
> +static int exynos4_tmu_suspend(struct device *dev)
>  {
> -	exynos4_tmu_control(pdev, false);
> +	exynos4_tmu_control(to_platform_device(dev), false);
>  
>  	return 0;
>  }
>  
> -static int exynos4_tmu_resume(struct platform_device *pdev)
> +static int exynos4_tmu_resume(struct device *dev)
>  {
> +	struct platform_device *pdev = to_platform_device(dev);
> +
>  	exynos4_tmu_initialize(pdev);
>  	exynos4_tmu_control(pdev, true);
>  
>  	return 0;
>  }
> +
> +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> +			 exynos4_tmu_suspend, exynos4_tmu_resume);
> +#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
>  #else
> -#define exynos4_tmu_suspend NULL
> -#define exynos4_tmu_resume NULL
> +#define EXYNOS4_TMU_PM	NULL
>  #endif

Actually, looking into other drivers, the common approach seems to be to declare

static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
			 exynos4_tmu_suspend, exynos4_tmu_resume);

outside the #ifdef code and then just assign

		.pm = &exynos4_tmu_pm;

unconditionally.

That seems to be a much simpler solution. Any special reason for not
implementing it this way ? Same question applies to the other patches in the
series.

Thanks,
Guenter

>  
>  static struct platform_driver exynos4_tmu_driver = {
>  	.driver = {
>  		.name   = "exynos4-tmu",
>  		.owner  = THIS_MODULE,
> +		.pm     = EXYNOS4_TMU_PM,
>  	},
>  	.probe = exynos4_tmu_probe,
>  	.remove	= __devexit_p(exynos4_tmu_remove),
> -	.suspend = exynos4_tmu_suspend,
> -	.resume = exynos4_tmu_resume,
>  };
>  
>  module_platform_driver(exynos4_tmu_driver);
> 

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

* Re: [lm-sensors] [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
@ 2012-07-08 20:30         ` Guenter Roeck
  0 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-08 20:30 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 09:48:15PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
Hi Rafael,

> Make the Exynos4 TMU driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
>  drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> Index: linux/drivers/hwmon/exynos4_tmu.c
> =================================> --- linux.orig/drivers/hwmon/exynos4_tmu.c
> +++ linux/drivers/hwmon/exynos4_tmu.c
> @@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
>  }
>  
>  #ifdef CONFIG_PM
> -static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
> +static int exynos4_tmu_suspend(struct device *dev)
>  {
> -	exynos4_tmu_control(pdev, false);
> +	exynos4_tmu_control(to_platform_device(dev), false);
>  
>  	return 0;
>  }
>  
> -static int exynos4_tmu_resume(struct platform_device *pdev)
> +static int exynos4_tmu_resume(struct device *dev)
>  {
> +	struct platform_device *pdev = to_platform_device(dev);
> +
>  	exynos4_tmu_initialize(pdev);
>  	exynos4_tmu_control(pdev, true);
>  
>  	return 0;
>  }
> +
> +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> +			 exynos4_tmu_suspend, exynos4_tmu_resume);
> +#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
>  #else
> -#define exynos4_tmu_suspend NULL
> -#define exynos4_tmu_resume NULL
> +#define EXYNOS4_TMU_PM	NULL
>  #endif

Actually, looking into other drivers, the common approach seems to be to declare

static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
			 exynos4_tmu_suspend, exynos4_tmu_resume);

outside the #ifdef code and then just assign

		.pm = &exynos4_tmu_pm;

unconditionally.

That seems to be a much simpler solution. Any special reason for not
implementing it this way ? Same question applies to the other patches in the
series.

Thanks,
Guenter

>  
>  static struct platform_driver exynos4_tmu_driver = {
>  	.driver = {
>  		.name   = "exynos4-tmu",
>  		.owner  = THIS_MODULE,
> +		.pm     = EXYNOS4_TMU_PM,
>  	},
>  	.probe = exynos4_tmu_probe,
>  	.remove	= __devexit_p(exynos4_tmu_remove),
> -	.suspend = exynos4_tmu_suspend,
> -	.resume = exynos4_tmu_resume,
>  };
>  
>  module_platform_driver(exynos4_tmu_driver);
> 

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
  2012-07-08 20:30         ` [lm-sensors] " Guenter Roeck
@ 2012-07-08 20:46           ` Rafael J. Wysocki
  -1 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-08 20:46 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sunday, July 08, 2012, Guenter Roeck wrote:
> On Sun, Jul 08, 2012 at 09:48:15PM +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > 
> Hi Rafael,
> 
> > Make the Exynos4 TMU driver define its PM callbacks through
> > a struct dev_pm_ops object rather than by using legacy PM hooks
> > in struct platform_driver.
> > 
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > ---
> >  drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
> >  1 file changed, 11 insertions(+), 7 deletions(-)
> > 
> > Index: linux/drivers/hwmon/exynos4_tmu.c
> > ===================================================================
> > --- linux.orig/drivers/hwmon/exynos4_tmu.c
> > +++ linux/drivers/hwmon/exynos4_tmu.c
> > @@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
> >  }
> >  
> >  #ifdef CONFIG_PM
> > -static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
> > +static int exynos4_tmu_suspend(struct device *dev)
> >  {
> > -	exynos4_tmu_control(pdev, false);
> > +	exynos4_tmu_control(to_platform_device(dev), false);
> >  
> >  	return 0;
> >  }
> >  
> > -static int exynos4_tmu_resume(struct platform_device *pdev)
> > +static int exynos4_tmu_resume(struct device *dev)
> >  {
> > +	struct platform_device *pdev = to_platform_device(dev);
> > +
> >  	exynos4_tmu_initialize(pdev);
> >  	exynos4_tmu_control(pdev, true);
> >  
> >  	return 0;
> >  }
> > +
> > +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > +			 exynos4_tmu_suspend, exynos4_tmu_resume);
> > +#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
> >  #else
> > -#define exynos4_tmu_suspend NULL
> > -#define exynos4_tmu_resume NULL
> > +#define EXYNOS4_TMU_PM	NULL
> >  #endif
> 
> Actually, looking into other drivers, the common approach seems to be to declare
> 
> static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> 			 exynos4_tmu_suspend, exynos4_tmu_resume);
> 
> outside the #ifdef code and then just assign
> 
> 		.pm = &exynos4_tmu_pm;
> 
> unconditionally.
> 
> That seems to be a much simpler solution. Any special reason for not
> implementing it this way ? Same question applies to the other patches in the
> series.

In fact, there are two ways.  One of them is what you said, the other is to
put SIMPLE_DEV_PM_OPS() under the #ifdef like I did.  I'm not sure which one
is prevalent, but what I did has the advatnage that the kernel data will
be slightly smaller if CONFIG_PM is unset.

Thanks,
Rafael

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

* Re: [lm-sensors] [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
@ 2012-07-08 20:46           ` Rafael J. Wysocki
  0 siblings, 0 replies; 32+ messages in thread
From: Rafael J. Wysocki @ 2012-07-08 20:46 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sunday, July 08, 2012, Guenter Roeck wrote:
> On Sun, Jul 08, 2012 at 09:48:15PM +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > 
> Hi Rafael,
> 
> > Make the Exynos4 TMU driver define its PM callbacks through
> > a struct dev_pm_ops object rather than by using legacy PM hooks
> > in struct platform_driver.
> > 
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > ---
> >  drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
> >  1 file changed, 11 insertions(+), 7 deletions(-)
> > 
> > Index: linux/drivers/hwmon/exynos4_tmu.c
> > =================================> > --- linux.orig/drivers/hwmon/exynos4_tmu.c
> > +++ linux/drivers/hwmon/exynos4_tmu.c
> > @@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
> >  }
> >  
> >  #ifdef CONFIG_PM
> > -static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
> > +static int exynos4_tmu_suspend(struct device *dev)
> >  {
> > -	exynos4_tmu_control(pdev, false);
> > +	exynos4_tmu_control(to_platform_device(dev), false);
> >  
> >  	return 0;
> >  }
> >  
> > -static int exynos4_tmu_resume(struct platform_device *pdev)
> > +static int exynos4_tmu_resume(struct device *dev)
> >  {
> > +	struct platform_device *pdev = to_platform_device(dev);
> > +
> >  	exynos4_tmu_initialize(pdev);
> >  	exynos4_tmu_control(pdev, true);
> >  
> >  	return 0;
> >  }
> > +
> > +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > +			 exynos4_tmu_suspend, exynos4_tmu_resume);
> > +#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
> >  #else
> > -#define exynos4_tmu_suspend NULL
> > -#define exynos4_tmu_resume NULL
> > +#define EXYNOS4_TMU_PM	NULL
> >  #endif
> 
> Actually, looking into other drivers, the common approach seems to be to declare
> 
> static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> 			 exynos4_tmu_suspend, exynos4_tmu_resume);
> 
> outside the #ifdef code and then just assign
> 
> 		.pm = &exynos4_tmu_pm;
> 
> unconditionally.
> 
> That seems to be a much simpler solution. Any special reason for not
> implementing it this way ? Same question applies to the other patches in the
> series.

In fact, there are two ways.  One of them is what you said, the other is to
put SIMPLE_DEV_PM_OPS() under the #ifdef like I did.  I'm not sure which one
is prevalent, but what I did has the advatnage that the kernel data will
be slightly smaller if CONFIG_PM is unset.

Thanks,
Rafael

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
  2012-07-08 20:46           ` [lm-sensors] " Rafael J. Wysocki
@ 2012-07-09  4:42             ` Guenter Roeck
  -1 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-09  4:42 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 10:46:12PM +0200, Rafael J. Wysocki wrote:
> On Sunday, July 08, 2012, Guenter Roeck wrote:
> > On Sun, Jul 08, 2012 at 09:48:15PM +0200, Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rjw@sisk.pl>
> > > 
> > Hi Rafael,
> > 
> > > Make the Exynos4 TMU driver define its PM callbacks through
> > > a struct dev_pm_ops object rather than by using legacy PM hooks
> > > in struct platform_driver.
> > > 
> > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > > ---
> > >  drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
> > >  1 file changed, 11 insertions(+), 7 deletions(-)
> > > 
> > > Index: linux/drivers/hwmon/exynos4_tmu.c
> > > ===================================================================
> > > --- linux.orig/drivers/hwmon/exynos4_tmu.c
> > > +++ linux/drivers/hwmon/exynos4_tmu.c
> > > @@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
> > >  }
> > >  
> > >  #ifdef CONFIG_PM
> > > -static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
> > > +static int exynos4_tmu_suspend(struct device *dev)
> > >  {
> > > -	exynos4_tmu_control(pdev, false);
> > > +	exynos4_tmu_control(to_platform_device(dev), false);
> > >  
> > >  	return 0;
> > >  }
> > >  
> > > -static int exynos4_tmu_resume(struct platform_device *pdev)
> > > +static int exynos4_tmu_resume(struct device *dev)
> > >  {
> > > +	struct platform_device *pdev = to_platform_device(dev);
> > > +
> > >  	exynos4_tmu_initialize(pdev);
> > >  	exynos4_tmu_control(pdev, true);
> > >  
> > >  	return 0;
> > >  }
> > > +
> > > +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > > +			 exynos4_tmu_suspend, exynos4_tmu_resume);
> > > +#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
> > >  #else
> > > -#define exynos4_tmu_suspend NULL
> > > -#define exynos4_tmu_resume NULL
> > > +#define EXYNOS4_TMU_PM	NULL
> > >  #endif
> > 
> > Actually, looking into other drivers, the common approach seems to be to declare
> > 
> > static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > 			 exynos4_tmu_suspend, exynos4_tmu_resume);
> > 
> > outside the #ifdef code and then just assign
> > 
> > 		.pm = &exynos4_tmu_pm;
> > 
> > unconditionally.
> > 
> > That seems to be a much simpler solution. Any special reason for not
> > implementing it this way ? Same question applies to the other patches in the
> > series.
> 
> In fact, there are two ways.  One of them is what you said, the other is to
> put SIMPLE_DEV_PM_OPS() under the #ifdef like I did.  I'm not sure which one
> is prevalent, but what I did has the advatnage that the kernel data will
> be slightly smaller if CONFIG_PM is unset.
> 
Ok, make sense. Applied to -next.

Thanks,
Guenter

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

* Re: [lm-sensors] [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
@ 2012-07-09  4:42             ` Guenter Roeck
  0 siblings, 0 replies; 32+ messages in thread
From: Guenter Roeck @ 2012-07-09  4:42 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux PM list, Hans de Goede, Alistair John Strachan,
	lm-sensors, Jean Delvare, Kukjin Kim

On Sun, Jul 08, 2012 at 10:46:12PM +0200, Rafael J. Wysocki wrote:
> On Sunday, July 08, 2012, Guenter Roeck wrote:
> > On Sun, Jul 08, 2012 at 09:48:15PM +0200, Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rjw@sisk.pl>
> > > 
> > Hi Rafael,
> > 
> > > Make the Exynos4 TMU driver define its PM callbacks through
> > > a struct dev_pm_ops object rather than by using legacy PM hooks
> > > in struct platform_driver.
> > > 
> > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > > ---
> > >  drivers/hwmon/exynos4_tmu.c |   18 +++++++++++-------
> > >  1 file changed, 11 insertions(+), 7 deletions(-)
> > > 
> > > Index: linux/drivers/hwmon/exynos4_tmu.c
> > > =================================> > > --- linux.orig/drivers/hwmon/exynos4_tmu.c
> > > +++ linux/drivers/hwmon/exynos4_tmu.c
> > > @@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
> > >  }
> > >  
> > >  #ifdef CONFIG_PM
> > > -static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
> > > +static int exynos4_tmu_suspend(struct device *dev)
> > >  {
> > > -	exynos4_tmu_control(pdev, false);
> > > +	exynos4_tmu_control(to_platform_device(dev), false);
> > >  
> > >  	return 0;
> > >  }
> > >  
> > > -static int exynos4_tmu_resume(struct platform_device *pdev)
> > > +static int exynos4_tmu_resume(struct device *dev)
> > >  {
> > > +	struct platform_device *pdev = to_platform_device(dev);
> > > +
> > >  	exynos4_tmu_initialize(pdev);
> > >  	exynos4_tmu_control(pdev, true);
> > >  
> > >  	return 0;
> > >  }
> > > +
> > > +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > > +			 exynos4_tmu_suspend, exynos4_tmu_resume);
> > > +#define EXYNOS4_TMU_PM	(&exynos4_tmu_pm)
> > >  #else
> > > -#define exynos4_tmu_suspend NULL
> > > -#define exynos4_tmu_resume NULL
> > > +#define EXYNOS4_TMU_PM	NULL
> > >  #endif
> > 
> > Actually, looking into other drivers, the common approach seems to be to declare
> > 
> > static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > 			 exynos4_tmu_suspend, exynos4_tmu_resume);
> > 
> > outside the #ifdef code and then just assign
> > 
> > 		.pm = &exynos4_tmu_pm;
> > 
> > unconditionally.
> > 
> > That seems to be a much simpler solution. Any special reason for not
> > implementing it this way ? Same question applies to the other patches in the
> > series.
> 
> In fact, there are two ways.  One of them is what you said, the other is to
> put SIMPLE_DEV_PM_OPS() under the #ifdef like I did.  I'm not sure which one
> is prevalent, but what I did has the advatnage that the kernel data will
> be slightly smaller if CONFIG_PM is unset.
> 
Ok, make sense. Applied to -next.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

end of thread, other threads:[~2012-07-09  4:42 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-07 21:02 [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct dev_pm_ops Rafael J. Wysocki
2012-07-07 21:02 ` [lm-sensors] [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct d Rafael J. Wysocki
2012-07-07 21:04 ` [PATCH 1/4] hwmon / abituguru: Use struct dev_pm_ops for power management Rafael J. Wysocki
2012-07-07 21:04   ` [lm-sensors] " Rafael J. Wysocki
2012-07-07 21:59   ` [PATCH 1/4][update] " Rafael J. Wysocki
2012-07-07 21:59     ` [lm-sensors] " Rafael J. Wysocki
2012-07-08 17:06     ` Guenter Roeck
2012-07-08 17:06       ` [lm-sensors] " Guenter Roeck
2012-07-07 21:04 ` [PATCH 2/4] hwmon / abituguru3: " Rafael J. Wysocki
2012-07-07 21:04   ` [lm-sensors] " Rafael J. Wysocki
2012-07-07 21:59   ` [lm-sensors] [PATCH 2/4][update] " Rafael J. Wysocki
2012-07-07 22:00     ` Rafael J. Wysocki
2012-07-08 17:06     ` Guenter Roeck
2012-07-08 17:06       ` [lm-sensors] " Guenter Roeck
2012-07-07 21:05 ` [PATCH 3/4] hwmon / gpio-fan: " Rafael J. Wysocki
2012-07-07 21:05   ` [lm-sensors] " Rafael J. Wysocki
2012-07-07 22:01   ` [PATCH 3/4][update] " Rafael J. Wysocki
2012-07-07 22:01     ` [lm-sensors] " Rafael J. Wysocki
2012-07-08 17:07     ` Guenter Roeck
2012-07-08 17:07       ` [lm-sensors] " Guenter Roeck
2012-07-07 21:06 ` [PATCH 4/4] hwmon / exynos4_tmu: " Rafael J. Wysocki
2012-07-07 21:06   ` [lm-sensors] " Rafael J. Wysocki
2012-07-08 17:02   ` Guenter Roeck
2012-07-08 17:02     ` [lm-sensors] " Guenter Roeck
2012-07-08 19:48     ` [PATCH 4/4][update] " Rafael J. Wysocki
2012-07-08 19:48       ` [lm-sensors] " Rafael J. Wysocki
2012-07-08 20:30       ` Guenter Roeck
2012-07-08 20:30         ` [lm-sensors] " Guenter Roeck
2012-07-08 20:46         ` Rafael J. Wysocki
2012-07-08 20:46           ` [lm-sensors] " Rafael J. Wysocki
2012-07-09  4:42           ` Guenter Roeck
2012-07-09  4:42             ` [lm-sensors] " Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.