Re: [PATCH] USB: core: Correct API usb_(enable|disable)_autosuspend() prototypes

From: Alan Stern
Date: Tue Apr 08 2025 - 13:01:29 EST


On Tue, Apr 08, 2025 at 08:08:51PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>
> API usb_(enable|disable)_autosuspend() have inconsistent prototypes
> regarding if CONFIG_PM is defined.
>
> Correct prototypes when the macro is undefined by referring to those
> when the macro is defined.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
> ---

Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

> include/linux/usb.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/usb.h b/include/linux/usb.h
> index b46738701f8dc46085f251379873b6a8a008d99d..1b2545b4363bcf3ef97a53a004ebf456eb9d5d05 100644
> --- a/include/linux/usb.h
> +++ b/include/linux/usb.h
> @@ -815,10 +815,10 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
>
> #else
>
> -static inline int usb_enable_autosuspend(struct usb_device *udev)
> -{ return 0; }
> -static inline int usb_disable_autosuspend(struct usb_device *udev)
> -{ return 0; }
> +static inline void usb_enable_autosuspend(struct usb_device *udev)
> +{ }
> +static inline void usb_disable_autosuspend(struct usb_device *udev)
> +{ }
>
> static inline int usb_autopm_get_interface(struct usb_interface *intf)
> { return 0; }
>
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250408-fix_usb_hdr-8305358f42e1
>
> Best regards,
> --
> Zijun Hu <quic_zijuhu@xxxxxxxxxxx>