Skip to content

Commit 142ba31

Browse files
zijun-hugregkh
authored andcommitted
PM: wakeup: Do not expose 4 device wakeup source APIs
The following 4 APIs are only used by drivers/base/power/wakeup.c internally. - wakeup_source_create() - wakeup_source_destroy() - wakeup_source_add() - wakeup_source_remove() Do not expose them by making them as static functions. Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20250420-fix_power-v2-1-9b938d2283aa@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 93b27a8 commit 142ba31

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

drivers/base/power/wakeup.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static DEFINE_IDA(wakeup_ida);
7777
* wakeup_source_create - Create a struct wakeup_source object.
7878
* @name: Name of the new wakeup source.
7979
*/
80-
struct wakeup_source *wakeup_source_create(const char *name)
80+
static struct wakeup_source *wakeup_source_create(const char *name)
8181
{
8282
struct wakeup_source *ws;
8383
const char *ws_name;
@@ -106,7 +106,6 @@ struct wakeup_source *wakeup_source_create(const char *name)
106106
err_ws:
107107
return NULL;
108108
}
109-
EXPORT_SYMBOL_GPL(wakeup_source_create);
110109

111110
/*
112111
* Record wakeup_source statistics being deleted into a dummy wakeup_source.
@@ -149,7 +148,7 @@ static void wakeup_source_free(struct wakeup_source *ws)
149148
*
150149
* Use only for wakeup source objects created with wakeup_source_create().
151150
*/
152-
void wakeup_source_destroy(struct wakeup_source *ws)
151+
static void wakeup_source_destroy(struct wakeup_source *ws)
153152
{
154153
if (!ws)
155154
return;
@@ -158,13 +157,12 @@ void wakeup_source_destroy(struct wakeup_source *ws)
158157
wakeup_source_record(ws);
159158
wakeup_source_free(ws);
160159
}
161-
EXPORT_SYMBOL_GPL(wakeup_source_destroy);
162160

163161
/**
164162
* wakeup_source_add - Add given object to the list of wakeup sources.
165163
* @ws: Wakeup source object to add to the list.
166164
*/
167-
void wakeup_source_add(struct wakeup_source *ws)
165+
static void wakeup_source_add(struct wakeup_source *ws)
168166
{
169167
unsigned long flags;
170168

@@ -179,13 +177,12 @@ void wakeup_source_add(struct wakeup_source *ws)
179177
list_add_rcu(&ws->entry, &wakeup_sources);
180178
raw_spin_unlock_irqrestore(&events_lock, flags);
181179
}
182-
EXPORT_SYMBOL_GPL(wakeup_source_add);
183180

184181
/**
185182
* wakeup_source_remove - Remove given object from the wakeup sources list.
186183
* @ws: Wakeup source object to remove from the list.
187184
*/
188-
void wakeup_source_remove(struct wakeup_source *ws)
185+
static void wakeup_source_remove(struct wakeup_source *ws)
189186
{
190187
unsigned long flags;
191188

@@ -204,7 +201,6 @@ void wakeup_source_remove(struct wakeup_source *ws)
204201
*/
205202
ws->timer.function = NULL;
206203
}
207-
EXPORT_SYMBOL_GPL(wakeup_source_remove);
208204

209205
/**
210206
* wakeup_source_register - Create wakeup source and add it to the list.

include/linux/pm_wakeup.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ static inline void device_set_wakeup_path(struct device *dev)
9595
}
9696

9797
/* drivers/base/power/wakeup.c */
98-
extern struct wakeup_source *wakeup_source_create(const char *name);
99-
extern void wakeup_source_destroy(struct wakeup_source *ws);
100-
extern void wakeup_source_add(struct wakeup_source *ws);
101-
extern void wakeup_source_remove(struct wakeup_source *ws);
10298
extern struct wakeup_source *wakeup_source_register(struct device *dev,
10399
const char *name);
104100
extern void wakeup_source_unregister(struct wakeup_source *ws);
@@ -129,17 +125,6 @@ static inline bool device_can_wakeup(struct device *dev)
129125
return dev->power.can_wakeup;
130126
}
131127

132-
static inline struct wakeup_source *wakeup_source_create(const char *name)
133-
{
134-
return NULL;
135-
}
136-
137-
static inline void wakeup_source_destroy(struct wakeup_source *ws) {}
138-
139-
static inline void wakeup_source_add(struct wakeup_source *ws) {}
140-
141-
static inline void wakeup_source_remove(struct wakeup_source *ws) {}
142-
143128
static inline struct wakeup_source *wakeup_source_register(struct device *dev,
144129
const char *name)
145130
{

0 commit comments

Comments
 (0)