lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jjCt-rDUVbHh1=Ngg_f_RZnNCUFGixLEe2ScRx1CtF2w@mail.gmail.com>
Date: Mon, 28 Apr 2025 15:38:52 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@...nel.org>, Len Brown <len.brown@...el.com>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Danilo Krummrich <dakr@...nel.org>, linux-pm@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v2] PM: wakeup: Do not expose 4 device wakeup source APIs

On Sun, Apr 20, 2025 at 6:19 AM Zijun Hu <zijun_hu@...oud.com> wrote:
>
> From: Zijun Hu <quic_zijuhu@...cinc.com>
>
> 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@...cinc.com>
> ---
> Changes in v2:
> - Remove 3 more APIs, correct tile and commit message.
> - Link to v1: https://lore.kernel.org/r/20250420-fix_power-v1-1-1454cf1dc534@quicinc.com
> ---
>  drivers/base/power/wakeup.c | 12 ++++--------
>  include/linux/pm_wakeup.h   | 15 ---------------
>  2 files changed, 4 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> index 63bf914a4d4467dcf6c42e50951b91677fb9c46d..27505dea7c1b454e7f124637af1834f558e0d022 100644
> --- a/drivers/base/power/wakeup.c
> +++ b/drivers/base/power/wakeup.c
> @@ -77,7 +77,7 @@ static DEFINE_IDA(wakeup_ida);
>   * wakeup_source_create - Create a struct wakeup_source object.
>   * @name: Name of the new wakeup source.
>   */
> -struct wakeup_source *wakeup_source_create(const char *name)
> +static struct wakeup_source *wakeup_source_create(const char *name)
>  {
>         struct wakeup_source *ws;
>         const char *ws_name;
> @@ -106,7 +106,6 @@ struct wakeup_source *wakeup_source_create(const char *name)
>  err_ws:
>         return NULL;
>  }
> -EXPORT_SYMBOL_GPL(wakeup_source_create);
>
>  /*
>   * Record wakeup_source statistics being deleted into a dummy wakeup_source.
> @@ -149,7 +148,7 @@ static void wakeup_source_free(struct wakeup_source *ws)
>   *
>   * Use only for wakeup source objects created with wakeup_source_create().
>   */
> -void wakeup_source_destroy(struct wakeup_source *ws)
> +static void wakeup_source_destroy(struct wakeup_source *ws)
>  {
>         if (!ws)
>                 return;
> @@ -158,13 +157,12 @@ void wakeup_source_destroy(struct wakeup_source *ws)
>         wakeup_source_record(ws);
>         wakeup_source_free(ws);
>  }
> -EXPORT_SYMBOL_GPL(wakeup_source_destroy);
>
>  /**
>   * wakeup_source_add - Add given object to the list of wakeup sources.
>   * @ws: Wakeup source object to add to the list.
>   */
> -void wakeup_source_add(struct wakeup_source *ws)
> +static void wakeup_source_add(struct wakeup_source *ws)
>  {
>         unsigned long flags;
>
> @@ -179,13 +177,12 @@ void wakeup_source_add(struct wakeup_source *ws)
>         list_add_rcu(&ws->entry, &wakeup_sources);
>         raw_spin_unlock_irqrestore(&events_lock, flags);
>  }
> -EXPORT_SYMBOL_GPL(wakeup_source_add);
>
>  /**
>   * wakeup_source_remove - Remove given object from the wakeup sources list.
>   * @ws: Wakeup source object to remove from the list.
>   */
> -void wakeup_source_remove(struct wakeup_source *ws)
> +static void wakeup_source_remove(struct wakeup_source *ws)
>  {
>         unsigned long flags;
>
> @@ -204,7 +201,6 @@ void wakeup_source_remove(struct wakeup_source *ws)
>          */
>         ws->timer.function = NULL;
>  }
> -EXPORT_SYMBOL_GPL(wakeup_source_remove);
>
>  /**
>   * wakeup_source_register - Create wakeup source and add it to the list.
> diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
> index 51e0e8dd5f9e50d928db6efa2e3232a117d7e012..c838b4a30f876ef5a66972d16f461cfba9ff2814 100644
> --- a/include/linux/pm_wakeup.h
> +++ b/include/linux/pm_wakeup.h
> @@ -95,10 +95,6 @@ static inline void device_set_wakeup_path(struct device *dev)
>  }
>
>  /* drivers/base/power/wakeup.c */
> -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);
> -extern void wakeup_source_remove(struct wakeup_source *ws);
>  extern struct wakeup_source *wakeup_source_register(struct device *dev,
>                                                     const char *name);
>  extern void wakeup_source_unregister(struct wakeup_source *ws);
> @@ -129,17 +125,6 @@ static inline bool device_can_wakeup(struct device *dev)
>         return dev->power.can_wakeup;
>  }
>
> -static inline struct wakeup_source *wakeup_source_create(const char *name)
> -{
> -       return NULL;
> -}
> -
> -static inline void wakeup_source_destroy(struct wakeup_source *ws) {}
> -
> -static inline void wakeup_source_add(struct wakeup_source *ws) {}
> -
> -static inline void wakeup_source_remove(struct wakeup_source *ws) {}
> -
>  static inline struct wakeup_source *wakeup_source_register(struct device *dev,
>                                                            const char *name)
>  {
>
> ---

Applied as 6.16 material with some edits in the subject and changelog, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ