Commit 8e703009 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'pm-epoll', 'pnp' and 'powercap'

* pm-epoll:
  epoll: drop EPOLLWAKEUP if PM_SLEEP is disabled

* pnp:
  PNP: fix restoring devices after hibernation

* powercap:
  PowerCap: Fix mode for energy counter
...@@ -197,6 +197,11 @@ static int pnp_bus_freeze(struct device *dev) ...@@ -197,6 +197,11 @@ static int pnp_bus_freeze(struct device *dev)
return __pnp_bus_suspend(dev, PMSG_FREEZE); return __pnp_bus_suspend(dev, PMSG_FREEZE);
} }
static int pnp_bus_poweroff(struct device *dev)
{
return __pnp_bus_suspend(dev, PMSG_HIBERNATE);
}
static int pnp_bus_resume(struct device *dev) static int pnp_bus_resume(struct device *dev)
{ {
struct pnp_dev *pnp_dev = to_pnp_dev(dev); struct pnp_dev *pnp_dev = to_pnp_dev(dev);
...@@ -234,9 +239,14 @@ static int pnp_bus_resume(struct device *dev) ...@@ -234,9 +239,14 @@ static int pnp_bus_resume(struct device *dev)
} }
static const struct dev_pm_ops pnp_bus_dev_pm_ops = { static const struct dev_pm_ops pnp_bus_dev_pm_ops = {
/* Suspend callbacks */
.suspend = pnp_bus_suspend, .suspend = pnp_bus_suspend,
.freeze = pnp_bus_freeze,
.resume = pnp_bus_resume, .resume = pnp_bus_resume,
/* Hibernate callbacks */
.freeze = pnp_bus_freeze,
.thaw = pnp_bus_resume,
.poweroff = pnp_bus_poweroff,
.restore = pnp_bus_resume,
}; };
struct bus_type pnp_bus_type = { struct bus_type pnp_bus_type = {
......
...@@ -377,9 +377,14 @@ static void create_power_zone_common_attributes( ...@@ -377,9 +377,14 @@ static void create_power_zone_common_attributes(
if (power_zone->ops->get_max_energy_range_uj) if (power_zone->ops->get_max_energy_range_uj)
power_zone->zone_dev_attrs[count++] = power_zone->zone_dev_attrs[count++] =
&dev_attr_max_energy_range_uj.attr; &dev_attr_max_energy_range_uj.attr;
if (power_zone->ops->get_energy_uj) if (power_zone->ops->get_energy_uj) {
if (power_zone->ops->reset_energy_uj)
dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUGO;
else
dev_attr_energy_uj.attr.mode = S_IRUGO;
power_zone->zone_dev_attrs[count++] = power_zone->zone_dev_attrs[count++] =
&dev_attr_energy_uj.attr; &dev_attr_energy_uj.attr;
}
if (power_zone->ops->get_power_uw) if (power_zone->ops->get_power_uw)
power_zone->zone_dev_attrs[count++] = power_zone->zone_dev_attrs[count++] =
&dev_attr_power_uw.attr; &dev_attr_power_uw.attr;
......
...@@ -1852,8 +1852,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, ...@@ -1852,8 +1852,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
goto error_tgt_fput; goto error_tgt_fput;
/* Check if EPOLLWAKEUP is allowed */ /* Check if EPOLLWAKEUP is allowed */
if ((epds.events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) ep_take_care_of_epollwakeup(&epds);
epds.events &= ~EPOLLWAKEUP;
/* /*
* We have to check that the file structure underneath the file descriptor * We have to check that the file structure underneath the file descriptor
......
...@@ -61,5 +61,16 @@ struct epoll_event { ...@@ -61,5 +61,16 @@ struct epoll_event {
__u64 data; __u64 data;
} EPOLL_PACKED; } EPOLL_PACKED;
#ifdef CONFIG_PM_SLEEP
static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
{
if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
epev->events &= ~EPOLLWAKEUP;
}
#else
static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
{
epev->events &= ~EPOLLWAKEUP;
}
#endif
#endif /* _UAPI_LINUX_EVENTPOLL_H */ #endif /* _UAPI_LINUX_EVENTPOLL_H */
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