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

Commit 8f35ee2a authored by Tri Vo's avatar Tri Vo Committed by Tri Vo
Browse files

UPSTREAM: PM / wakeup: Drop wakeup_source_init(), wakeup_source_prepare()



wakeup_source_init() has no users. Remove it.

As a result, wakeup_source_prepare() is only called from
wakeup_source_create(). Merge wakeup_source_prepare() into
wakeup_source_create() and remove it.

Change wakeup_source_create() behavior so that assigning NULL to wakeup
source's name throws an error.

Signed-off-by: default avatarTri Vo <trong@android.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 0d105d0f25386ee5b74603db6d249ebed7590cbc)
Bug: 129087298
Signed-off-by: default avatarTri Vo <trong@google.com>
Change-Id: I939f8e2c40951720d0f33eda2be671f8ce06101c
parent 2d67117d
Loading
Loading
Loading
Loading
+13 −20
Original line number Diff line number Diff line
@@ -73,23 +73,6 @@ static struct wakeup_source deleted_ws = {
	.lock =  __SPIN_LOCK_UNLOCKED(deleted_ws.lock),
};

/**
 * wakeup_source_prepare - Prepare a new wakeup source for initialization.
 * @ws: Wakeup source to prepare.
 * @name: Pointer to the name of the new wakeup source.
 *
 * Callers must ensure that the @name string won't be freed when @ws is still in
 * use.
 */
void wakeup_source_prepare(struct wakeup_source *ws, const char *name)
{
	if (ws) {
		memset(ws, 0, sizeof(*ws));
		ws->name = name;
	}
}
EXPORT_SYMBOL_GPL(wakeup_source_prepare);

/**
 * wakeup_source_create - Create a struct wakeup_source object.
 * @name: Name of the new wakeup source.
@@ -97,13 +80,23 @@ EXPORT_SYMBOL_GPL(wakeup_source_prepare);
struct wakeup_source *wakeup_source_create(const char *name)
{
	struct wakeup_source *ws;
	const char *ws_name;

	ws = kmalloc(sizeof(*ws), GFP_KERNEL);
	ws = kzalloc(sizeof(*ws), GFP_KERNEL);
	if (!ws)
		return NULL;
		goto err_ws;

	ws_name = kstrdup_const(name, GFP_KERNEL);
	if (!ws_name)
		goto err_name;
	ws->name = ws_name;

	wakeup_source_prepare(ws, name ? kstrdup_const(name, GFP_KERNEL) : NULL);
	return ws;

err_name:
	kfree(ws);
err_ws:
	return NULL;
}
EXPORT_SYMBOL_GPL(wakeup_source_create);

+0 −11
Original line number Diff line number Diff line
@@ -94,7 +94,6 @@ static inline void device_set_wakeup_path(struct device *dev)
}

/* drivers/base/power/wakeup.c */
extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name);
extern struct wakeup_source *wakeup_source_create(const char *name);
extern void wakeup_source_destroy(struct wakeup_source *ws);
extern void wakeup_source_add(struct wakeup_source *ws);
@@ -125,9 +124,6 @@ static inline bool device_can_wakeup(struct device *dev)
	return dev->power.can_wakeup;
}

static inline void wakeup_source_prepare(struct wakeup_source *ws,
					 const char *name) {}

static inline struct wakeup_source *wakeup_source_create(const char *name)
{
	return NULL;
@@ -194,13 +190,6 @@ static inline void pm_wakeup_dev_event(struct device *dev, unsigned int msec,

#endif /* !CONFIG_PM_SLEEP */

static inline void wakeup_source_init(struct wakeup_source *ws,
				      const char *name)
{
	wakeup_source_prepare(ws, name);
	wakeup_source_add(ws);
}

static inline void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec)
{
	return pm_wakeup_ws_event(ws, msec, false);