All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] PM / Domains: Make it possible to use per-device start/stop routines
From: Rafael J. Wysocki @ 2011-11-07  0:06 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111070101.33960.rjw@sisk.pl>

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

The current generic PM domains code requires that the same .stop()
and .start() device callback routines be used for all devices in the
given domain, which is inflexible and may not cover some specific use
cases.  For this reason, make it possible to use device specific
.start() and .stop() callback routines by adding corresponding
callback pointers to struct generic_pm_domain_data.  Add a new helper
routine, pm_genpd_register_callbacks(), that can be used to populate
the new per-device callback pointers.

Modify the shmobile's power domains code to allow drivers to add
their own code to be run during the device stop and start operations
with the help of the new callback pointers.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-sh7372.c |   33 ++++++++-
 drivers/base/power/domain.c        |  135 ++++++++++++++++++++++++++++---------
 include/linux/pm_domain.h          |   22 ++++++
 3 files changed, 156 insertions(+), 34 deletions(-)

Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -62,8 +62,14 @@ struct gpd_link {
 	struct list_head slave_node;
 };
 
+struct gpd_dev_ops {
+	int (*start)(struct device *dev);
+	int (*stop)(struct device *dev);
+};
+
 struct generic_pm_domain_data {
 	struct pm_domain_data base;
+	struct gpd_dev_ops ops;
 	bool need_restore;
 };
 
@@ -72,6 +78,11 @@ static inline struct generic_pm_domain_d
 	return container_of(pdd, struct generic_pm_domain_data, base);
 }
 
+static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
+{
+	return to_gpd_data(dev->power.subsys_data->domain_data);
+}
+
 #ifdef CONFIG_PM_GENERIC_DOMAINS
 extern int pm_genpd_add_device(struct generic_pm_domain *genpd,
 			       struct device *dev);
@@ -81,6 +92,8 @@ extern int pm_genpd_add_subdomain(struct
 				  struct generic_pm_domain *new_subdomain);
 extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
 				     struct generic_pm_domain *target);
+extern int pm_genpd_add_callbacks(struct device *dev, struct gpd_dev_ops *ops);
+extern int pm_genpd_remove_callbacks(struct device *dev);
 extern void pm_genpd_init(struct generic_pm_domain *genpd,
 			  struct dev_power_governor *gov, bool is_off);
 extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
@@ -105,6 +118,15 @@ static inline int pm_genpd_remove_subdom
 {
 	return -ENOSYS;
 }
+static inline int pm_genpd_add_callbacks(struct device *dev,
+					 struct gpd_dev_ops *ops)
+{
+	return -ENOSYS;
+}
+static inline int pm_genpd_remove_callbacks(struct device *dev)
+{
+	return -ENOSYS;
+}
 static inline void pm_genpd_init(struct generic_pm_domain *genpd,
 				 struct dev_power_governor *gov, bool is_off) {}
 static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -29,6 +29,36 @@ static struct generic_pm_domain *dev_to_
 	return pd_to_genpd(dev->pm_domain);
 }
 
+static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	int (*stop)(struct device *dev);
+
+	stop = genpd->stop_device;
+	if (stop)
+		return stop(dev);
+
+	stop = dev_gpd_data(dev)->ops.stop;
+	if (stop)
+		return stop(dev);
+
+	return 0;
+}
+
+static int genpd_start_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	int (*start)(struct device *dev);
+
+	start = genpd->start_device;
+	if (start)
+		return start(dev);
+
+	start = dev_gpd_data(dev)->ops.start;
+	if (start)
+		return start(dev);
+
+	return 0;
+}
+
 static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
 {
 	bool ret = false;
@@ -199,13 +229,9 @@ static int __pm_genpd_save_device(struct
 	mutex_unlock(&genpd->lock);
 
 	if (drv && drv->pm && drv->pm->runtime_suspend) {
-		if (genpd->start_device)
-			genpd->start_device(dev);
-
+		genpd_start_dev(genpd, dev);
 		ret = drv->pm->runtime_suspend(dev);
-
-		if (genpd->stop_device)
-			genpd->stop_device(dev);
+		genpd_stop_dev(genpd, dev);
 	}
 
 	mutex_lock(&genpd->lock);
@@ -235,13 +261,9 @@ static void __pm_genpd_restore_device(st
 	mutex_unlock(&genpd->lock);
 
 	if (drv && drv->pm && drv->pm->runtime_resume) {
-		if (genpd->start_device)
-			genpd->start_device(dev);
-
+		genpd_start_dev(genpd, dev);
 		drv->pm->runtime_resume(dev);
-
-		if (genpd->stop_device)
-			genpd->stop_device(dev);
+		genpd_stop_dev(genpd, dev);
 	}
 
 	mutex_lock(&genpd->lock);
@@ -413,6 +435,7 @@ static void genpd_power_off_work_fn(stru
 static int pm_genpd_runtime_suspend(struct device *dev)
 {
 	struct generic_pm_domain *genpd;
+	int ret;
 
 	dev_dbg(dev, "%s()\n", __func__);
 
@@ -422,11 +445,9 @@ static int pm_genpd_runtime_suspend(stru
 
 	might_sleep_if(!genpd->dev_irq_safe);
 
-	if (genpd->stop_device) {
-		int ret = genpd->stop_device(dev);
-		if (ret)
-			return ret;
-	}
+	ret = genpd_stop_dev(genpd, dev);
+	if (ret)
+		return ret;
 
 	/*
 	 * If power.irq_safe is set, this routine will be run with interrupts
@@ -502,8 +523,7 @@ static int pm_genpd_runtime_resume(struc
 	mutex_unlock(&genpd->lock);
 
  out:
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return 0;
 }
@@ -646,7 +666,7 @@ static int pm_genpd_prepare(struct devic
 	/*
 	 * The PM domain must be in the GPD_STATE_ACTIVE state at this point,
 	 * so pm_genpd_poweron() will return immediately, but if the device
-	 * is suspended (e.g. it's been stopped by .stop_device()), we need
+	 * is suspended (e.g. it's been stopped by genpd_stop_dev()), we need
 	 * to make it operational.
 	 */
 	pm_runtime_resume(dev);
@@ -718,8 +738,7 @@ static int pm_genpd_suspend_noirq(struct
 	    && genpd->active_wakeup && genpd->active_wakeup(dev))
 		return 0;
 
-	if (genpd->stop_device)
-		genpd->stop_device(dev);
+	genpd_stop_dev(genpd, dev);
 
 	/*
 	 * Since all of the "noirq" callbacks are executed sequentially, it is
@@ -761,8 +780,7 @@ static int pm_genpd_resume_noirq(struct
 	 */
 	pm_genpd_poweron(genpd);
 	genpd->suspended_count--;
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return pm_generic_resume_noirq(dev);
 }
@@ -836,8 +854,7 @@ static int pm_genpd_freeze_noirq(struct
 	if (ret)
 		return ret;
 
-	if (genpd->stop_device)
-		genpd->stop_device(dev);
+	genpd_stop_dev(genpd, dev);
 
 	return 0;
 }
@@ -864,8 +881,7 @@ static int pm_genpd_thaw_noirq(struct de
 	if (genpd->suspend_power_off)
 		return 0;
 
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return pm_generic_thaw_noirq(dev);
 }
@@ -942,8 +958,7 @@ static int pm_genpd_dev_poweroff_noirq(s
 	    && genpd->active_wakeup && genpd->active_wakeup(dev))
 		return 0;
 
-	if (genpd->stop_device)
-		genpd->stop_device(dev);
+	genpd_stop_dev(genpd, dev);
 
 	/*
 	 * Since all of the "noirq" callbacks are executed sequentially, it is
@@ -993,8 +1008,7 @@ static int pm_genpd_restore_noirq(struct
 
 	pm_genpd_poweron(genpd);
 	genpd->suspended_count--;
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return pm_generic_restore_noirq(dev);
 }
@@ -1280,6 +1294,63 @@ int pm_genpd_remove_subdomain(struct gen
 }
 
 /**
+ * pm_genpd_add_callbacks - Add PM domain callbacks to a given device.
+ * @dev: Device to add the callbacks to.
+ * @ops: Set of callbacks to add.
+ */
+int pm_genpd_add_callbacks(struct device *dev, struct gpd_dev_ops *ops)
+{
+	struct generic_pm_domain_data *gpd_data;
+	int ret = 0;
+
+	if (!(dev && dev->power.subsys_data && ops))
+		return -EINVAL;
+
+	pm_runtime_disable(dev);
+	device_pm_lock();
+
+	gpd_data = dev_gpd_data(dev);
+	if (gpd_data)
+		gpd_data->ops = *ops;
+	else
+		ret = -EINVAL;
+
+	device_pm_unlock();
+	pm_runtime_enable(dev);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(pm_genpd_add_callbacks);
+
+/**
+ * pm_genpd_remove_callbacks - Remove PM domain callbacks from a given device.
+ * @dev: Device to remove the callbacks from.
+ */
+int pm_genpd_remove_callbacks(struct device *dev)
+{
+	struct generic_pm_domain_data *gpd_data;
+	int ret = 0;
+
+	if (!(dev && dev->power.subsys_data))
+		return -EINVAL;
+
+	pm_runtime_disable(dev);
+	device_pm_lock();
+
+	gpd_data = dev_gpd_data(dev);
+	if (gpd_data)
+		gpd_data->ops = (struct gpd_dev_ops){ 0 };
+	else
+		ret = -EINVAL;
+
+	device_pm_unlock();
+	pm_runtime_enable(dev);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(pm_genpd_remove_callbacks);
+
+/**
  * pm_genpd_init - Initialize a generic I/O PM domain object.
  * @genpd: PM domain object to initialize.
  * @gov: PM domain governor to associate with the domain (may be NULL).
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -163,13 +163,42 @@ struct dev_power_governor sh7372_always_
 	.power_down_ok = sh7372_power_down_forbidden,
 };
 
+static int sh7372_stop_dev(struct device *dev)
+{
+	int (*stop)(struct device *dev);
+
+	stop = dev_gpd_data(dev)->ops.stop;
+	if (stop) {
+		int ret = stop(dev);
+		if (ret)
+			return ret;
+	}
+	return pm_clk_suspend(dev);
+}
+
+static int sh7372_start_dev(struct device *dev)
+{
+	int (*start)(struct device *dev);
+	int ret;
+
+	ret = pm_clk_resume(dev);
+	if (ret)
+		return ret;
+
+	start = dev_gpd_data(dev)->ops.start;
+	if (start)
+		ret = start(dev);
+
+	return ret;
+}
+
 void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
 {
 	struct generic_pm_domain *genpd = &sh7372_pd->genpd;
 
 	pm_genpd_init(genpd, sh7372_pd->gov, false);
-	genpd->stop_device = pm_clk_suspend;
-	genpd->start_device = pm_clk_resume;
+	genpd->stop_device = sh7372_stop_dev;
+	genpd->start_device = sh7372_start_dev;
 	genpd->dev_irq_safe = true;
 	genpd->active_wakeup = pd_active_wakeup;
 	genpd->power_off = pd_power_down;


^ permalink raw reply

* [PATCH 4/7] PM / Domains: Rework system suspend callback routines
From: Rafael J. Wysocki @ 2011-11-07  0:08 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111070101.33960.rjw@sisk.pl>

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

The current generic PM domains code attempts to use the generic
system suspend operations along with the domains' device stop/start
routines, which requires device drivers to assume that their
system suspend/resume (and hibernation/restore) callbacks will always
be used with generic PM domains.  However, in theory, the same
hardware may be used in devices that don't belong to any PM domain,
in which case it would be necessary to add "fake" PM domains to
satisfy the above assumption.  Also, the domain the hardware belongs
to may not be handled with the help of the generic code.

To allow device drivers that may be used along with the generic PM
domains code of more flexibility, add new device callbacks, .freeze(),
.freeze_late(), .thaw_early() and .thaw(), that can be supplied by
the drivers in addition to their "standard" system suspend and
hibernation callbacks.  These new callbacks, if defined, will be used
by the generic PM domains code for the handling of system suspend and
hibernation instead of the "standard" ones.  This will allow drivers
to be designed to work with generic PM domains as well as without
them.

For backwards compatibility, introduce default .freeze(), .thaw(),
.freeze_late() and .thaw_early() callback routines for PM domains that
will execute pm_generic_suspend(), pm_generic_resume(),
pm_generic_suspend_noirq() and pm_generic_resume_noirq(),
respectively, for the given device if its driver doesn't provide its
own implementations of .freeze(), .thaw(), .freeze_late() and
.thaw_early() (this works slightly differently from the current code,
but its existing users don't care anyway).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/domain.c |  189 +++++++++++++++++++-------------------------
 include/linux/pm_domain.h   |    4 
 2 files changed, 87 insertions(+), 106 deletions(-)

Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -28,6 +28,10 @@ struct gpd_dev_ops {
 	int (*stop)(struct device *dev);
 	int (*save_state)(struct device *dev);
 	int (*restore_state)(struct device *dev);
+	int (*freeze)(struct device *dev);
+	int (*freeze_late)(struct device *dev);
+	int (*thaw_early)(struct device *dev);
+	int (*thaw)(struct device *dev);
 	bool (*active_wakeup)(struct device *dev);
 };
 
Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -560,6 +560,26 @@ static bool genpd_dev_active_wakeup(stru
 	return GENPD_DEV_CALLBACK(genpd, bool, active_wakeup, dev);
 }
 
+static int genpd_freeze_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, freeze, dev);
+}
+
+static int genpd_freeze_late(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, freeze_late, dev);
+}
+
+static int genpd_thaw_early(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, thaw_early, dev);
+}
+
+static int genpd_thaw_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, thaw, dev);
+}
+
 /**
  * pm_genpd_sync_poweroff - Synchronously power off a PM domain and its masters.
  * @genpd: PM domain to power off, if possible.
@@ -694,27 +714,6 @@ static int pm_genpd_prepare(struct devic
 }
 
 /**
- * pm_genpd_suspend - Suspend a device belonging to an I/O PM domain.
- * @dev: Device to suspend.
- *
- * Suspend a device under the assumption that its pm_domain field points to the
- * domain member of an object of type struct generic_pm_domain representing
- * a PM domain consisting of I/O devices.
- */
-static int pm_genpd_suspend(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_suspend(dev);
-}
-
-/**
  * pm_genpd_suspend_noirq - Late suspend of a device from an I/O PM domain.
  * @dev: Device to suspend.
  *
@@ -736,7 +735,7 @@ static int pm_genpd_suspend_noirq(struct
 	if (genpd->suspend_power_off)
 		return 0;
 
-	ret = pm_generic_suspend_noirq(dev);
+	ret = genpd_freeze_late(genpd, dev);
 	if (ret)
 		return ret;
 
@@ -787,28 +786,7 @@ static int pm_genpd_resume_noirq(struct
 	genpd->suspended_count--;
 	genpd_start_dev(genpd, dev);
 
-	return pm_generic_resume_noirq(dev);
-}
-
-/**
- * pm_genpd_resume - Resume a device belonging to an I/O power domain.
- * @dev: Device to resume.
- *
- * Resume a device under the assumption that its pm_domain field points to the
- * domain member of an object of type struct generic_pm_domain representing
- * a power domain consisting of I/O devices.
- */
-static int pm_genpd_resume(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_resume(dev);
+	return genpd_thaw_early(genpd, dev);
 }
 
 /**
@@ -829,14 +807,14 @@ static int pm_genpd_freeze(struct device
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	return genpd->suspend_power_off ? 0 : pm_generic_freeze(dev);
+	return genpd->suspend_power_off ? 0 : genpd_freeze_dev(genpd, dev);
 }
 
 /**
  * pm_genpd_freeze_noirq - Late freeze of a device from an I/O power domain.
  * @dev: Device to freeze.
  *
- * Carry out a late freeze of a device under the assumption that its
+ * Carry out a late "freeze" of a device under the assumption that its
  * pm_domain field points to the domain member of an object of type
  * struct generic_pm_domain representing a power domain consisting of I/O
  * devices.
@@ -855,7 +833,7 @@ static int pm_genpd_freeze_noirq(struct
 	if (genpd->suspend_power_off)
 		return 0;
 
-	ret = pm_generic_freeze_noirq(dev);
+	ret = genpd_freeze_late(genpd, dev);
 	if (ret)
 		return ret;
 
@@ -868,7 +846,7 @@ static int pm_genpd_freeze_noirq(struct
  * pm_genpd_thaw_noirq - Early thaw of a device from an I/O power domain.
  * @dev: Device to thaw.
  *
- * Carry out an early thaw of a device under the assumption that its
+ * Carry out an early "thaw" of a device under the assumption that its
  * pm_domain field points to the domain member of an object of type
  * struct generic_pm_domain representing a power domain consisting of I/O
  * devices.
@@ -888,7 +866,7 @@ static int pm_genpd_thaw_noirq(struct de
 
 	genpd_start_dev(genpd, dev);
 
-	return pm_generic_thaw_noirq(dev);
+	return genpd_thaw_early(genpd, dev);
 }
 
 /**
@@ -909,28 +887,7 @@ static int pm_genpd_thaw(struct device *
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	return genpd->suspend_power_off ? 0 : pm_generic_thaw(dev);
-}
-
-/**
- * pm_genpd_dev_poweroff - Power off a device belonging to an I/O PM domain.
- * @dev: Device to suspend.
- *
- * Power off a device under the assumption that its pm_domain field points to
- * the domain member of an object of type struct generic_pm_domain representing
- * a PM domain consisting of I/O devices.
- */
-static int pm_genpd_dev_poweroff(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_poweroff(dev);
+	return genpd->suspend_power_off ? 0 : genpd_thaw_dev(genpd, dev);
 }
 
 /**
@@ -944,7 +901,6 @@ static int pm_genpd_dev_poweroff(struct
 static int pm_genpd_dev_poweroff_noirq(struct device *dev)
 {
 	struct generic_pm_domain *genpd;
-	int ret;
 
 	dev_dbg(dev, "%s()\n", __func__);
 
@@ -955,10 +911,6 @@ static int pm_genpd_dev_poweroff_noirq(s
 	if (genpd->suspend_power_off)
 		return 0;
 
-	ret = pm_generic_poweroff_noirq(dev);
-	if (ret)
-		return ret;
-
 	if (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))
 		return 0;
 
@@ -1014,28 +966,7 @@ static int pm_genpd_restore_noirq(struct
 	genpd->suspended_count--;
 	genpd_start_dev(genpd, dev);
 
-	return pm_generic_restore_noirq(dev);
-}
-
-/**
- * pm_genpd_restore - Restore a device belonging to an I/O power domain.
- * @dev: Device to resume.
- *
- * Restore a device under the assumption that its pm_domain field points to the
- * domain member of an object of type struct generic_pm_domain representing
- * a power domain consisting of I/O devices.
- */
-static int pm_genpd_restore(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_restore(dev);
+	return genpd_thaw_early(genpd, dev);
 }
 
 /**
@@ -1077,18 +1008,14 @@ static void pm_genpd_complete(struct dev
 #else
 
 #define pm_genpd_prepare		NULL
-#define pm_genpd_suspend		NULL
 #define pm_genpd_suspend_noirq		NULL
 #define pm_genpd_resume_noirq		NULL
-#define pm_genpd_resume			NULL
 #define pm_genpd_freeze			NULL
 #define pm_genpd_freeze_noirq		NULL
 #define pm_genpd_thaw_noirq		NULL
 #define pm_genpd_thaw			NULL
 #define pm_genpd_dev_poweroff_noirq	NULL
-#define pm_genpd_dev_poweroff		NULL
 #define pm_genpd_restore_noirq		NULL
-#define pm_genpd_restore		NULL
 #define pm_genpd_complete		NULL
 
 #endif /* CONFIG_PM_SLEEP */
@@ -1354,6 +1281,8 @@ int pm_genpd_remove_callbacks(struct dev
 }
 EXPORT_SYMBOL_GPL(pm_genpd_remove_callbacks);
 
+/* Default device callbacks for generic PM domains. */
+
 /**
  * pm_genpd_default_save_state - Default "save device state" for PM domians.
  * @dev: Device to handle.
@@ -1393,6 +1322,50 @@ static int pm_genpd_default_restore_stat
 }
 
 /**
+ * pm_genpd_default_freeze - Default "device freeze" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_freeze(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze;
+
+	return cb ? cb(dev) : pm_generic_suspend(dev);
+}
+
+/**
+ * pm_genpd_default_freeze_late - Default "late device freeze" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_freeze_late(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze_late;
+
+	return cb ? cb(dev) : pm_generic_suspend_noirq(dev);
+}
+
+/**
+ * pm_genpd_default_thaw_early - Default "early device thaw" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_thaw_early(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw_early;
+
+	return cb ? cb(dev) : pm_generic_resume_noirq(dev);
+}
+
+/**
+ * pm_genpd_default_thaw - Default "device thaw" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_thaw(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw;
+
+	return cb ? cb(dev) : pm_generic_resume(dev);
+}
+
+/**
  * pm_genpd_init - Initialize a generic I/O PM domain object.
  * @genpd: PM domain object to initialize.
  * @gov: PM domain governor to associate with the domain (may be NULL).
@@ -1422,21 +1395,25 @@ void pm_genpd_init(struct generic_pm_dom
 	genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume;
 	genpd->domain.ops.runtime_idle = pm_generic_runtime_idle;
 	genpd->domain.ops.prepare = pm_genpd_prepare;
-	genpd->domain.ops.suspend = pm_genpd_suspend;
+	genpd->domain.ops.suspend = pm_genpd_freeze;
 	genpd->domain.ops.suspend_noirq = pm_genpd_suspend_noirq;
 	genpd->domain.ops.resume_noirq = pm_genpd_resume_noirq;
-	genpd->domain.ops.resume = pm_genpd_resume;
+	genpd->domain.ops.resume = pm_genpd_thaw;
 	genpd->domain.ops.freeze = pm_genpd_freeze;
 	genpd->domain.ops.freeze_noirq = pm_genpd_freeze_noirq;
 	genpd->domain.ops.thaw_noirq = pm_genpd_thaw_noirq;
 	genpd->domain.ops.thaw = pm_genpd_thaw;
-	genpd->domain.ops.poweroff = pm_genpd_dev_poweroff;
+	genpd->domain.ops.poweroff = pm_genpd_freeze;
 	genpd->domain.ops.poweroff_noirq = pm_genpd_dev_poweroff_noirq;
 	genpd->domain.ops.restore_noirq = pm_genpd_restore_noirq;
-	genpd->domain.ops.restore = pm_genpd_restore;
+	genpd->domain.ops.restore = pm_genpd_thaw;
 	genpd->domain.ops.complete = pm_genpd_complete;
 	genpd->dev_ops.save_state = pm_genpd_default_save_state;
 	genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
+	genpd->dev_ops.freeze = pm_genpd_default_freeze;
+	genpd->dev_ops.freeze_late = pm_genpd_default_freeze_late;
+	genpd->dev_ops.thaw_early = pm_genpd_default_thaw_early;
+	genpd->dev_ops.thaw = pm_genpd_default_thaw;
 	mutex_lock(&gpd_list_lock);
 	list_add(&genpd->gpd_list_node, &gpd_list);
 	mutex_unlock(&gpd_list_lock);


^ permalink raw reply

* [PATCH 3/7] PM / Domains: Introduce "save/restore state" device callbacks
From: Rafael J. Wysocki @ 2011-11-07  0:07 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111070101.33960.rjw@sisk.pl>

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

The current PM domains code uses device drivers' .runtime_suspend()
and .runtime_resume() callbacks as the "save device state" and
"restore device state" operations, which may not be appropriate in
general, because it forces drivers to assume that they always will
be used with generic PM domains.  However, in theory, the same
hardware may be used in devices that don't belong to any PM
domain, in which case it would be necessary to add "fake" PM
domains to satisfy the above assumption.  It also may be located in
a PM domain that's not handled with the help of the generic code.

To allow device drivers that may be used along with the generic PM
domains code of more flexibility, introduce new device callbacks,
.save_state() and .restore_state(), that can be supplied by the
drivers in addition to their "standard" runtime PM callbacks.  This
will allow the drivers to be designed to work with generic PM domains
as well as without them.

For backwards compatibility, introduce default .save_state() and
.restore_state() callback routines for PM domains that will execute
a device driver's .runtime_suspend() and .runtime_resume() callbacks,
respectively, for the given device if the driver doesn't provide its
own implementations of .save_state() and .restore_state().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/domain.c |   68 ++++++++++++++++++++++++++++++++++++--------
 include/linux/pm_domain.h   |    2 +
 2 files changed, 58 insertions(+), 12 deletions(-)

Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -26,6 +26,8 @@ struct dev_power_governor {
 struct gpd_dev_ops {
 	int (*start)(struct device *dev);
 	int (*stop)(struct device *dev);
+	int (*save_state)(struct device *dev);
+	int (*restore_state)(struct device *dev);
 	bool (*active_wakeup)(struct device *dev);
 };
 
Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -55,6 +55,16 @@ static int genpd_start_dev(struct generi
 	return GENPD_DEV_CALLBACK(genpd, int, start, dev);
 }
 
+static int genpd_save_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, save_state, dev);
+}
+
+static int genpd_restore_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, restore_state, dev);
+}
+
 static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
 {
 	bool ret = false;
@@ -216,7 +226,6 @@ static int __pm_genpd_save_device(struct
 {
 	struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd);
 	struct device *dev = pdd->dev;
-	struct device_driver *drv = dev->driver;
 	int ret = 0;
 
 	if (gpd_data->need_restore)
@@ -224,11 +233,9 @@ static int __pm_genpd_save_device(struct
 
 	mutex_unlock(&genpd->lock);
 
-	if (drv && drv->pm && drv->pm->runtime_suspend) {
-		genpd_start_dev(genpd, dev);
-		ret = drv->pm->runtime_suspend(dev);
-		genpd_stop_dev(genpd, dev);
-	}
+	genpd_start_dev(genpd, dev);
+	ret = genpd_save_dev(genpd, dev);
+	genpd_stop_dev(genpd, dev);
 
 	mutex_lock(&genpd->lock);
 
@@ -249,18 +256,15 @@ static void __pm_genpd_restore_device(st
 {
 	struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd);
 	struct device *dev = pdd->dev;
-	struct device_driver *drv = dev->driver;
 
 	if (!gpd_data->need_restore)
 		return;
 
 	mutex_unlock(&genpd->lock);
 
-	if (drv && drv->pm && drv->pm->runtime_resume) {
-		genpd_start_dev(genpd, dev);
-		drv->pm->runtime_resume(dev);
-		genpd_stop_dev(genpd, dev);
-	}
+	genpd_start_dev(genpd, dev);
+	genpd_restore_dev(genpd, dev);
+	genpd_stop_dev(genpd, dev);
 
 	mutex_lock(&genpd->lock);
 
@@ -1351,6 +1355,44 @@ int pm_genpd_remove_callbacks(struct dev
 EXPORT_SYMBOL_GPL(pm_genpd_remove_callbacks);
 
 /**
+ * pm_genpd_default_save_state - Default "save device state" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_save_state(struct device *dev)
+{
+	int (*cb)(struct device *__dev);
+	struct device_driver *drv = dev->driver;
+
+	cb = dev_gpd_data(dev)->ops.save_state;
+	if (cb)
+		return cb(dev);
+
+	if (drv && drv->pm && drv->pm->runtime_suspend)
+		return drv->pm->runtime_suspend(dev);
+
+	return 0;
+}
+
+/**
+ * pm_genpd_default_restore_state - Default PM domians "restore device state".
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_restore_state(struct device *dev)
+{
+	int (*cb)(struct device *__dev);
+	struct device_driver *drv = dev->driver;
+
+	cb = dev_gpd_data(dev)->ops.restore_state;
+	if (cb)
+		return cb(dev);
+
+	if (drv && drv->pm && drv->pm->runtime_resume)
+		return drv->pm->runtime_resume(dev);
+
+	return 0;
+}
+
+/**
  * pm_genpd_init - Initialize a generic I/O PM domain object.
  * @genpd: PM domain object to initialize.
  * @gov: PM domain governor to associate with the domain (may be NULL).
@@ -1393,6 +1435,8 @@ void pm_genpd_init(struct generic_pm_dom
 	genpd->domain.ops.restore_noirq = pm_genpd_restore_noirq;
 	genpd->domain.ops.restore = pm_genpd_restore;
 	genpd->domain.ops.complete = pm_genpd_complete;
+	genpd->dev_ops.save_state = pm_genpd_default_save_state;
+	genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
 	mutex_lock(&gpd_list_lock);
 	list_add(&genpd->gpd_list_node, &gpd_list);
 	mutex_unlock(&gpd_list_lock);


^ permalink raw reply

* [PATCH 0/7] PM / Domains: Per-device callbacks and PM QoS
From: Rafael J. Wysocki @ 2011-11-07  0:01 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet

Hi,

The following patchset makes it possible to define device-specific PM domain
callbacks, allowing device drivers to be designed to support generic PM domains
and work without them as well, and introduces governor functions deciding
whether or not it is beneficial to put devices into low-power states.  The new
code is designed to be backwards compatible, as far as necessary.

[1/7] - Make it possible to defing per-device start/stop routines.
[2/7] - Make it possible to defing per-device .active_wakeup() callbacks.
[3/7] - Introduce "save/restore state" device callbacks.
[4/7] - Introduce per-device PM domain callbacks for system suspend.
[5/7] - Add device "stop governor".
[6/7] - Add domain "power off governor".
[7/7] - Automatically update overoptimistic latency information.

Please refer to the changelogs for more information.

The patches haven't been fully tested yet, so most likely there still are some
rough edges here and there.

Thanks,
Rafael


^ permalink raw reply

* [PATCH 4/7] PM / Domains: Rework system suspend callback routines
From: Rafael J. Wysocki @ 2011-11-07  0:08 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111070101.33960.rjw@sisk.pl>

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

The current generic PM domains code attempts to use the generic
system suspend operations along with the domains' device stop/start
routines, which requires device drivers to assume that their
system suspend/resume (and hibernation/restore) callbacks will always
be used with generic PM domains.  However, in theory, the same
hardware may be used in devices that don't belong to any PM domain,
in which case it would be necessary to add "fake" PM domains to
satisfy the above assumption.  Also, the domain the hardware belongs
to may not be handled with the help of the generic code.

To allow device drivers that may be used along with the generic PM
domains code of more flexibility, add new device callbacks, .freeze(),
.freeze_late(), .thaw_early() and .thaw(), that can be supplied by
the drivers in addition to their "standard" system suspend and
hibernation callbacks.  These new callbacks, if defined, will be used
by the generic PM domains code for the handling of system suspend and
hibernation instead of the "standard" ones.  This will allow drivers
to be designed to work with generic PM domains as well as without
them.

For backwards compatibility, introduce default .freeze(), .thaw(),
.freeze_late() and .thaw_early() callback routines for PM domains that
will execute pm_generic_suspend(), pm_generic_resume(),
pm_generic_suspend_noirq() and pm_generic_resume_noirq(),
respectively, for the given device if its driver doesn't provide its
own implementations of .freeze(), .thaw(), .freeze_late() and
.thaw_early() (this works slightly differently from the current code,
but its existing users don't care anyway).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/domain.c |  189 +++++++++++++++++++-------------------------
 include/linux/pm_domain.h   |    4 
 2 files changed, 87 insertions(+), 106 deletions(-)

Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -28,6 +28,10 @@ struct gpd_dev_ops {
 	int (*stop)(struct device *dev);
 	int (*save_state)(struct device *dev);
 	int (*restore_state)(struct device *dev);
+	int (*freeze)(struct device *dev);
+	int (*freeze_late)(struct device *dev);
+	int (*thaw_early)(struct device *dev);
+	int (*thaw)(struct device *dev);
 	bool (*active_wakeup)(struct device *dev);
 };
 
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -560,6 +560,26 @@ static bool genpd_dev_active_wakeup(stru
 	return GENPD_DEV_CALLBACK(genpd, bool, active_wakeup, dev);
 }
 
+static int genpd_freeze_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, freeze, dev);
+}
+
+static int genpd_freeze_late(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, freeze_late, dev);
+}
+
+static int genpd_thaw_early(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, thaw_early, dev);
+}
+
+static int genpd_thaw_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, thaw, dev);
+}
+
 /**
  * pm_genpd_sync_poweroff - Synchronously power off a PM domain and its masters.
  * @genpd: PM domain to power off, if possible.
@@ -694,27 +714,6 @@ static int pm_genpd_prepare(struct devic
 }
 
 /**
- * pm_genpd_suspend - Suspend a device belonging to an I/O PM domain.
- * @dev: Device to suspend.
- *
- * Suspend a device under the assumption that its pm_domain field points to the
- * domain member of an object of type struct generic_pm_domain representing
- * a PM domain consisting of I/O devices.
- */
-static int pm_genpd_suspend(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_suspend(dev);
-}
-
-/**
  * pm_genpd_suspend_noirq - Late suspend of a device from an I/O PM domain.
  * @dev: Device to suspend.
  *
@@ -736,7 +735,7 @@ static int pm_genpd_suspend_noirq(struct
 	if (genpd->suspend_power_off)
 		return 0;
 
-	ret = pm_generic_suspend_noirq(dev);
+	ret = genpd_freeze_late(genpd, dev);
 	if (ret)
 		return ret;
 
@@ -787,28 +786,7 @@ static int pm_genpd_resume_noirq(struct
 	genpd->suspended_count--;
 	genpd_start_dev(genpd, dev);
 
-	return pm_generic_resume_noirq(dev);
-}
-
-/**
- * pm_genpd_resume - Resume a device belonging to an I/O power domain.
- * @dev: Device to resume.
- *
- * Resume a device under the assumption that its pm_domain field points to the
- * domain member of an object of type struct generic_pm_domain representing
- * a power domain consisting of I/O devices.
- */
-static int pm_genpd_resume(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_resume(dev);
+	return genpd_thaw_early(genpd, dev);
 }
 
 /**
@@ -829,14 +807,14 @@ static int pm_genpd_freeze(struct device
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	return genpd->suspend_power_off ? 0 : pm_generic_freeze(dev);
+	return genpd->suspend_power_off ? 0 : genpd_freeze_dev(genpd, dev);
 }
 
 /**
  * pm_genpd_freeze_noirq - Late freeze of a device from an I/O power domain.
  * @dev: Device to freeze.
  *
- * Carry out a late freeze of a device under the assumption that its
+ * Carry out a late "freeze" of a device under the assumption that its
  * pm_domain field points to the domain member of an object of type
  * struct generic_pm_domain representing a power domain consisting of I/O
  * devices.
@@ -855,7 +833,7 @@ static int pm_genpd_freeze_noirq(struct
 	if (genpd->suspend_power_off)
 		return 0;
 
-	ret = pm_generic_freeze_noirq(dev);
+	ret = genpd_freeze_late(genpd, dev);
 	if (ret)
 		return ret;
 
@@ -868,7 +846,7 @@ static int pm_genpd_freeze_noirq(struct
  * pm_genpd_thaw_noirq - Early thaw of a device from an I/O power domain.
  * @dev: Device to thaw.
  *
- * Carry out an early thaw of a device under the assumption that its
+ * Carry out an early "thaw" of a device under the assumption that its
  * pm_domain field points to the domain member of an object of type
  * struct generic_pm_domain representing a power domain consisting of I/O
  * devices.
@@ -888,7 +866,7 @@ static int pm_genpd_thaw_noirq(struct de
 
 	genpd_start_dev(genpd, dev);
 
-	return pm_generic_thaw_noirq(dev);
+	return genpd_thaw_early(genpd, dev);
 }
 
 /**
@@ -909,28 +887,7 @@ static int pm_genpd_thaw(struct device *
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	return genpd->suspend_power_off ? 0 : pm_generic_thaw(dev);
-}
-
-/**
- * pm_genpd_dev_poweroff - Power off a device belonging to an I/O PM domain.
- * @dev: Device to suspend.
- *
- * Power off a device under the assumption that its pm_domain field points to
- * the domain member of an object of type struct generic_pm_domain representing
- * a PM domain consisting of I/O devices.
- */
-static int pm_genpd_dev_poweroff(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_poweroff(dev);
+	return genpd->suspend_power_off ? 0 : genpd_thaw_dev(genpd, dev);
 }
 
 /**
@@ -944,7 +901,6 @@ static int pm_genpd_dev_poweroff(struct
 static int pm_genpd_dev_poweroff_noirq(struct device *dev)
 {
 	struct generic_pm_domain *genpd;
-	int ret;
 
 	dev_dbg(dev, "%s()\n", __func__);
 
@@ -955,10 +911,6 @@ static int pm_genpd_dev_poweroff_noirq(s
 	if (genpd->suspend_power_off)
 		return 0;
 
-	ret = pm_generic_poweroff_noirq(dev);
-	if (ret)
-		return ret;
-
 	if (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))
 		return 0;
 
@@ -1014,28 +966,7 @@ static int pm_genpd_restore_noirq(struct
 	genpd->suspended_count--;
 	genpd_start_dev(genpd, dev);
 
-	return pm_generic_restore_noirq(dev);
-}
-
-/**
- * pm_genpd_restore - Restore a device belonging to an I/O power domain.
- * @dev: Device to resume.
- *
- * Restore a device under the assumption that its pm_domain field points to the
- * domain member of an object of type struct generic_pm_domain representing
- * a power domain consisting of I/O devices.
- */
-static int pm_genpd_restore(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-
-	dev_dbg(dev, "%s()\n", __func__);
-
-	genpd = dev_to_genpd(dev);
-	if (IS_ERR(genpd))
-		return -EINVAL;
-
-	return genpd->suspend_power_off ? 0 : pm_generic_restore(dev);
+	return genpd_thaw_early(genpd, dev);
 }
 
 /**
@@ -1077,18 +1008,14 @@ static void pm_genpd_complete(struct dev
 #else
 
 #define pm_genpd_prepare		NULL
-#define pm_genpd_suspend		NULL
 #define pm_genpd_suspend_noirq		NULL
 #define pm_genpd_resume_noirq		NULL
-#define pm_genpd_resume			NULL
 #define pm_genpd_freeze			NULL
 #define pm_genpd_freeze_noirq		NULL
 #define pm_genpd_thaw_noirq		NULL
 #define pm_genpd_thaw			NULL
 #define pm_genpd_dev_poweroff_noirq	NULL
-#define pm_genpd_dev_poweroff		NULL
 #define pm_genpd_restore_noirq		NULL
-#define pm_genpd_restore		NULL
 #define pm_genpd_complete		NULL
 
 #endif /* CONFIG_PM_SLEEP */
@@ -1354,6 +1281,8 @@ int pm_genpd_remove_callbacks(struct dev
 }
 EXPORT_SYMBOL_GPL(pm_genpd_remove_callbacks);
 
+/* Default device callbacks for generic PM domains. */
+
 /**
  * pm_genpd_default_save_state - Default "save device state" for PM domians.
  * @dev: Device to handle.
@@ -1393,6 +1322,50 @@ static int pm_genpd_default_restore_stat
 }
 
 /**
+ * pm_genpd_default_freeze - Default "device freeze" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_freeze(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze;
+
+	return cb ? cb(dev) : pm_generic_suspend(dev);
+}
+
+/**
+ * pm_genpd_default_freeze_late - Default "late device freeze" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_freeze_late(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze_late;
+
+	return cb ? cb(dev) : pm_generic_suspend_noirq(dev);
+}
+
+/**
+ * pm_genpd_default_thaw_early - Default "early device thaw" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_thaw_early(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw_early;
+
+	return cb ? cb(dev) : pm_generic_resume_noirq(dev);
+}
+
+/**
+ * pm_genpd_default_thaw - Default "device thaw" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_thaw(struct device *dev)
+{
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw;
+
+	return cb ? cb(dev) : pm_generic_resume(dev);
+}
+
+/**
  * pm_genpd_init - Initialize a generic I/O PM domain object.
  * @genpd: PM domain object to initialize.
  * @gov: PM domain governor to associate with the domain (may be NULL).
@@ -1422,21 +1395,25 @@ void pm_genpd_init(struct generic_pm_dom
 	genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume;
 	genpd->domain.ops.runtime_idle = pm_generic_runtime_idle;
 	genpd->domain.ops.prepare = pm_genpd_prepare;
-	genpd->domain.ops.suspend = pm_genpd_suspend;
+	genpd->domain.ops.suspend = pm_genpd_freeze;
 	genpd->domain.ops.suspend_noirq = pm_genpd_suspend_noirq;
 	genpd->domain.ops.resume_noirq = pm_genpd_resume_noirq;
-	genpd->domain.ops.resume = pm_genpd_resume;
+	genpd->domain.ops.resume = pm_genpd_thaw;
 	genpd->domain.ops.freeze = pm_genpd_freeze;
 	genpd->domain.ops.freeze_noirq = pm_genpd_freeze_noirq;
 	genpd->domain.ops.thaw_noirq = pm_genpd_thaw_noirq;
 	genpd->domain.ops.thaw = pm_genpd_thaw;
-	genpd->domain.ops.poweroff = pm_genpd_dev_poweroff;
+	genpd->domain.ops.poweroff = pm_genpd_freeze;
 	genpd->domain.ops.poweroff_noirq = pm_genpd_dev_poweroff_noirq;
 	genpd->domain.ops.restore_noirq = pm_genpd_restore_noirq;
-	genpd->domain.ops.restore = pm_genpd_restore;
+	genpd->domain.ops.restore = pm_genpd_thaw;
 	genpd->domain.ops.complete = pm_genpd_complete;
 	genpd->dev_ops.save_state = pm_genpd_default_save_state;
 	genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
+	genpd->dev_ops.freeze = pm_genpd_default_freeze;
+	genpd->dev_ops.freeze_late = pm_genpd_default_freeze_late;
+	genpd->dev_ops.thaw_early = pm_genpd_default_thaw_early;
+	genpd->dev_ops.thaw = pm_genpd_default_thaw;
 	mutex_lock(&gpd_list_lock);
 	list_add(&genpd->gpd_list_node, &gpd_list);
 	mutex_unlock(&gpd_list_lock);


^ permalink raw reply

* [PATCH 3/7] PM / Domains: Introduce "save/restore state" device callbacks
From: Rafael J. Wysocki @ 2011-11-07  0:07 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111070101.33960.rjw@sisk.pl>

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

The current PM domains code uses device drivers' .runtime_suspend()
and .runtime_resume() callbacks as the "save device state" and
"restore device state" operations, which may not be appropriate in
general, because it forces drivers to assume that they always will
be used with generic PM domains.  However, in theory, the same
hardware may be used in devices that don't belong to any PM
domain, in which case it would be necessary to add "fake" PM
domains to satisfy the above assumption.  It also may be located in
a PM domain that's not handled with the help of the generic code.

To allow device drivers that may be used along with the generic PM
domains code of more flexibility, introduce new device callbacks,
.save_state() and .restore_state(), that can be supplied by the
drivers in addition to their "standard" runtime PM callbacks.  This
will allow the drivers to be designed to work with generic PM domains
as well as without them.

For backwards compatibility, introduce default .save_state() and
.restore_state() callback routines for PM domains that will execute
a device driver's .runtime_suspend() and .runtime_resume() callbacks,
respectively, for the given device if the driver doesn't provide its
own implementations of .save_state() and .restore_state().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/domain.c |   68 ++++++++++++++++++++++++++++++++++++--------
 include/linux/pm_domain.h   |    2 +
 2 files changed, 58 insertions(+), 12 deletions(-)

Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -26,6 +26,8 @@ struct dev_power_governor {
 struct gpd_dev_ops {
 	int (*start)(struct device *dev);
 	int (*stop)(struct device *dev);
+	int (*save_state)(struct device *dev);
+	int (*restore_state)(struct device *dev);
 	bool (*active_wakeup)(struct device *dev);
 };
 
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -55,6 +55,16 @@ static int genpd_start_dev(struct generi
 	return GENPD_DEV_CALLBACK(genpd, int, start, dev);
 }
 
+static int genpd_save_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, save_state, dev);
+}
+
+static int genpd_restore_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, int, restore_state, dev);
+}
+
 static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
 {
 	bool ret = false;
@@ -216,7 +226,6 @@ static int __pm_genpd_save_device(struct
 {
 	struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd);
 	struct device *dev = pdd->dev;
-	struct device_driver *drv = dev->driver;
 	int ret = 0;
 
 	if (gpd_data->need_restore)
@@ -224,11 +233,9 @@ static int __pm_genpd_save_device(struct
 
 	mutex_unlock(&genpd->lock);
 
-	if (drv && drv->pm && drv->pm->runtime_suspend) {
-		genpd_start_dev(genpd, dev);
-		ret = drv->pm->runtime_suspend(dev);
-		genpd_stop_dev(genpd, dev);
-	}
+	genpd_start_dev(genpd, dev);
+	ret = genpd_save_dev(genpd, dev);
+	genpd_stop_dev(genpd, dev);
 
 	mutex_lock(&genpd->lock);
 
@@ -249,18 +256,15 @@ static void __pm_genpd_restore_device(st
 {
 	struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd);
 	struct device *dev = pdd->dev;
-	struct device_driver *drv = dev->driver;
 
 	if (!gpd_data->need_restore)
 		return;
 
 	mutex_unlock(&genpd->lock);
 
-	if (drv && drv->pm && drv->pm->runtime_resume) {
-		genpd_start_dev(genpd, dev);
-		drv->pm->runtime_resume(dev);
-		genpd_stop_dev(genpd, dev);
-	}
+	genpd_start_dev(genpd, dev);
+	genpd_restore_dev(genpd, dev);
+	genpd_stop_dev(genpd, dev);
 
 	mutex_lock(&genpd->lock);
 
@@ -1351,6 +1355,44 @@ int pm_genpd_remove_callbacks(struct dev
 EXPORT_SYMBOL_GPL(pm_genpd_remove_callbacks);
 
 /**
+ * pm_genpd_default_save_state - Default "save device state" for PM domians.
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_save_state(struct device *dev)
+{
+	int (*cb)(struct device *__dev);
+	struct device_driver *drv = dev->driver;
+
+	cb = dev_gpd_data(dev)->ops.save_state;
+	if (cb)
+		return cb(dev);
+
+	if (drv && drv->pm && drv->pm->runtime_suspend)
+		return drv->pm->runtime_suspend(dev);
+
+	return 0;
+}
+
+/**
+ * pm_genpd_default_restore_state - Default PM domians "restore device state".
+ * @dev: Device to handle.
+ */
+static int pm_genpd_default_restore_state(struct device *dev)
+{
+	int (*cb)(struct device *__dev);
+	struct device_driver *drv = dev->driver;
+
+	cb = dev_gpd_data(dev)->ops.restore_state;
+	if (cb)
+		return cb(dev);
+
+	if (drv && drv->pm && drv->pm->runtime_resume)
+		return drv->pm->runtime_resume(dev);
+
+	return 0;
+}
+
+/**
  * pm_genpd_init - Initialize a generic I/O PM domain object.
  * @genpd: PM domain object to initialize.
  * @gov: PM domain governor to associate with the domain (may be NULL).
@@ -1393,6 +1435,8 @@ void pm_genpd_init(struct generic_pm_dom
 	genpd->domain.ops.restore_noirq = pm_genpd_restore_noirq;
 	genpd->domain.ops.restore = pm_genpd_restore;
 	genpd->domain.ops.complete = pm_genpd_complete;
+	genpd->dev_ops.save_state = pm_genpd_default_save_state;
+	genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
 	mutex_lock(&gpd_list_lock);
 	list_add(&genpd->gpd_list_node, &gpd_list);
 	mutex_unlock(&gpd_list_lock);


^ permalink raw reply

* [PATCH 2/7] PM / Domains: Make it possible to use per-device .active_wakeup()
From: Rafael J. Wysocki @ 2011-11-07  0:06 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111070101.33960.rjw@sisk.pl>

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

The current generic PM domains code requires that the same
.active_wakeup() device callback routine be used for all devices in
the given domain, which is inflexible and may not cover some specific
use cases.  For this reason, make it possible to use device specific
.active_wakeup() callback routines by adding a corresponding callback
pointer to struct generic_pm_domain_data.  To reduce code duplication
use struct gpd_dev_ops to represent PM domain device callbacks as
well as device-specific ones and add a macro for defining routines
that will execute those callbacks.

Modify the shmobile's power domains code to allow drivers to use
their own .active_wakeup() callback routines.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-sh7372.c |   11 ++++---
 drivers/base/power/domain.c        |   54 ++++++++++++++++++-------------------
 include/linux/pm_domain.h          |   15 ++++------
 3 files changed, 41 insertions(+), 39 deletions(-)

Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -23,6 +23,12 @@ struct dev_power_governor {
 	bool (*power_down_ok)(struct dev_pm_domain *domain);
 };
 
+struct gpd_dev_ops {
+	int (*start)(struct device *dev);
+	int (*stop)(struct device *dev);
+	bool (*active_wakeup)(struct device *dev);
+};
+
 struct generic_pm_domain {
 	struct dev_pm_domain domain;	/* PM domain operations */
 	struct list_head gpd_list_node;	/* Node in the global PM domains list */
@@ -45,9 +51,7 @@ struct generic_pm_domain {
 	bool dev_irq_safe;	/* Device callbacks are IRQ-safe */
 	int (*power_off)(struct generic_pm_domain *domain);
 	int (*power_on)(struct generic_pm_domain *domain);
-	int (*start_device)(struct device *dev);
-	int (*stop_device)(struct device *dev);
-	bool (*active_wakeup)(struct device *dev);
+	struct gpd_dev_ops dev_ops;
 };
 
 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -62,11 +66,6 @@ struct gpd_link {
 	struct list_head slave_node;
 };
 
-struct gpd_dev_ops {
-	int (*start)(struct device *dev);
-	int (*stop)(struct device *dev);
-};
-
 struct generic_pm_domain_data {
 	struct pm_domain_data base;
 	struct gpd_dev_ops ops;
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -16,6 +16,22 @@
 #include <linux/sched.h>
 #include <linux/suspend.h>
 
+#define GENPD_DEV_CALLBACK(genpd, type, callback, dev)		\
+({								\
+	type (*__routine)(struct device *__d); 			\
+	type __ret = (type)0;					\
+								\
+	__routine = genpd->dev_ops.callback; 			\
+	if (__routine) {					\
+		__ret = __routine(dev); 			\
+	} else {						\
+		__routine = dev_gpd_data(dev)->ops.callback;	\
+		if (__routine) 					\
+			__ret = __routine(dev);			\
+	}							\
+	__ret;							\
+})
+
 static LIST_HEAD(gpd_list);
 static DEFINE_MUTEX(gpd_list_lock);
 
@@ -31,32 +47,12 @@ static struct generic_pm_domain *dev_to_
 
 static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
-	int (*stop)(struct device *dev);
-
-	stop = genpd->stop_device;
-	if (stop)
-		return stop(dev);
-
-	stop = dev_gpd_data(dev)->ops.stop;
-	if (stop)
-		return stop(dev);
-
-	return 0;
+	return GENPD_DEV_CALLBACK(genpd, int, stop, dev);
 }
 
 static int genpd_start_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
-	int (*start)(struct device *dev);
-
-	start = genpd->start_device;
-	if (start)
-		return start(dev);
-
-	start = dev_gpd_data(dev)->ops.start;
-	if (start)
-		return start(dev);
-
-	return 0;
+	return GENPD_DEV_CALLBACK(genpd, int, start, dev);
 }
 
 static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
@@ -554,6 +550,12 @@ static inline void genpd_power_off_work_
 
 #ifdef CONFIG_PM_SLEEP
 
+static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd,
+				    struct device *dev)
+{
+	return GENPD_DEV_CALLBACK(genpd, bool, active_wakeup, dev);
+}
+
 /**
  * pm_genpd_sync_poweroff - Synchronously power off a PM domain and its masters.
  * @genpd: PM domain to power off, if possible.
@@ -610,7 +612,7 @@ static bool resume_needed(struct device
 	if (!device_can_wakeup(dev))
 		return false;
 
-	active_wakeup = genpd->active_wakeup && genpd->active_wakeup(dev);
+	active_wakeup = genpd_dev_active_wakeup(genpd, dev);
 	return device_may_wakeup(dev) ? active_wakeup : !active_wakeup;
 }
 
@@ -734,8 +736,7 @@ static int pm_genpd_suspend_noirq(struct
 	if (ret)
 		return ret;
 
-	if (dev->power.wakeup_path
-	    && genpd->active_wakeup && genpd->active_wakeup(dev))
+	if (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))
 		return 0;
 
 	genpd_stop_dev(genpd, dev);
@@ -954,8 +955,7 @@ static int pm_genpd_dev_poweroff_noirq(s
 	if (ret)
 		return ret;
 
-	if (dev->power.wakeup_path
-	    && genpd->active_wakeup && genpd->active_wakeup(dev))
+	if (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))
 		return 0;
 
 	genpd_stop_dev(genpd, dev);
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -151,7 +151,10 @@ static void sh7372_a4r_suspend(void)
 
 static bool pd_active_wakeup(struct device *dev)
 {
-	return true;
+	bool (*active_wakeup)(struct device *dev);
+
+	active_wakeup = dev_gpd_data(dev)->ops.active_wakeup;
+	return active_wakeup ? active_wakeup(dev) : true;
 }
 
 static bool sh7372_power_down_forbidden(struct dev_pm_domain *domain)
@@ -197,10 +200,10 @@ void sh7372_init_pm_domain(struct sh7372
 	struct generic_pm_domain *genpd = &sh7372_pd->genpd;
 
 	pm_genpd_init(genpd, sh7372_pd->gov, false);
-	genpd->stop_device = sh7372_stop_dev;
-	genpd->start_device = sh7372_start_dev;
+	genpd->dev_ops.stop = sh7372_stop_dev;
+	genpd->dev_ops.start = sh7372_start_dev;
+	genpd->dev_ops.active_wakeup = pd_active_wakeup;
 	genpd->dev_irq_safe = true;
-	genpd->active_wakeup = pd_active_wakeup;
 	genpd->power_off = pd_power_down;
 	genpd->power_on = pd_power_up;
 	genpd->power_on(&sh7372_pd->genpd);


^ permalink raw reply

* [PATCH 1/7] PM / Domains: Make it possible to use per-device start/stop routines
From: Rafael J. Wysocki @ 2011-11-07  0:06 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111070101.33960.rjw@sisk.pl>

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

The current generic PM domains code requires that the same .stop()
and .start() device callback routines be used for all devices in the
given domain, which is inflexible and may not cover some specific use
cases.  For this reason, make it possible to use device specific
.start() and .stop() callback routines by adding corresponding
callback pointers to struct generic_pm_domain_data.  Add a new helper
routine, pm_genpd_register_callbacks(), that can be used to populate
the new per-device callback pointers.

Modify the shmobile's power domains code to allow drivers to add
their own code to be run during the device stop and start operations
with the help of the new callback pointers.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-sh7372.c |   33 ++++++++-
 drivers/base/power/domain.c        |  135 ++++++++++++++++++++++++++++---------
 include/linux/pm_domain.h          |   22 ++++++
 3 files changed, 156 insertions(+), 34 deletions(-)

Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -62,8 +62,14 @@ struct gpd_link {
 	struct list_head slave_node;
 };
 
+struct gpd_dev_ops {
+	int (*start)(struct device *dev);
+	int (*stop)(struct device *dev);
+};
+
 struct generic_pm_domain_data {
 	struct pm_domain_data base;
+	struct gpd_dev_ops ops;
 	bool need_restore;
 };
 
@@ -72,6 +78,11 @@ static inline struct generic_pm_domain_d
 	return container_of(pdd, struct generic_pm_domain_data, base);
 }
 
+static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
+{
+	return to_gpd_data(dev->power.subsys_data->domain_data);
+}
+
 #ifdef CONFIG_PM_GENERIC_DOMAINS
 extern int pm_genpd_add_device(struct generic_pm_domain *genpd,
 			       struct device *dev);
@@ -81,6 +92,8 @@ extern int pm_genpd_add_subdomain(struct
 				  struct generic_pm_domain *new_subdomain);
 extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
 				     struct generic_pm_domain *target);
+extern int pm_genpd_add_callbacks(struct device *dev, struct gpd_dev_ops *ops);
+extern int pm_genpd_remove_callbacks(struct device *dev);
 extern void pm_genpd_init(struct generic_pm_domain *genpd,
 			  struct dev_power_governor *gov, bool is_off);
 extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
@@ -105,6 +118,15 @@ static inline int pm_genpd_remove_subdom
 {
 	return -ENOSYS;
 }
+static inline int pm_genpd_add_callbacks(struct device *dev,
+					 struct gpd_dev_ops *ops)
+{
+	return -ENOSYS;
+}
+static inline int pm_genpd_remove_callbacks(struct device *dev)
+{
+	return -ENOSYS;
+}
 static inline void pm_genpd_init(struct generic_pm_domain *genpd,
 				 struct dev_power_governor *gov, bool is_off) {}
 static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -29,6 +29,36 @@ static struct generic_pm_domain *dev_to_
 	return pd_to_genpd(dev->pm_domain);
 }
 
+static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	int (*stop)(struct device *dev);
+
+	stop = genpd->stop_device;
+	if (stop)
+		return stop(dev);
+
+	stop = dev_gpd_data(dev)->ops.stop;
+	if (stop)
+		return stop(dev);
+
+	return 0;
+}
+
+static int genpd_start_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	int (*start)(struct device *dev);
+
+	start = genpd->start_device;
+	if (start)
+		return start(dev);
+
+	start = dev_gpd_data(dev)->ops.start;
+	if (start)
+		return start(dev);
+
+	return 0;
+}
+
 static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
 {
 	bool ret = false;
@@ -199,13 +229,9 @@ static int __pm_genpd_save_device(struct
 	mutex_unlock(&genpd->lock);
 
 	if (drv && drv->pm && drv->pm->runtime_suspend) {
-		if (genpd->start_device)
-			genpd->start_device(dev);
-
+		genpd_start_dev(genpd, dev);
 		ret = drv->pm->runtime_suspend(dev);
-
-		if (genpd->stop_device)
-			genpd->stop_device(dev);
+		genpd_stop_dev(genpd, dev);
 	}
 
 	mutex_lock(&genpd->lock);
@@ -235,13 +261,9 @@ static void __pm_genpd_restore_device(st
 	mutex_unlock(&genpd->lock);
 
 	if (drv && drv->pm && drv->pm->runtime_resume) {
-		if (genpd->start_device)
-			genpd->start_device(dev);
-
+		genpd_start_dev(genpd, dev);
 		drv->pm->runtime_resume(dev);
-
-		if (genpd->stop_device)
-			genpd->stop_device(dev);
+		genpd_stop_dev(genpd, dev);
 	}
 
 	mutex_lock(&genpd->lock);
@@ -413,6 +435,7 @@ static void genpd_power_off_work_fn(stru
 static int pm_genpd_runtime_suspend(struct device *dev)
 {
 	struct generic_pm_domain *genpd;
+	int ret;
 
 	dev_dbg(dev, "%s()\n", __func__);
 
@@ -422,11 +445,9 @@ static int pm_genpd_runtime_suspend(stru
 
 	might_sleep_if(!genpd->dev_irq_safe);
 
-	if (genpd->stop_device) {
-		int ret = genpd->stop_device(dev);
-		if (ret)
-			return ret;
-	}
+	ret = genpd_stop_dev(genpd, dev);
+	if (ret)
+		return ret;
 
 	/*
 	 * If power.irq_safe is set, this routine will be run with interrupts
@@ -502,8 +523,7 @@ static int pm_genpd_runtime_resume(struc
 	mutex_unlock(&genpd->lock);
 
  out:
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return 0;
 }
@@ -646,7 +666,7 @@ static int pm_genpd_prepare(struct devic
 	/*
 	 * The PM domain must be in the GPD_STATE_ACTIVE state at this point,
 	 * so pm_genpd_poweron() will return immediately, but if the device
-	 * is suspended (e.g. it's been stopped by .stop_device()), we need
+	 * is suspended (e.g. it's been stopped by genpd_stop_dev()), we need
 	 * to make it operational.
 	 */
 	pm_runtime_resume(dev);
@@ -718,8 +738,7 @@ static int pm_genpd_suspend_noirq(struct
 	    && genpd->active_wakeup && genpd->active_wakeup(dev))
 		return 0;
 
-	if (genpd->stop_device)
-		genpd->stop_device(dev);
+	genpd_stop_dev(genpd, dev);
 
 	/*
 	 * Since all of the "noirq" callbacks are executed sequentially, it is
@@ -761,8 +780,7 @@ static int pm_genpd_resume_noirq(struct
 	 */
 	pm_genpd_poweron(genpd);
 	genpd->suspended_count--;
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return pm_generic_resume_noirq(dev);
 }
@@ -836,8 +854,7 @@ static int pm_genpd_freeze_noirq(struct
 	if (ret)
 		return ret;
 
-	if (genpd->stop_device)
-		genpd->stop_device(dev);
+	genpd_stop_dev(genpd, dev);
 
 	return 0;
 }
@@ -864,8 +881,7 @@ static int pm_genpd_thaw_noirq(struct de
 	if (genpd->suspend_power_off)
 		return 0;
 
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return pm_generic_thaw_noirq(dev);
 }
@@ -942,8 +958,7 @@ static int pm_genpd_dev_poweroff_noirq(s
 	    && genpd->active_wakeup && genpd->active_wakeup(dev))
 		return 0;
 
-	if (genpd->stop_device)
-		genpd->stop_device(dev);
+	genpd_stop_dev(genpd, dev);
 
 	/*
 	 * Since all of the "noirq" callbacks are executed sequentially, it is
@@ -993,8 +1008,7 @@ static int pm_genpd_restore_noirq(struct
 
 	pm_genpd_poweron(genpd);
 	genpd->suspended_count--;
-	if (genpd->start_device)
-		genpd->start_device(dev);
+	genpd_start_dev(genpd, dev);
 
 	return pm_generic_restore_noirq(dev);
 }
@@ -1280,6 +1294,63 @@ int pm_genpd_remove_subdomain(struct gen
 }
 
 /**
+ * pm_genpd_add_callbacks - Add PM domain callbacks to a given device.
+ * @dev: Device to add the callbacks to.
+ * @ops: Set of callbacks to add.
+ */
+int pm_genpd_add_callbacks(struct device *dev, struct gpd_dev_ops *ops)
+{
+	struct generic_pm_domain_data *gpd_data;
+	int ret = 0;
+
+	if (!(dev && dev->power.subsys_data && ops))
+		return -EINVAL;
+
+	pm_runtime_disable(dev);
+	device_pm_lock();
+
+	gpd_data = dev_gpd_data(dev);
+	if (gpd_data)
+		gpd_data->ops = *ops;
+	else
+		ret = -EINVAL;
+
+	device_pm_unlock();
+	pm_runtime_enable(dev);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(pm_genpd_add_callbacks);
+
+/**
+ * pm_genpd_remove_callbacks - Remove PM domain callbacks from a given device.
+ * @dev: Device to remove the callbacks from.
+ */
+int pm_genpd_remove_callbacks(struct device *dev)
+{
+	struct generic_pm_domain_data *gpd_data;
+	int ret = 0;
+
+	if (!(dev && dev->power.subsys_data))
+		return -EINVAL;
+
+	pm_runtime_disable(dev);
+	device_pm_lock();
+
+	gpd_data = dev_gpd_data(dev);
+	if (gpd_data)
+		gpd_data->ops = (struct gpd_dev_ops){ 0 };
+	else
+		ret = -EINVAL;
+
+	device_pm_unlock();
+	pm_runtime_enable(dev);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(pm_genpd_remove_callbacks);
+
+/**
  * pm_genpd_init - Initialize a generic I/O PM domain object.
  * @genpd: PM domain object to initialize.
  * @gov: PM domain governor to associate with the domain (may be NULL).
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -163,13 +163,42 @@ struct dev_power_governor sh7372_always_
 	.power_down_ok = sh7372_power_down_forbidden,
 };
 
+static int sh7372_stop_dev(struct device *dev)
+{
+	int (*stop)(struct device *dev);
+
+	stop = dev_gpd_data(dev)->ops.stop;
+	if (stop) {
+		int ret = stop(dev);
+		if (ret)
+			return ret;
+	}
+	return pm_clk_suspend(dev);
+}
+
+static int sh7372_start_dev(struct device *dev)
+{
+	int (*start)(struct device *dev);
+	int ret;
+
+	ret = pm_clk_resume(dev);
+	if (ret)
+		return ret;
+
+	start = dev_gpd_data(dev)->ops.start;
+	if (start)
+		ret = start(dev);
+
+	return ret;
+}
+
 void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
 {
 	struct generic_pm_domain *genpd = &sh7372_pd->genpd;
 
 	pm_genpd_init(genpd, sh7372_pd->gov, false);
-	genpd->stop_device = pm_clk_suspend;
-	genpd->start_device = pm_clk_resume;
+	genpd->stop_device = sh7372_stop_dev;
+	genpd->start_device = sh7372_start_dev;
 	genpd->dev_irq_safe = true;
 	genpd->active_wakeup = pd_active_wakeup;
 	genpd->power_off = pd_power_down;


^ permalink raw reply

* linux-next: manual merge of the mips tree with Linus' tree
From: Stephen Rothwell @ 2011-11-07  0:04 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-next, linux-kernel, Manuel Lauss, Yong Zhang

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

Hi Ralf,

Today's linux-next merge of the mips tree got a conflict in
arch/mips/alchemy/common/dbdma.c between commit f2e442fd2ff4 ("MIPS:
Alchemy: clean DMA code of CONFIG_SOC_AU1??? defines") from Linus' tree
and commit 6e8722f887b2 ("MIPS: irq: Remove IRQF_DISABLED") from the mips
tree.

I fixed it up (see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc arch/mips/alchemy/common/dbdma.c
index 0e63ee4,4025d77..0000000
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@@ -1019,8 -1037,19 +1019,7 @@@ static int __init dbdma_setup(unsigned 
  	dbdma_gptr->ddma_inten = 0xffff;
  	au_sync();
  
- 	ret = request_irq(irq, dbdma_interrupt, IRQF_DISABLED, "dbdma",
- 			  (void *)dbdma_gptr);
 -	switch (alchemy_get_cputype()) {
 -	case ALCHEMY_CPU_AU1550:
 -		irq_nr = AU1550_DDMA_INT;
 -		break;
 -	case ALCHEMY_CPU_AU1200:
 -		irq_nr = AU1200_DDMA_INT;
 -		break;
 -	default:
 -		return -ENODEV;
 -	}
 -
 -	ret = request_irq(irq_nr, dbdma_interrupt, 0,
 -			"Au1xxx dbdma", (void *)dbdma_gptr);
++	ret = request_irq(irq, dbdma_interrupt, 0, "dbdma", (void *)dbdma_gptr);
  	if (ret)
  		printk(KERN_ERR "Cannot grab DBDMA interrupt!\n");
  	else {

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

^ permalink raw reply

* linux-next: manual merge of the mips tree with Linus' tree
From: Stephen Rothwell @ 2011-11-07  0:04 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-next, linux-kernel, Yong Zhang, David Daney

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

Hi Ralf,

Today's linux-next merge of the mips tree got a conflict in
arch/mips/kernel/perf_event.c between commit e5dcb58aa510 ("MIPS: perf:
Reorganize contents of perf support files") from Linus' tree and commit
6e8722f887b2 ("MIPS: irq: Remove IRQF_DISABLED") from the mips tree.

The former moved the code that the latter modified and it appeasr to have
been fixed up in its new position.  So I just used the version of this
file that is in Linus' tree.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

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

^ permalink raw reply

* [PATCH 0/7] PM / Domains: Per-device callbacks and PM QoS
From: Rafael J. Wysocki @ 2011-11-07  0:01 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet

Hi,

The following patchset makes it possible to define device-specific PM domain
callbacks, allowing device drivers to be designed to support generic PM domains
and work without them as well, and introduces governor functions deciding
whether or not it is beneficial to put devices into low-power states.  The new
code is designed to be backwards compatible, as far as necessary.

[1/7] - Make it possible to defing per-device start/stop routines.
[2/7] - Make it possible to defing per-device .active_wakeup() callbacks.
[3/7] - Introduce "save/restore state" device callbacks.
[4/7] - Introduce per-device PM domain callbacks for system suspend.
[5/7] - Add device "stop governor".
[6/7] - Add domain "power off governor".
[7/7] - Automatically update overoptimistic latency information.

Please refer to the changelogs for more information.

The patches haven't been fully tested yet, so most likely there still are some
rough edges here and there.

Thanks,
Rafael


^ permalink raw reply

* [U-Boot] [PATCH 00/14] Support for HTKW mcx board
From: Ilya Yanok @ 2011-11-07  0:00 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <CA+M6bXn5WCdpfJW0nKT+QU6V8s=xLDde3YMvHps6O4KvTmHPog@mail.gmail.com>

Hi Tom,

03.11.2011 4:33, Tom Rini wrote:
>> these patches introduce support for HTKW mcx board (AM3517-based).
>>
>> Previously posted DaVinci EMAC patches
>> ( http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/112309 )
>> and NAND SPL patches
>> ( http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/112890 )
>> are also included as long as EHCI host support (moved from Beagle
>> board code).
>>
>> Signed-off-by: Ilya Yanok<yanok@emcraft.com>
>
> I'm not sure what we should do about this series right now.  Aside
> from some "easily" fixable things like all of the PHY files needing an
> ugly #include "../../../../../drivers/net/davinci_emac.h" to compile

Shouldn't we use generic PHY layer and move all PHY files to 
drivers/net/phy?

> again and a CONFIG_SYS_CACHELINE_SIZE 32 in all of the platforms, the

s/CONFIG_SYS_CACHELINE_SIZE/ARCH_DMA_MINALIGN/ should solve this 
problem. I'll fix this.

> lack of flush functions means that MAKEALL -s davinci fails for almost
> every board now.  I'm not sure what we should do, at this point...

Argh.. Actually my initial version had a workaround for this, only using 
{flush,invalidate}_dcache_range under #ifdef DAVINCI_EMAC_DCACHE 
clause... But Mike told me that I should remove this...

Maybe we can just add empty functions for CONFIG_DCACHE_OFF case to fix 
the compilation?

Regards, Ilya.

^ permalink raw reply

* [PATCH 4/9] staging/comedi/amplc: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/amplc_dio200.c |    9 +++------
 drivers/staging/comedi/drivers/amplc_pc236.c  |    6 ++----
 drivers/staging/comedi/drivers/amplc_pc263.c  |    6 ++----
 drivers/staging/comedi/drivers/amplc_pci224.c |    9 +++------
 drivers/staging/comedi/drivers/amplc_pci230.c |    9 +++------
 5 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index 93bbe4e..566cc44 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -421,12 +421,9 @@ static const struct dio200_layout_struct dio200_layouts[] = {
 
 #ifdef CONFIG_COMEDI_PCI
 static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = {
-	{
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, dio200_pci_table);
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
index 48246cd..7972cad 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -134,10 +134,8 @@ static const struct pc236_board pc236_boards[] = {
 
 #ifdef CONFIG_COMEDI_PCI
 static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = {
-	{
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, pc236_pci_table);
diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c
index 8a33880..191ac0d 100644
--- a/drivers/staging/comedi/drivers/amplc_pc263.c
+++ b/drivers/staging/comedi/drivers/amplc_pc263.c
@@ -101,10 +101,8 @@ static const struct pc263_board pc263_boards[] = {
 
 #ifdef CONFIG_COMEDI_PCI
 static DEFINE_PCI_DEVICE_TABLE(pc263_pci_table) = {
-	{
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, pc263_pci_table);
diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c
index 1b5ba1c..b278917 100644
--- a/drivers/staging/comedi/drivers/amplc_pci224.c
+++ b/drivers/staging/comedi/drivers/amplc_pci224.c
@@ -384,12 +384,9 @@ static const struct pci224_board pci224_boards[] = {
  */
 
 static DEFINE_PCI_DEVICE_TABLE(pci224_pci_table) = {
-	{
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, pci224_pci_table);
diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c
index 7edeb11..5389795 100644
--- a/drivers/staging/comedi/drivers/amplc_pci230.c
+++ b/drivers/staging/comedi/drivers/amplc_pci230.c
@@ -501,12 +501,9 @@ static const struct pci230_board pci230_boards[] = {
 };
 
 static DEFINE_PCI_DEVICE_TABLE(pci230_pci_table) = {
-	{
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI230, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI260, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI230) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI260) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, pci230_pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 5/9] staging/comedi/cb_pcimdda: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/cb_pcimdda.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c
index 8c981a8..6521d61 100644
--- a/drivers/staging/comedi/drivers/cb_pcimdda.c
+++ b/drivers/staging/comedi/drivers/cb_pcimdda.c
@@ -144,10 +144,8 @@ static const struct board_struct boards[] = {
 /* Please add your PCI vendor ID to comedidev.h, and it will be forwarded
  * upstream. */
 static DEFINE_PCI_DEVICE_TABLE(pci_table) = {
-	{
-	PCI_VENDOR_ID_COMPUTERBOARDS, PCI_ID_PCIM_DDA06_16, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_ID_PCIM_DDA06_16) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 6/9] staging/comedi/das08: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/das08.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c
index 3141dc8..c2dd0ed 100644
--- a/drivers/staging/comedi/drivers/das08.c
+++ b/drivers/staging/comedi/drivers/das08.c
@@ -506,10 +506,8 @@ struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = {
 
 #ifdef CONFIG_COMEDI_PCI
 static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = {
-	{
-	PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, das08_pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 8/9] staging/comedi/me_daq: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/me_daq.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c
index cda4b22..8b812e4 100644
--- a/drivers/staging/comedi/drivers/me_daq.c
+++ b/drivers/staging/comedi/drivers/me_daq.c
@@ -188,12 +188,9 @@ static const struct comedi_lrange me2600_ao_range = {
 };
 
 static DEFINE_PCI_DEVICE_TABLE(me_pci_table) = {
-	{
-	PCI_VENDOR_ID_MEILHAUS, ME2600_DEVICE_ID, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_MEILHAUS, ME2000_DEVICE_ID, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_MEILHAUS, ME2600_DEVICE_ID) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_MEILHAUS, ME2000_DEVICE_ID) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, me_pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 9/9] staging/comedi/contec: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/contec_pci_dio.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c
index 871f109..db73638 100644
--- a/drivers/staging/comedi/drivers/contec_pci_dio.c
+++ b/drivers/staging/comedi/drivers/contec_pci_dio.c
@@ -57,10 +57,9 @@ static const struct contec_board contec_boards[] = {
 
 #define PCI_DEVICE_ID_PIO1616L 0x8172
 static DEFINE_PCI_DEVICE_TABLE(contec_pci_table) = {
-	{
-	PCI_VENDOR_ID_CONTEC, PCI_DEVICE_ID_PIO1616L, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, PIO1616L}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_CONTEC, PCI_DEVICE_ID_PIO1616L),
+		.driver_data = PIO1616L },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, contec_pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 7/9] staging/comedi/ke_counter: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/ke_counter.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c
index 286093b..4e9e9a0 100644
--- a/drivers/staging/comedi/drivers/ke_counter.c
+++ b/drivers/staging/comedi/drivers/ke_counter.c
@@ -52,10 +52,8 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it);
 static int cnt_detach(struct comedi_device *dev);
 
 static DEFINE_PCI_DEVICE_TABLE(cnt_pci_table) = {
-	{
-	PCI_VENDOR_ID_KOLTER, CNT_CARD_DEVICE_ID, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_KOLTER, CNT_CARD_DEVICE_ID) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, cnt_pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 2/9] staging/comedi/daqboard: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/daqboard2000.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c
index 82be77d..542c760 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -325,9 +325,8 @@ static const struct daq200_boardtype boardtypes[] = {
 #define this_board ((const struct daq200_boardtype *)dev->board_ptr)
 
 static DEFINE_PCI_DEVICE_TABLE(daqboard2000_pci_table) = {
-	{
-	0x1616, 0x0409, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(0x1616, 0x0409) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, daqboard2000_pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 3/9] staging/comedi/adl: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe
In-Reply-To: <1320623647-5108-1-git-send-email-peterhuewe@gmx.de>

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/adl_pci7230.c |   10 +---------
 drivers/staging/comedi/drivers/adl_pci7296.c |    6 ++----
 drivers/staging/comedi/drivers/adl_pci7432.c |    6 ++----
 drivers/staging/comedi/drivers/adl_pci8164.c |    6 ++----
 drivers/staging/comedi/drivers/adl_pci9111.c |    6 ++----
 5 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c
index 72a7258..20d5705 100644
--- a/drivers/staging/comedi/drivers/adl_pci7230.c
+++ b/drivers/staging/comedi/drivers/adl_pci7230.c
@@ -44,15 +44,7 @@ Configuration Options:
 #define PCI_DEVICE_ID_PCI7230 0x7230
 
 static DEFINE_PCI_DEVICE_TABLE(adl_pci7230_pci_table) = {
-	{
-		PCI_VENDOR_ID_ADLINK,
-		PCI_DEVICE_ID_PCI7230,
-		PCI_ANY_ID,
-		PCI_ANY_ID,
-		0,
-		0,
-		0
-	},
+	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7230) },
 	{0}
 };
 
diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c
index f28fe6b..9a232053 100644
--- a/drivers/staging/comedi/drivers/adl_pci7296.c
+++ b/drivers/staging/comedi/drivers/adl_pci7296.c
@@ -49,10 +49,8 @@ Configuration Options:
 #define PCI_DEVICE_ID_PCI7296 0x7296
 
 static DEFINE_PCI_DEVICE_TABLE(adl_pci7296_pci_table) = {
-	{
-	PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, adl_pci7296_pci_table);
diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c
index 262da7b..86ee219 100644
--- a/drivers/staging/comedi/drivers/adl_pci7432.c
+++ b/drivers/staging/comedi/drivers/adl_pci7432.c
@@ -44,10 +44,8 @@ Configuration Options:
 #define PCI_DEVICE_ID_PCI7432 0x7432
 
 static DEFINE_PCI_DEVICE_TABLE(adl_pci7432_pci_table) = {
-	{
-	PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, adl_pci7432_pci_table);
diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c
index 767a594..3b83d65 100644
--- a/drivers/staging/comedi/drivers/adl_pci8164.c
+++ b/drivers/staging/comedi/drivers/adl_pci8164.c
@@ -57,10 +57,8 @@ Configuration Options:
 #define PCI_DEVICE_ID_PCI8164 0x8164
 
 static DEFINE_PCI_DEVICE_TABLE(adl_pci8164_pci_table) = {
-	{
-	PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164, PCI_ANY_ID,
-		    PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, adl_pci8164_pci_table);
diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
index fc48bae..2a9bd88 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -311,10 +311,8 @@ static const struct comedi_lrange pci9111_hr_ai_range = {
 };
 
 static DEFINE_PCI_DEVICE_TABLE(pci9111_pci_table) = {
-	{ PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
-	  0, 0, 0 },
-	/* { PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
-	 *   0, 0, 0 }, */
+	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID) },
+	/* { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID) }, */
 	{ 0 }
 };
 
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 1/9] staging/comedi/jr3: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used)
From: Peter Huewe @ 2011-11-06 23:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Ian Abbott, Mori Hess, Peter Huewe

This patch converts pci_table entries to use the PCI_DEVICE macro,
if .subvendor and .subdevice are set to PCI_ANY_ID,
and thus improves readablity.

Since the driver_data field isn't used anywhere we can also drop the
assignments for class, class_mask and driver_data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/drivers/jr3_pci.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index 8d98cf4..56f7e26 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -71,18 +71,12 @@ static struct comedi_driver driver_jr3_pci = {
 };
 
 static DEFINE_PCI_DEVICE_TABLE(jr3_pci_pci_table) = {
-	{
-	PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_4_CHANNEL,
-		    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-	0}
+	{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_4_CHANNEL) },
+	{0}
 };
 
 MODULE_DEVICE_TABLE(pci, jr3_pci_pci_table);
-- 
1.7.3.4


^ permalink raw reply related

* Re: linux-next: failing to fetch the sysctl tree
From: Eric W. Biederman @ 2011-11-06 23:41 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, linux-kernel
In-Reply-To: <20111107095835.208466a386fbcf046c512d70@canb.auug.org.au>

Stephen Rothwell <sfr@canb.auug.org.au> writes:

> Hi Eric,
>
> Fetching the sysctl tree produces this error:
>
> fatal: Couldn't find remote ref refs/heads/master
>
> And indeed the sysctl tree on git.kernel.org is completely empty (i.e.
> there are no commits).  Maybe you should remove it and recreate it as a
> fork of Linus' tree.

Something weird happened when I re-uploaded things.  Apparently hitting
Ctrl-C if when you are uploading and realized you forgot to clone from
Linus's repository is fatal to how git.kernel.org manages things.  Last
I checked I could not even delete the broken repository.

Can you please switch to linux/kernel/git/ebiederm/sysctl.git instead of
sysctl-2.6.git.

With a little luck I will have something interesting in there this
round.

Thanks,
Eric

^ permalink raw reply

* [git pull] Please pull powerpc.git next branch
From: Benjamin Herrenschmidt @ 2011-11-06 23:35 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev list, Andrew Morton, Linux Kernel list

Hi Linus !

Here's (finally) the powerpc stuff for this merge window. It's late, as
I warned you during KS, I was on vacation & travelling around and really
couldn't get to do it earlier than today. Everything in there has been
in linux-next for a while anyway, the only difference from what was in
github a month ago is that I merged a bit more freescale bits from
Kumar.

As for the highlights, you get the new "powernv" platform which allows
booting under the new "OPAL" firmware. This will allow booting without a
hypervisor on future IBM POWER machines, in order to be able to run KVM.
There's still one missing component to support the latest PCI Express
bridges, but it's a drop-in addition, so I might still merge it after
-rc1 (or not .. I haven't decided yet, I held on to it for a bit as it
was depending on some PCI changes that went upstream separately via
Jesse and dealing with the dependency while travelling was deemed too
annoying).

We also have a bunch of Numa fixes from Anton, some DMA code cleanup
from Milton and the usual batch of embedded bits and pieces.

Cheers,
Ben.
 
The following changes since commit d6748066ad0e8b2514545998f8367ebb3906f299:

  Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus (2011-11-03 13:28:14 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git next

Anatolij Gustschin (5):
      powerpc/5200: mpc5200b.dtsi: add spi node address- and size-cells properties
      powerpc/5200: dts: digsy_mtc.dts: update to add can, pci, serial and spi
      powerpc/5200: dts: digsy_mtc.dts: add timer0 and timer1 gpio properties
      powerpc/5200: dts: digsy_mtc.dts: enable both MSCAN nodes
      powerpc/85xx: fix PHYS_64BIT selection for P1022DS

Anshuman Khandual (1):
      perf events, powerpc: Add POWER7 stalled-cycles-frontend/backend events

Anton Blanchard (11):
      powerpc/pseries: Avoid spurious error during hotplug CPU add
      powerpc/numa: Enable SD_WAKE_AFFINE in node definition
      sched: Allow SD_NODES_PER_DOMAIN to be overridden
      powerpc/numa: Increase SD_NODES_PER_DOMAIN to 32.
      powerpc/numa: Disable NEWIDLE balancing at node level
      powerpc/numa: Remove duplicate RECLAIM_DISTANCE definition
      powerpc/numa: Remove double of_node_put in hot_add_node_scn_to_nid
      powerpc: Use for_each_node_by_type instead of open coding it
      powerpc: Coding style cleanups
      powerpc: Fix oops when echoing bad values to /sys/devices/system/memory/probe
      powerpc: Fix deadlock in icswx code

Arnaud Lacombe (1):
      powerpc/xics: Add __init to marker icp_native_init()

Arnd Bergmann (1):
      serial/8250: Move UPIO_TSI to powerpc

Ayman El-Khashab (1):
      powerpc/4xx: enable and fix pcie gen1/gen2 on the 460sx

Becky Bruce (4):
      powerpc: Hugetlb for BookE
      powerpc: Update mpc85xx/corenet 32-bit defconfigs
      powerpc: Update corenet64_smp_defconfig
      powerpc/fsl-booke: Fix settlbcam for 64-bit

Benjamin Herrenschmidt (27):
      Merge remote-tracking branch 'jwb/next' into next
      Merge remote-tracking branch 'origin/master' into next
      powerpc/wsp: Add PCIe Root support to PowerEN/WSP
      Merge remote-tracking branch 'origin/master' into next
      powerpc/udbg: Fix Kconfig entry for avoiding 44x early debug with KVM
      powerpc/smp: More generic support for "soft hotplug"
      powerpc/pci: Call pcie_bus_configure_settings()
      powerpc/powernv: Don't clobber r9 in relative_toc()
      powerpc: Add skeleton PowerNV platform
      of: Change logic to overwrite cmd_line with CONFIG_CMDLINE
      powerpc/powernv: Add CPU hotplug support
      powerpc/powernv: Add OPAL takeover from PowerVM
      powerpc/powernv: Get kernel command line accross OPAL takeover
      powerpc/powernv: Basic support for OPAL
      powerpc/powernv: Add support for instanciating OPAL v2 from Open Firmware
      powerpc/powernv: Support for OPAL console
      powerpc/powernv: Hookup reboot and poweroff functions
      powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks
      powerpc/powernv: Add OPAL ICS backend
      powerpc/powernv: Register and handle OPAL interrupts
      powerpc/powernv: Machine check and other system interrupts
      powerpc/powernv: Add support for p5ioc2 PCI-X and PCIe
      powerpc/powernv: Implement MSI support for p5ioc2 PCIe
      powerpc/powernv: Handle PCI-X/PCIe reset delay
      powerpc/pci: Don't configure PCIe settings when PCI_PROBE_ONLY is set
      powerpc/ptrace: Fix build with gcc 4.6
      powerpc: Don't try OPAL takeover on old 970 blades

Bharat Bhushan (1):
      powerpc: e500mc: Fix: use CONFIG_PPC_E500MC in idle_e500.S

Brian King (1):
      hvcs: Ensure page aligned partner info buffer

Carl E. Love (1):
      powerpc/perf_event: Fix Power6 L1 cache read & write event codes]

Dmitry Eremin-Solenikov (5):
      cpc925_edac: Support single-processor configurations
      powerpc/85xx: sbc8560 - correct compilation if CONFIG_PHYS_ADDR_T_64BIT is set
      powerpc/85xx: ksi8560 - declare that localbus is compatbile with simple-bus
      powerpc/85xx: sbc8560 - declare that localbus is compatbile with simple-bus
      powerpc/mpc8349emitx: mark localbus as compatible with simple-bus

Fabio Baltieri (1):
      powerpc/83xx: Add shutdown request support to MCU handling on MPC8349 MITX

Felix Radensky (1):
      powerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver

Hector Martin (1):
      powerpc/ps3: Add gelic udbg driver

Holger Brunck (1):
      powerpc/82xx: updates for mgcoge

Hongjun Chen (1):
      powerpc/cpm: Clear muram before it is in use.

Jim Keniston (1):
      powerpc/nvram: Add compression to fit more oops output into NVRAM

Jimi Xenidis (2):
      powerpc/wsp: Fix Wire Speed Processor platform configs
      powerpc: Fix xmon for systems without MSR[RI]

Josh Boyer (1):
      powerpc/40x: Remove obsolete HCU4 board

Julia Lawall (1):
      pseries/iommu: Add missing kfree

Kumar Gala (6):
      powerpc/85xx: Rename PowerPC core nodes to match other e500mc based .dts
      powerpc/fsl-booke: Handle L1 D-cache parity error correctly on e500mc
      powerpc: respect mem= setting for early memory limit setup
      powerpc/fsl-booke: Fix setup_initial_memory_limit to not blindly map
      powerpc/85xx: Setup secondary cores PIR with hard SMP id
      powerpc/85xx: Add 'fsl,pq3-gpio' compatiable for GPIO driver

Liu Yu (3):
      powerpc/math_emu/efp: Use pr_debug instead of printk
      powerpc/math_emu/efp: No need to round if the result is exact
      powerpc/math_emu/efp: Look for errata handler when type mismatches

Martyn Welch (1):
      powerpc/86xx: Correct Gianfar support for GE boards

Matthew McClintock (5):
      powerpc: Fix build dependencies for epapr.c which needs libfdt.h
      powerpc/85xx: Fix support for enabling doorbells for IPIs
      powerpc/85xx: issue 15 EOI after core reset for FSL CoreNet devices
      powerpc/fsl_booke: Fix comment in head_fsl_booke.S
      powerpc/85xx: Make kexec to interate over online cpus

Michael Ellerman (1):
      powerpc/wsp: Add MSI support for PCI on PowerEN

Mihai Caraman (1):
      drivers/virt: add ioctl for 32-bit compat on 64-bit to fsl-hv-manager

Mike Williams (1):
      powerpc/4xx: edac: Add comma to fix build error

Milton Miller (4):
      powerpc: Override dma_get_required_mask by platform hook and ops
      dma-mapping: Add get_required_mask if arch overrides default
      powerpc: Use the newly added get_required_mask dma_map_ops hook
      powerpc: Tidy up dma_map_ops after adding new hook

Mingkai Hu (1):
      powerpc/85xx: Rename p2040_rdb.c to p2041_rdb.c

Paul Mackerras (1):
      powerpc: Fix hugetlb with CONFIG_PPC_MM_SLICES=y

Scott Wood (1):
      powerpc/32: Pass device tree address as u64 to machine_init

Shengzhou Liu (1):
      powerpc/p3060qds: Add support for P3060QDS board

Stefan Roese (1):
      powerpc/44x: Add NOR flash device to Yosemite dts

Stephen George (1):
      powerpc/85xx: Adding DCSR node to dtsi device trees

Suzuki Poulose (1):
      powerpc/44x: Kexec support for PPC440X chipsets

Tang Yuantian (1):
      powerpc/mm: Fix the call trace when resumed from hibernation

Thadeu Lima de Souza Cascardo (2):
      powerpc/eeh: Fix /proc/ppc64/eeh creation
      powerpc: Reserve iommu page 0

Timur Tabi (5):
      powerpc/mpic: Add support for discontiguous cores
      powerpc/5200: enable audio in the defconfig
      powerpc/fsl_msi: fix support for multiple MSI ranges
      powerpc/85xx: clean up FPGA device tree nodes for Freecsale QorIQ boards
      powerpc/fsl_msi: add support for "msi-address-64" property

Tony Breeds (1):
      powerpc/4xx/pci: Add __init annotations for *init_port_hw() functions.

Wolfram Sang (2):
      gpio: move mpc8xxx/512x gpio driver to drivers/gpio
      powerpc: update 512x-defconfig

 .../devicetree/bindings/powerpc/fsl/board.txt      |   30 +-
 .../devicetree/bindings/powerpc/fsl/dcsr.txt       |  395 +++++++
 .../devicetree/bindings/powerpc/fsl/msi-pic.txt    |   42 +
 arch/powerpc/Kconfig                               |    7 +-
 arch/powerpc/Kconfig.debug                         |   46 +-
 arch/powerpc/boot/Makefile                         |    3 +-
 arch/powerpc/boot/dts/digsy_mtc.dts                |   59 +-
 arch/powerpc/boot/dts/gef_ppc9a.dts                |   33 +-
 arch/powerpc/boot/dts/gef_sbc310.dts               |   33 +-
 arch/powerpc/boot/dts/gef_sbc610.dts               |   33 +-
 arch/powerpc/boot/dts/hcu4.dts                     |  168 ---
 arch/powerpc/boot/dts/ksi8560.dts                  |    2 +-
 arch/powerpc/boot/dts/mgcoge.dts                   |    9 +
 arch/powerpc/boot/dts/mpc5200b.dtsi                |    2 +
 arch/powerpc/boot/dts/mpc8349emitx.dts             |    3 +-
 arch/powerpc/boot/dts/p1022ds.dts                  |    2 +-
 arch/powerpc/boot/dts/p2020ds.dts                  |    5 +
 .../boot/dts/{p2040rdb.dts => p2041rdb.dts}        |   17 +-
 .../boot/dts/{p2040si.dtsi => p2041si.dtsi}        |  135 ++-
 arch/powerpc/boot/dts/p3041ds.dts                  |    8 +-
 arch/powerpc/boot/dts/p3041si.dtsi                 |   71 ++-
 arch/powerpc/boot/dts/p3060qds.dts                 |  238 ++++
 arch/powerpc/boot/dts/p3060si.dtsi                 |  719 +++++++++++++
 arch/powerpc/boot/dts/p4080ds.dts                  |   12 +-
 arch/powerpc/boot/dts/p4080si.dtsi                 |  114 ++-
 arch/powerpc/boot/dts/p5020ds.dts                  |    8 +-
 arch/powerpc/boot/dts/p5020si.dtsi                 |   68 ++-
 arch/powerpc/boot/dts/sbc8560.dts                  |    2 +-
 arch/powerpc/boot/dts/yosemite.dts                 |   36 +
 arch/powerpc/configs/40x/hcu4_defconfig            |   80 --
 arch/powerpc/configs/85xx/p1023rds_defconfig       |    2 +-
 arch/powerpc/configs/85xx/xes_mpc85xx_defconfig    |    2 +-
 arch/powerpc/configs/corenet32_smp_defconfig       |   11 +-
 arch/powerpc/configs/corenet64_smp_defconfig       |    5 -
 arch/powerpc/configs/mgcoge_defconfig              |   27 +-
 arch/powerpc/configs/mpc512x_defconfig             |   19 +-
 arch/powerpc/configs/mpc5200_defconfig             |   12 +
 arch/powerpc/configs/mpc85xx_defconfig             |    5 +-
 arch/powerpc/configs/mpc85xx_smp_defconfig         |    6 +-
 arch/powerpc/configs/ppc40x_defconfig              |    1 -
 arch/powerpc/configs/ppc6xx_defconfig              |    2 +-
 arch/powerpc/include/asm/device.h                  |    2 +
 arch/powerpc/include/asm/firmware.h                |   10 +
 arch/powerpc/include/asm/hugetlb.h                 |   63 ++-
 arch/powerpc/include/asm/kexec.h                   |    2 +-
 arch/powerpc/include/asm/machdep.h                 |    3 +-
 arch/powerpc/include/asm/mmu-book3e.h              |    7 +
 arch/powerpc/include/asm/mmu-hash64.h              |    3 +-
 arch/powerpc/include/asm/mmu.h                     |   18 +-
 arch/powerpc/include/asm/mpic.h                    |    2 -
 arch/powerpc/include/asm/opal.h                    |  443 ++++++++
 arch/powerpc/include/asm/paca.h                    |    8 +
 arch/powerpc/include/asm/page.h                    |   31 +-
 arch/powerpc/include/asm/page_64.h                 |   11 -
 arch/powerpc/include/asm/pte-book3e.h              |    3 +
 arch/powerpc/include/asm/reg_booke.h               |    3 +
 arch/powerpc/include/asm/rtas.h                    |    6 +-
 arch/powerpc/include/asm/smp.h                     |    1 +
 arch/powerpc/include/asm/sparsemem.h               |    2 +-
 arch/powerpc/include/asm/topology.h                |   14 +-
 arch/powerpc/include/asm/udbg.h                    |    3 +
 arch/powerpc/include/asm/xics.h                    |   19 +
 arch/powerpc/kernel/asm-offsets.c                  |   10 +
 arch/powerpc/kernel/dma-iommu.c                    |   28 +-
 arch/powerpc/kernel/dma-swiotlb.c                  |   16 +
 arch/powerpc/kernel/dma.c                          |   44 +-
 arch/powerpc/kernel/exceptions-64s.S               |   27 +-
 arch/powerpc/kernel/head_32.S                      |    7 +-
 arch/powerpc/kernel/head_40x.S                     |   15 +-
 arch/powerpc/kernel/head_44x.S                     |   16 +-
 arch/powerpc/kernel/head_64.S                      |   22 +-
 arch/powerpc/kernel/head_8xx.S                     |   13 +-
 arch/powerpc/kernel/head_fsl_booke.S               |  175 +++-
 arch/powerpc/kernel/ibmebus.c                      |   22 +-
 arch/powerpc/kernel/idle_e500.S                    |    2 +-
 arch/powerpc/kernel/iommu.c                        |    8 +
 arch/powerpc/kernel/legacy_serial.c                |   25 +
 arch/powerpc/kernel/machine_kexec_64.c             |    3 +-
 arch/powerpc/kernel/misc_32.S                      |  171 +++
 arch/powerpc/kernel/pci-common.c                   |   11 +
 arch/powerpc/kernel/power6-pmu.c                   |    4 +-
 arch/powerpc/kernel/power7-pmu.c                   |    2 +
 arch/powerpc/kernel/prom.c                         |   19 +-
 arch/powerpc/kernel/prom_init.c                    |  383 ++++++-
 arch/powerpc/kernel/prom_init_check.sh             |    4 +-
 arch/powerpc/kernel/ptrace.c                       |   18 +-
 arch/powerpc/kernel/setup_32.c                     |    2 +-
 arch/powerpc/kernel/setup_64.c                     |   22 +-
 arch/powerpc/kernel/smp.c                          |   30 +-
 arch/powerpc/kernel/swsusp.c                       |    2 +-
 arch/powerpc/kernel/traps.c                        |    9 +-
 arch/powerpc/kernel/udbg.c                         |    6 +
 arch/powerpc/kernel/vio.c                          |   21 +-
 arch/powerpc/math-emu/math_efp.c                   |  100 +-
 arch/powerpc/mm/Makefile                           |    1 +
 arch/powerpc/mm/fsl_booke_mmu.c                    |   43 +-
 arch/powerpc/mm/hash_utils_64.c                    |    9 +-
 arch/powerpc/mm/hugetlbpage-book3e.c               |  121 +++
 arch/powerpc/mm/hugetlbpage.c                      |  379 ++++++-
 arch/powerpc/mm/init_32.c                          |    9 +
 arch/powerpc/mm/mem.c                              |    8 +-
 arch/powerpc/mm/mmu_context_hash64.c               |   12 +-
 arch/powerpc/mm/mmu_context_nohash.c               |    5 +
 arch/powerpc/mm/mmu_decl.h                         |    2 +
 arch/powerpc/mm/numa.c                             |   20 +-
 arch/powerpc/mm/pgtable.c                          |    3 +-
 arch/powerpc/mm/tlb_low_64e.S                      |   24 +-
 arch/powerpc/mm/tlb_nohash.c                       |   67 ++-
 arch/powerpc/platforms/40x/Kconfig                 |    8 -
 arch/powerpc/platforms/40x/Makefile                |    1 -
 arch/powerpc/platforms/40x/hcu4.c                  |   61 --
 arch/powerpc/platforms/512x/Kconfig                |    1 +
 arch/powerpc/platforms/82xx/km82xx.c               |    4 +
 arch/powerpc/platforms/83xx/Kconfig                |    9 +-
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c     |   58 +-
 arch/powerpc/platforms/85xx/Kconfig                |   32 +-
 arch/powerpc/platforms/85xx/Makefile               |    3 +-
 arch/powerpc/platforms/85xx/p1022_ds.c             |   11 +-
 .../platforms/85xx/{p2040_rdb.c => p2041_rdb.c}    |   18 +-
 arch/powerpc/platforms/85xx/p3060_qds.c            |   77 ++
 arch/powerpc/platforms/85xx/sbc8560.c              |    2 +-
 arch/powerpc/platforms/85xx/smp.c                  |   12 +-
 arch/powerpc/platforms/86xx/Kconfig                |    1 +
 arch/powerpc/platforms/Kconfig                     |   13 +-
 arch/powerpc/platforms/Kconfig.cputype             |    4 +-
 arch/powerpc/platforms/Makefile                    |    1 +
 arch/powerpc/platforms/cell/iommu.c                |   21 +
 arch/powerpc/platforms/powernv/Kconfig             |   16 +
 arch/powerpc/platforms/powernv/Makefile            |    5 +
 arch/powerpc/platforms/powernv/opal-nvram.c        |   88 ++
 arch/powerpc/platforms/powernv/opal-rtc.c          |   97 ++
 arch/powerpc/platforms/powernv/opal-takeover.S     |  140 +++
 arch/powerpc/platforms/powernv/opal-wrappers.S     |  101 ++
 arch/powerpc/platforms/powernv/opal.c              |  322 ++++++
 arch/powerpc/platforms/powernv/pci-p5ioc2.c        |  234 ++++
 arch/powerpc/platforms/powernv/pci.c               |  427 ++++++++
 arch/powerpc/platforms/powernv/pci.h               |   48 +
 arch/powerpc/platforms/powernv/powernv.h           |   16 +
 arch/powerpc/platforms/powernv/setup.c             |  196 ++++
 arch/powerpc/platforms/powernv/smp.c               |  182 ++++
 arch/powerpc/platforms/ps3/Kconfig                 |   12 +
 arch/powerpc/platforms/ps3/Makefile                |    1 +
 arch/powerpc/platforms/ps3/gelic_udbg.c            |  273 +++++
 arch/powerpc/platforms/ps3/system-bus.c            |    7 +
 arch/powerpc/platforms/pseries/Kconfig             |    1 +
 arch/powerpc/platforms/pseries/dlpar.c             |    4 +
 arch/powerpc/platforms/pseries/eeh.c               |    2 +-
 arch/powerpc/platforms/pseries/iommu.c             |   34 +-
 arch/powerpc/platforms/pseries/nvram.c             |  171 +++-
 arch/powerpc/platforms/wsp/Kconfig                 |   11 +-
 arch/powerpc/platforms/wsp/Makefile                |    2 +
 arch/powerpc/platforms/wsp/ics.c                   |   48 +
 arch/powerpc/platforms/wsp/ics.h                   |    5 +
 arch/powerpc/platforms/wsp/msi.c                   |  102 ++
 arch/powerpc/platforms/wsp/msi.h                   |   19 +
 arch/powerpc/platforms/wsp/psr2.c                  |    4 +
 arch/powerpc/platforms/wsp/wsp.h                   |    3 +
 arch/powerpc/platforms/wsp/wsp_pci.c               | 1133 ++++++++++++++++++++
 arch/powerpc/platforms/wsp/wsp_pci.h               |  268 +++++
 arch/powerpc/sysdev/Makefile                       |    1 -
 arch/powerpc/sysdev/cpm_common.c                   |    3 +-
 arch/powerpc/sysdev/fsl_msi.c                      |   28 +-
 arch/powerpc/sysdev/fsl_msi.h                      |    3 +-
 arch/powerpc/sysdev/mpic.c                         |   34 +-
 arch/powerpc/sysdev/ppc4xx_pci.c                   |  101 ++-
 arch/powerpc/sysdev/ppc4xx_pci.h                   |   12 +
 arch/powerpc/sysdev/xics/Makefile                  |    1 +
 arch/powerpc/sysdev/xics/icp-native.c              |    2 +-
 arch/powerpc/sysdev/xics/ics-opal.c                |  244 +++++
 arch/powerpc/sysdev/xics/xics-common.c             |    8 +-
 arch/powerpc/xmon/xmon.c                           |    4 +-
 drivers/edac/cpc925_edac.c                         |   67 ++-
 drivers/edac/ppc4xx_edac.c                         |    2 +-
 drivers/gpio/Kconfig                               |    8 +
 drivers/gpio/Makefile                              |    1 +
 .../mpc8xxx_gpio.c => drivers/gpio/gpio-mpc8xxx.c  |    3 +
 drivers/net/ps3_gelic_net.c                        |    3 +
 drivers/net/ps3_gelic_net.h                        |    6 +
 drivers/of/fdt.c                                   |    7 +-
 drivers/tty/hvc/Kconfig                            |    9 +
 drivers/tty/hvc/Makefile                           |    1 +
 drivers/tty/hvc/hvc_opal.c                         |  424 ++++++++
 drivers/tty/hvc/hvcs.c                             |    6 +-
 drivers/tty/hvc/hvsi_lib.c                         |    4 +-
 drivers/tty/serial/8250.c                          |   23 -
 drivers/virt/fsl_hypervisor.c                      |    1 +
 include/linux/dma-mapping.h                        |    3 +
 include/linux/topology.h                           |    4 +
 kernel/sched.c                                     |    2 -
 189 files changed, 9411 insertions(+), 979 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/dcsr.txt
 delete mode 100644 arch/powerpc/boot/dts/hcu4.dts
 rename arch/powerpc/boot/dts/{p2040rdb.dts => p2041rdb.dts} (95%)
 rename arch/powerpc/boot/dts/{p2040si.dtsi => p2041si.dtsi} (80%)
 create mode 100644 arch/powerpc/boot/dts/p3060qds.dts
 create mode 100644 arch/powerpc/boot/dts/p3060si.dtsi
 delete mode 100644 arch/powerpc/configs/40x/hcu4_defconfig
 create mode 100644 arch/powerpc/include/asm/opal.h
 create mode 100644 arch/powerpc/mm/hugetlbpage-book3e.c
 delete mode 100644 arch/powerpc/platforms/40x/hcu4.c
 rename arch/powerpc/platforms/85xx/{p2040_rdb.c => p2041_rdb.c} (82%)
 create mode 100644 arch/powerpc/platforms/85xx/p3060_qds.c
 create mode 100644 arch/powerpc/platforms/powernv/Kconfig
 create mode 100644 arch/powerpc/platforms/powernv/Makefile
 create mode 100644 arch/powerpc/platforms/powernv/opal-nvram.c
 create mode 100644 arch/powerpc/platforms/powernv/opal-rtc.c
 create mode 100644 arch/powerpc/platforms/powernv/opal-takeover.S
 create mode 100644 arch/powerpc/platforms/powernv/opal-wrappers.S
 create mode 100644 arch/powerpc/platforms/powernv/opal.c
 create mode 100644 arch/powerpc/platforms/powernv/pci-p5ioc2.c
 create mode 100644 arch/powerpc/platforms/powernv/pci.c
 create mode 100644 arch/powerpc/platforms/powernv/pci.h
 create mode 100644 arch/powerpc/platforms/powernv/powernv.h
 create mode 100644 arch/powerpc/platforms/powernv/setup.c
 create mode 100644 arch/powerpc/platforms/powernv/smp.c
 create mode 100644 arch/powerpc/platforms/ps3/gelic_udbg.c
 create mode 100644 arch/powerpc/platforms/wsp/msi.c
 create mode 100644 arch/powerpc/platforms/wsp/msi.h
 create mode 100644 arch/powerpc/platforms/wsp/wsp_pci.c
 create mode 100644 arch/powerpc/platforms/wsp/wsp_pci.h
 create mode 100644 arch/powerpc/sysdev/xics/ics-opal.c
 rename arch/powerpc/sysdev/mpc8xxx_gpio.c => drivers/gpio/gpio-mpc8xxx.c (98%)
 create mode 100644 drivers/tty/hvc/hvc_opal.c

^ permalink raw reply

* [PATCH] regulator: Use regmap_read/write(), regmap_update_bits functions directly
From: jhbird.choi @ 2011-11-06 23:16 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel; +Cc: Mark Brown, Liam Girdwood, Jonghwan Choi

From: Jonghwan Choi <jhbird.choi@samsung.com>

Current driver had the regmapcalls within the bodies of the driver specific read/write fuctions.
This patch removes the original read/write functions and makes the call sites use regmap directly.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
 drivers/regulator/tps65023-regulator.c |   87 ++++++++++++--------------------
 1 files changed, 32 insertions(+), 55 deletions(-)

diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index 9fb4c7b..e0bcd75 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -152,48 +152,21 @@ struct tps_driver_data {
 	u8 core_regulator;
 };
 
-static int tps_65023_set_bits(struct tps_pmic *tps, u8 reg, u8 mask)
-{
-	return regmap_update_bits(tps->regmap, reg, mask, mask);
-}
-
-static int tps_65023_clear_bits(struct tps_pmic *tps, u8 reg, u8 mask)
-{
-	return regmap_update_bits(tps->regmap, reg, mask, 0);
-}
-
-static int tps_65023_reg_read(struct tps_pmic *tps, u8 reg)
-{
-	unsigned int val;
-	int ret;
-
-	ret = regmap_read(tps->regmap, reg, &val);
-
-	if (ret != 0)
-		return ret;
-	else
-		return val;
-}
-
-static int tps_65023_reg_write(struct tps_pmic *tps, u8 reg, u8 val)
-{
-	return regmap_write(tps->regmap, reg, val);
-}
-
 static int tps65023_dcdc_is_enabled(struct regulator_dev *dev)
 {
 	struct tps_pmic *tps = rdev_get_drvdata(dev);
 	int data, dcdc = rdev_get_id(dev);
+	int ret;
 	u8 shift;
 
 	if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
 		return -EINVAL;
 
 	shift = TPS65023_NUM_REGULATOR - dcdc;
-	data = tps_65023_reg_read(tps, TPS65023_REG_REG_CTRL);
+	ret = regmap_read(tps->regmap, TPS65023_REG_REG_CTRL, &data);
 
-	if (data < 0)
-		return data;
+	if (ret != 0)
+		return ret;
 	else
 		return (data & 1<<shift) ? 1 : 0;
 }
@@ -202,16 +175,17 @@ static int tps65023_ldo_is_enabled(struct regulator_dev *dev)
 {
 	struct tps_pmic *tps = rdev_get_drvdata(dev);
 	int data, ldo = rdev_get_id(dev);
+	int ret;
 	u8 shift;
 
 	if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
 		return -EINVAL;
 
 	shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
-	data = tps_65023_reg_read(tps, TPS65023_REG_REG_CTRL);
+	ret = regmap_read(tps->regmap, TPS65023_REG_REG_CTRL, &data);
 
-	if (data < 0)
-		return data;
+	if (ret != 0)
+		return ret;
 	else
 		return (data & 1<<shift) ? 1 : 0;
 }
@@ -226,7 +200,7 @@ static int tps65023_dcdc_enable(struct regulator_dev *dev)
 		return -EINVAL;
 
 	shift = TPS65023_NUM_REGULATOR - dcdc;
-	return tps_65023_set_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
+	return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 1 << shift);
 }
 
 static int tps65023_dcdc_disable(struct regulator_dev *dev)
@@ -239,7 +213,7 @@ static int tps65023_dcdc_disable(struct regulator_dev *dev)
 		return -EINVAL;
 
 	shift = TPS65023_NUM_REGULATOR - dcdc;
-	return tps_65023_clear_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
+	return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 0);
 }
 
 static int tps65023_ldo_enable(struct regulator_dev *dev)
@@ -252,7 +226,7 @@ static int tps65023_ldo_enable(struct regulator_dev *dev)
 		return -EINVAL;
 
 	shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
-	return tps_65023_set_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
+	return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 1 << shift);
 }
 
 static int tps65023_ldo_disable(struct regulator_dev *dev)
@@ -265,21 +239,22 @@ static int tps65023_ldo_disable(struct regulator_dev *dev)
 		return -EINVAL;
 
 	shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
-	return tps_65023_clear_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
+	return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 0);
 }
 
 static int tps65023_dcdc_get_voltage(struct regulator_dev *dev)
 {
 	struct tps_pmic *tps = rdev_get_drvdata(dev);
+	int ret;
 	int data, dcdc = rdev_get_id(dev);
 
 	if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
 		return -EINVAL;
 
 	if (dcdc == tps->core_regulator) {
-		data = tps_65023_reg_read(tps, TPS65023_REG_DEF_CORE);
-		if (data < 0)
-			return data;
+		ret = regmap_read(tps->regmap, TPS65023_REG_DEF_CORE, &data);
+		if (ret != 0)
+			return ret;
 		data &= (tps->info[dcdc]->table_len - 1);
 		return tps->info[dcdc]->table[data] * 1000;
 	} else
@@ -318,13 +293,13 @@ static int tps65023_dcdc_set_voltage(struct regulator_dev *dev,
 	if (vsel == tps->info[dcdc]->table_len)
 		goto failed;
 
-	ret = tps_65023_reg_write(tps, TPS65023_REG_DEF_CORE, vsel);
+	ret = regmap_write(tps->regmap, TPS65023_REG_DEF_CORE, vsel);
 
 	/* Tell the chip that we have changed the value in DEFCORE
 	 * and its time to update the core voltage
 	 */
-	tps_65023_set_bits(tps, TPS65023_REG_CON_CTRL2,
-						TPS65023_REG_CTRL2_GO);
+	regmap_update_bits(tps->regmap, TPS65023_REG_CON_CTRL2,
+			TPS65023_REG_CTRL2_GO, TPS65023_REG_CTRL2_GO);
 
 	return ret;
 
@@ -336,13 +311,14 @@ static int tps65023_ldo_get_voltage(struct regulator_dev *dev)
 {
 	struct tps_pmic *tps = rdev_get_drvdata(dev);
 	int data, ldo = rdev_get_id(dev);
+	int ret;
 
 	if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
 		return -EINVAL;
 
-	data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL);
-	if (data < 0)
-		return data;
+	ret = regmap_read(tps->regmap, TPS65023_REG_LDO_CTRL, &data);
+	if (ret != 0)
+		return ret;
 
 	data >>= (TPS65023_LDO_CTRL_LDOx_SHIFT(ldo - TPS65023_LDO_1));
 	data &= (tps->info[ldo]->table_len - 1);
@@ -354,6 +330,7 @@ static int tps65023_ldo_set_voltage(struct regulator_dev *dev,
 {
 	struct tps_pmic *tps = rdev_get_drvdata(dev);
 	int data, vsel, ldo = rdev_get_id(dev);
+	int ret;
 
 	if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
 		return -EINVAL;
@@ -377,13 +354,13 @@ static int tps65023_ldo_set_voltage(struct regulator_dev *dev,
 
 	*selector = vsel;
 
-	data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL);
-	if (data < 0)
-		return data;
+	ret = regmap_read(tps->regmap, TPS65023_REG_LDO_CTRL, &data);
+	if (ret != 0)
+		return ret;
 
 	data &= TPS65023_LDO_CTRL_LDOx_MASK(ldo - TPS65023_LDO_1);
 	data |= (vsel << (TPS65023_LDO_CTRL_LDOx_SHIFT(ldo - TPS65023_LDO_1)));
-	return tps_65023_reg_write(tps, TPS65023_REG_LDO_CTRL, data);
+	return regmap_write(tps->regmap, TPS65023_REG_LDO_CTRL, data);
 }
 
 static int tps65023_dcdc_list_voltage(struct regulator_dev *dev,
@@ -511,12 +488,12 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, tps);
 
 	/* Enable setting output voltage by I2C */
-	tps_65023_clear_bits(tps, TPS65023_REG_CON_CTRL2,
-						TPS65023_REG_CTRL2_CORE_ADJ);
+	regmap_update_bits(tps->regmap, TPS65023_REG_CON_CTRL2,
+			TPS65023_REG_CTRL2_CORE_ADJ, TPS65023_REG_CTRL2_CORE_ADJ);
 
 	/* Enable setting output voltage by I2C */
-	tps_65023_clear_bits(tps, TPS65023_REG_CON_CTRL2,
-						TPS65023_REG_CTRL2_CORE_ADJ);
+	regmap_update_bits(tps->regmap, TPS65023_REG_CON_CTRL2,
+			TPS65023_REG_CTRL2_CORE_ADJ, TPS65023_REG_CTRL2_CORE_ADJ);
 
 	return 0;
 
-- 
1.7.1


^ permalink raw reply related

* [PATCH 1/1] useradd.bbclass: fix how RDEPENDS is setup
From: Scott Garman @ 2011-11-06 23:27 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1320621944.git.scott.a.garman@intel.com>

Fix bug where only packages named PN included base-passwd in
RDEPENDS.

This fixes [YOCTO #1727]

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/classes/useradd.bbclass |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index fb70b3e..18e062f 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -4,7 +4,6 @@ USERADDPN ?= "${PN}"
 # target sysroot, and shadow -native and -sysroot provide the utilities
 # and support files needed to add and modify user and group accounts
 DEPENDS_append = " base-passwd shadow-native shadow-sysroot"
-RDEPENDS_${USERADDPN}_append = " base-passwd shadow"
 
 # This preinstall function will be run in two contexts: once for the
 # native sysroot (as invoked by the useradd_sysroot() wrapper), and
@@ -147,6 +146,13 @@ fakeroot python populate_packages_prepend () {
 		preinst += d.getVar('useradd_preinst', True)
 		bb.data.setVar('pkg_preinst_%s' % pkg, preinst, d)
 
+		# RDEPENDS setup
+		rdepends = d.getVar("RDEPENDS_%s" % pkg, True)
+		if not rdepends:
+			rdepends = ""
+		rdepends += " base-passwd shadow"
+		bb.data.setVar("RDEPENDS_%s" % pkg, rdepends, d)
+		
 	# We add the user/group calls to all packages to allow any package
 	# to contain files owned by the users/groups defined in the recipe.
 	# The user/group addition code is careful not to create duplicate
-- 
1.7.5.4




^ permalink raw reply related


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.