Commit 5c395097 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm+acpi-4.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management and ACPI fixes from Rafael Wysocki:
 "These are fixes that didn't make it to the previous PM+ACPI pull
  request or are fixing issues introduced by it.

  Specifics:

   - Fix a recently added memory leak in an error path in the ACPI
     resources management code (Dan Carpenter)

   - Fix a build warning triggered by an ACPI video header function that
     should be static inline (Borislav Petkov)

   - Change names of helper function converting struct fwnode_handle
     pointers to either struct device_node or struct acpi_device
     pointers so they don't conflict with local variable names
     (Alexander Sverdlin)

   - Make the hibernate core re-enable nonboot CPUs on failures to
     disable them as expected (Vitaly Kuznetsov)

   - Increase the default timeout of the device suspend watchdog to
     prevent it from triggering too early on some systems (Takashi Iwai)

   - Prevent the cpuidle powernv driver from registering idle states
     with CPUIDLE_FLAG_TIMER_STOP set if CONFIG_TICK_ONESHOT is unset
     which leads to boot hangs (Preeti U Murthy)"

* tag 'pm+acpi-4.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  tick/idle/powerpc: Do not register idle states with CPUIDLE_FLAG_TIMER_STOP set in periodic mode
  PM / sleep: Increase default DPM watchdog timeout to 60
  PM / hibernate: re-enable nonboot cpus on disable_nonboot_cpus() failure
  ACPI / OF: Rename of_node() and acpi_node() to to_of_node() and to_acpi_node()
  ACPI / video: Inline acpi_video_set_dmi_backlight_type
  ACPI / resources: free memory on error in add_region_before()
parents 7adf12b8 132c242d
...@@ -660,8 +660,10 @@ static int add_region_before(u64 start, u64 end, u8 space_id, ...@@ -660,8 +660,10 @@ static int add_region_before(u64 start, u64 end, u8 space_id,
return -ENOMEM; return -ENOMEM;
error = request_range(start, end, space_id, flags, desc); error = request_range(start, end, space_id, flags, desc);
if (error) if (error) {
kfree(reg);
return error; return error;
}
reg->start = start; reg->start = start;
reg->end = end; reg->end = end;
......
...@@ -129,9 +129,9 @@ EXPORT_SYMBOL_GPL(device_property_present); ...@@ -129,9 +129,9 @@ EXPORT_SYMBOL_GPL(device_property_present);
bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname) bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
{ {
if (is_of_node(fwnode)) if (is_of_node(fwnode))
return of_property_read_bool(of_node(fwnode), propname); return of_property_read_bool(to_of_node(fwnode), propname);
else if (is_acpi_node(fwnode)) else if (is_acpi_node(fwnode))
return !acpi_dev_prop_get(acpi_node(fwnode), propname, NULL); return !acpi_dev_prop_get(to_acpi_node(fwnode), propname, NULL);
return !!pset_prop_get(to_pset(fwnode), propname); return !!pset_prop_get(to_pset(fwnode), propname);
} }
...@@ -286,10 +286,10 @@ EXPORT_SYMBOL_GPL(device_property_read_string); ...@@ -286,10 +286,10 @@ EXPORT_SYMBOL_GPL(device_property_read_string);
({ \ ({ \
int _ret_; \ int _ret_; \
if (is_of_node(_fwnode_)) \ if (is_of_node(_fwnode_)) \
_ret_ = OF_DEV_PROP_READ_ARRAY(of_node(_fwnode_), _propname_, \ _ret_ = OF_DEV_PROP_READ_ARRAY(to_of_node(_fwnode_), _propname_, \
_type_, _val_, _nval_); \ _type_, _val_, _nval_); \
else if (is_acpi_node(_fwnode_)) \ else if (is_acpi_node(_fwnode_)) \
_ret_ = acpi_dev_prop_read(acpi_node(_fwnode_), _propname_, \ _ret_ = acpi_dev_prop_read(to_acpi_node(_fwnode_), _propname_, \
_proptype_, _val_, _nval_); \ _proptype_, _val_, _nval_); \
else \ else \
_ret_ = pset_prop_read_array(to_pset(_fwnode_), _propname_, \ _ret_ = pset_prop_read_array(to_pset(_fwnode_), _propname_, \
...@@ -425,11 +425,11 @@ int fwnode_property_read_string_array(struct fwnode_handle *fwnode, ...@@ -425,11 +425,11 @@ int fwnode_property_read_string_array(struct fwnode_handle *fwnode,
{ {
if (is_of_node(fwnode)) if (is_of_node(fwnode))
return val ? return val ?
of_property_read_string_array(of_node(fwnode), propname, of_property_read_string_array(to_of_node(fwnode),
val, nval) : propname, val, nval) :
of_property_count_strings(of_node(fwnode), propname); of_property_count_strings(to_of_node(fwnode), propname);
else if (is_acpi_node(fwnode)) else if (is_acpi_node(fwnode))
return acpi_dev_prop_read(acpi_node(fwnode), propname, return acpi_dev_prop_read(to_acpi_node(fwnode), propname,
DEV_PROP_STRING, val, nval); DEV_PROP_STRING, val, nval);
return pset_prop_read_array(to_pset(fwnode), propname, return pset_prop_read_array(to_pset(fwnode), propname,
...@@ -456,9 +456,9 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode, ...@@ -456,9 +456,9 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode,
const char *propname, const char **val) const char *propname, const char **val)
{ {
if (is_of_node(fwnode)) if (is_of_node(fwnode))
return of_property_read_string(of_node(fwnode), propname, val); return of_property_read_string(to_of_node(fwnode), propname, val);
else if (is_acpi_node(fwnode)) else if (is_acpi_node(fwnode))
return acpi_dev_prop_read(acpi_node(fwnode), propname, return acpi_dev_prop_read(to_acpi_node(fwnode), propname,
DEV_PROP_STRING, val, 1); DEV_PROP_STRING, val, 1);
return -ENXIO; return -ENXIO;
...@@ -476,13 +476,13 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev, ...@@ -476,13 +476,13 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
if (IS_ENABLED(CONFIG_OF) && dev->of_node) { if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
struct device_node *node; struct device_node *node;
node = of_get_next_available_child(dev->of_node, of_node(child)); node = of_get_next_available_child(dev->of_node, to_of_node(child));
if (node) if (node)
return &node->fwnode; return &node->fwnode;
} else if (IS_ENABLED(CONFIG_ACPI)) { } else if (IS_ENABLED(CONFIG_ACPI)) {
struct acpi_device *node; struct acpi_device *node;
node = acpi_get_next_child(dev, acpi_node(child)); node = acpi_get_next_child(dev, to_acpi_node(child));
if (node) if (node)
return acpi_fwnode_handle(node); return acpi_fwnode_handle(node);
} }
...@@ -501,7 +501,7 @@ EXPORT_SYMBOL_GPL(device_get_next_child_node); ...@@ -501,7 +501,7 @@ EXPORT_SYMBOL_GPL(device_get_next_child_node);
void fwnode_handle_put(struct fwnode_handle *fwnode) void fwnode_handle_put(struct fwnode_handle *fwnode)
{ {
if (is_of_node(fwnode)) if (is_of_node(fwnode))
of_node_put(of_node(fwnode)); of_node_put(to_of_node(fwnode));
} }
EXPORT_SYMBOL_GPL(fwnode_handle_put); EXPORT_SYMBOL_GPL(fwnode_handle_put);
......
...@@ -67,6 +67,8 @@ static int nap_loop(struct cpuidle_device *dev, ...@@ -67,6 +67,8 @@ static int nap_loop(struct cpuidle_device *dev,
return index; return index;
} }
/* Register for fastsleep only in oneshot mode of broadcast */
#ifdef CONFIG_TICK_ONESHOT
static int fastsleep_loop(struct cpuidle_device *dev, static int fastsleep_loop(struct cpuidle_device *dev,
struct cpuidle_driver *drv, struct cpuidle_driver *drv,
int index) int index)
...@@ -90,7 +92,7 @@ static int fastsleep_loop(struct cpuidle_device *dev, ...@@ -90,7 +92,7 @@ static int fastsleep_loop(struct cpuidle_device *dev,
return index; return index;
} }
#endif
/* /*
* States for dedicated partition case. * States for dedicated partition case.
*/ */
...@@ -216,7 +218,14 @@ static int powernv_add_idle_states(void) ...@@ -216,7 +218,14 @@ static int powernv_add_idle_states(void)
powernv_states[nr_idle_states].flags = 0; powernv_states[nr_idle_states].flags = 0;
powernv_states[nr_idle_states].target_residency = 100; powernv_states[nr_idle_states].target_residency = 100;
powernv_states[nr_idle_states].enter = &nap_loop; powernv_states[nr_idle_states].enter = &nap_loop;
} else if (flags[i] & OPAL_PM_SLEEP_ENABLED || }
/*
* All cpuidle states with CPUIDLE_FLAG_TIMER_STOP set must come
* within this config dependency check.
*/
#ifdef CONFIG_TICK_ONESHOT
if (flags[i] & OPAL_PM_SLEEP_ENABLED ||
flags[i] & OPAL_PM_SLEEP_ENABLED_ER1) { flags[i] & OPAL_PM_SLEEP_ENABLED_ER1) {
/* Add FASTSLEEP state */ /* Add FASTSLEEP state */
strcpy(powernv_states[nr_idle_states].name, "FastSleep"); strcpy(powernv_states[nr_idle_states].name, "FastSleep");
...@@ -225,7 +234,7 @@ static int powernv_add_idle_states(void) ...@@ -225,7 +234,7 @@ static int powernv_add_idle_states(void)
powernv_states[nr_idle_states].target_residency = 300000; powernv_states[nr_idle_states].target_residency = 300000;
powernv_states[nr_idle_states].enter = &fastsleep_loop; powernv_states[nr_idle_states].enter = &fastsleep_loop;
} }
#endif
powernv_states[nr_idle_states].exit_latency = powernv_states[nr_idle_states].exit_latency =
((unsigned int)latency_ns[i]) / 1000; ((unsigned int)latency_ns[i]) / 1000;
......
...@@ -2052,14 +2052,14 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, ...@@ -2052,14 +2052,14 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
if (is_of_node(fwnode)) { if (is_of_node(fwnode)) {
enum of_gpio_flags flags; enum of_gpio_flags flags;
desc = of_get_named_gpiod_flags(of_node(fwnode), propname, 0, desc = of_get_named_gpiod_flags(to_of_node(fwnode), propname, 0,
&flags); &flags);
if (!IS_ERR(desc)) if (!IS_ERR(desc))
active_low = flags & OF_GPIO_ACTIVE_LOW; active_low = flags & OF_GPIO_ACTIVE_LOW;
} else if (is_acpi_node(fwnode)) { } else if (is_acpi_node(fwnode)) {
struct acpi_gpio_info info; struct acpi_gpio_info info;
desc = acpi_get_gpiod_by_index(acpi_node(fwnode), propname, 0, desc = acpi_get_gpiod_by_index(to_acpi_node(fwnode), propname, 0,
&info); &info);
if (!IS_ERR(desc)) if (!IS_ERR(desc))
active_low = info.active_low; active_low = info.active_low;
......
...@@ -191,7 +191,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) ...@@ -191,7 +191,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
goto err; goto err;
} }
np = of_node(child); np = to_of_node(child);
if (fwnode_property_present(child, "label")) { if (fwnode_property_present(child, "label")) {
fwnode_property_read_string(child, "label", &led.name); fwnode_property_read_string(child, "label", &led.name);
......
...@@ -420,7 +420,7 @@ static inline bool is_acpi_node(struct fwnode_handle *fwnode) ...@@ -420,7 +420,7 @@ static inline bool is_acpi_node(struct fwnode_handle *fwnode)
return fwnode && fwnode->type == FWNODE_ACPI; return fwnode && fwnode->type == FWNODE_ACPI;
} }
static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode) static inline struct acpi_device *to_acpi_node(struct fwnode_handle *fwnode)
{ {
return is_acpi_node(fwnode) ? return is_acpi_node(fwnode) ?
container_of(fwnode, struct acpi_device, fwnode) : NULL; container_of(fwnode, struct acpi_device, fwnode) : NULL;
......
...@@ -43,7 +43,7 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void) ...@@ -43,7 +43,7 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
{ {
return acpi_backlight_vendor; return acpi_backlight_vendor;
} }
static void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
{ {
} }
#endif #endif
......
...@@ -53,7 +53,7 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev) ...@@ -53,7 +53,7 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
return adev ? adev->handle : NULL; return adev ? adev->handle : NULL;
} }
#define ACPI_COMPANION(dev) acpi_node((dev)->fwnode) #define ACPI_COMPANION(dev) to_acpi_node((dev)->fwnode)
#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \ #define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
acpi_fwnode_handle(adev) : NULL) acpi_fwnode_handle(adev) : NULL)
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
...@@ -454,7 +454,7 @@ static inline bool is_acpi_node(struct fwnode_handle *fwnode) ...@@ -454,7 +454,7 @@ static inline bool is_acpi_node(struct fwnode_handle *fwnode)
return false; return false;
} }
static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode) static inline struct acpi_device *to_acpi_node(struct fwnode_handle *fwnode)
{ {
return NULL; return NULL;
} }
......
...@@ -128,7 +128,7 @@ static inline bool is_of_node(struct fwnode_handle *fwnode) ...@@ -128,7 +128,7 @@ static inline bool is_of_node(struct fwnode_handle *fwnode)
return fwnode && fwnode->type == FWNODE_OF; return fwnode && fwnode->type == FWNODE_OF;
} }
static inline struct device_node *of_node(struct fwnode_handle *fwnode) static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
{ {
return fwnode ? container_of(fwnode, struct device_node, fwnode) : NULL; return fwnode ? container_of(fwnode, struct device_node, fwnode) : NULL;
} }
...@@ -387,7 +387,7 @@ static inline bool is_of_node(struct fwnode_handle *fwnode) ...@@ -387,7 +387,7 @@ static inline bool is_of_node(struct fwnode_handle *fwnode)
return false; return false;
} }
static inline struct device_node *of_node(struct fwnode_handle *fwnode) static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
{ {
return NULL; return NULL;
} }
......
...@@ -187,7 +187,7 @@ config DPM_WATCHDOG ...@@ -187,7 +187,7 @@ config DPM_WATCHDOG
config DPM_WATCHDOG_TIMEOUT config DPM_WATCHDOG_TIMEOUT
int "Watchdog timeout in seconds" int "Watchdog timeout in seconds"
range 1 120 range 1 120
default 12 default 60
depends on DPM_WATCHDOG depends on DPM_WATCHDOG
config PM_TRACE config PM_TRACE
......
...@@ -552,7 +552,7 @@ int hibernation_platform_enter(void) ...@@ -552,7 +552,7 @@ int hibernation_platform_enter(void)
error = disable_nonboot_cpus(); error = disable_nonboot_cpus();
if (error) if (error)
goto Platform_finish; goto Enable_cpus;
local_irq_disable(); local_irq_disable();
syscore_suspend(); syscore_suspend();
...@@ -568,6 +568,8 @@ int hibernation_platform_enter(void) ...@@ -568,6 +568,8 @@ int hibernation_platform_enter(void)
Power_up: Power_up:
syscore_resume(); syscore_resume();
local_irq_enable(); local_irq_enable();
Enable_cpus:
enable_nonboot_cpus(); enable_nonboot_cpus();
Platform_finish: Platform_finish:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment