Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -197,6 +197,11 @@ static int pnp_bus_freeze(struct device *dev)
	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)
{
	struct pnp_dev *pnp_dev = to_pnp_dev(dev);
@@ -234,9 +239,14 @@ static int pnp_bus_resume(struct device *dev)
}

static const struct dev_pm_ops pnp_bus_dev_pm_ops = {
	/* Suspend callbacks */
	.suspend = pnp_bus_suspend,
	.freeze = pnp_bus_freeze,
	.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 = {
+6 −1
Original line number Diff line number Diff line
@@ -377,9 +377,14 @@ static void create_power_zone_common_attributes(
	if (power_zone->ops->get_max_energy_range_uj)
		power_zone->zone_dev_attrs[count++] =
					&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++] =
					&dev_attr_energy_uj.attr;
	}
	if (power_zone->ops->get_power_uw)
		power_zone->zone_dev_attrs[count++] =
					&dev_attr_power_uw.attr;
+1 −2
Original line number Diff line number Diff line
@@ -1852,8 +1852,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
		goto error_tgt_fput;

	/* Check if EPOLLWAKEUP is allowed */
	if ((epds.events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
		epds.events &= ~EPOLLWAKEUP;
	ep_take_care_of_epollwakeup(&epds);

	/*
	 * We have to check that the file structure underneath the file descriptor
+12 −1
Original line number Diff line number Diff line
@@ -61,5 +61,16 @@ struct epoll_event {
	__u64 data;
} 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 */