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

this will be reverted by caf in some newer updates
see: https://source.codeaurora.org/quic/la/kernel/msm-4.19/commit/include/linux/pm_wakeup.h?h=LA.UM.9.15.r1-02100-KAMORTA.0&id=45417b13166cf29949e9da42a79708284cfab465

Signed-off-by: klozz <klozz@TheXPerienceProject.org>
Signed-off-by: sohamxda7 <sensoham135@gmail.com>
Change-Id: Ieadf20144716193acf2815f08d919cd92aa878c0
Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
This commit is contained in:
klozz 2021-01-05 09:52:06 +01:00 committed by Gagan Malvi
parent 1486a406cb
commit 89a41e23f9
No known key found for this signature in database
GPG key ID: B932A7CE71E9198F
3 changed files with 55 additions and 2 deletions

View file

@ -80,6 +80,23 @@ static struct wakeup_source deleted_ws = {
static DEFINE_IDA(wakeup_ida);
/**
* 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.
@ -115,6 +132,22 @@ struct wakeup_source *wakeup_source_create(const char *name)
}
EXPORT_SYMBOL_GPL(wakeup_source_create);
/**
* wakeup_source_drop - Prepare a struct wakeup_source object for destruction.
* @ws: Wakeup source to prepare for destruction.
*
* Callers must ensure that __pm_stay_awake() or __pm_wakeup_event() will never
* be run in parallel with this function for the same wakeup source object.
*/
void wakeup_source_drop(struct wakeup_source *ws)
{
if (!ws)
return;
__pm_relax(ws);
}
EXPORT_SYMBOL_GPL(wakeup_source_drop);
/*
* Record wakeup_source statistics being deleted into a dummy wakeup_source.
*/
@ -161,7 +194,8 @@ void wakeup_source_destroy(struct wakeup_source *ws)
if (!ws)
return;
__pm_relax(ws);
//__pm_relax(ws);
wakeup_source_drop(ws);
wakeup_source_record(ws);
wakeup_source_free(ws);
}

View file

@ -752,7 +752,7 @@ static int fpc1020_probe(struct platform_device *pdev)
#else
mutex_init(&fpc1020->lock);
fpc1020->ttw_wl = wakeup_source_register("fpc_ttw_wl");
fpc1020->ttw_wl = wakeup_source_register(dev, "fpc_ttw_wl");
if (!fpc1020->ttw_wl)
return -ENOMEM;

View file

@ -100,7 +100,9 @@ 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_drop(struct wakeup_source *ws);
extern void wakeup_source_destroy(struct wakeup_source *ws);
extern void wakeup_source_add(struct wakeup_source *ws);
extern void wakeup_source_remove(struct wakeup_source *ws);
@ -131,10 +133,14 @@ 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;
}
static inline void wakeup_source_drop(struct wakeup_source *ws) {}
static inline void wakeup_source_destroy(struct wakeup_source *ws) {}
@ -198,6 +204,19 @@ static inline void pm_wakeup_dev_event(struct device *dev, unsigned int msec,
#endif /* !CONFIG_PM_SLEEP */
static inline void wakeup_source_trash(struct wakeup_source *ws)
{
wakeup_source_remove(ws);
wakeup_source_drop(ws);
}
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);