[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <C6D98BD8-F57F-411F-A2F2-D9E531137002@holtmann.org>
Date: Thu, 19 Sep 2019 09:32:33 +0200
From: Marcel Holtmann <marcel@...tmann.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Johan Hedberg <johan.hedberg@...il.com>,
Alex Lu <alex_lu@...lsil.com.cn>,
Matthias Kaehlcke <mka@...omium.org>,
Rajat Jain <rajatja@...gle.com>,
Raghuram Hegde <raghuram.hegde@...el.com>,
linux-bluetooth@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Bluetooth: btusb: avoid unused function warning
Hi Arnd,
> The btusb_rtl_cmd_timeout() function is used inside of an
> ifdef, leading to a warning when this part is hidden
> from the compiler:
>
> drivers/bluetooth/btusb.c:530:13: error: unused function 'btusb_rtl_cmd_timeout' [-Werror,-Wunused-function]
>
> Use an IS_ENABLED() check instead so the compiler can see
> the code and then discard it silently.
>
> Fixes: d7ef0d1e3968 ("Bluetooth: btusb: Use cmd_timeout to reset Realtek device")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/bluetooth/btusb.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index a9c35ebb30f8..23e606aaaea4 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3807,8 +3807,8 @@ static int btusb_probe(struct usb_interface *intf,
> btusb_check_needs_reset_resume(intf);
> }
>
> -#ifdef CONFIG_BT_HCIBTUSB_RTL
> - if (id->driver_info & BTUSB_REALTEK) {
> + if (IS_ENABLED(CONFIG_BT_HCIBTUSB_RTL) &&
> + (id->driver_info & BTUSB_REALTEK)) {
> hdev->setup = btrtl_setup_realtek;
> hdev->shutdown = btrtl_shutdown_realtek;
> hdev->cmd_timeout = btusb_rtl_cmd_timeout;
> @@ -3819,7 +3819,6 @@ static int btusb_probe(struct usb_interface *intf,
> */
> set_bit(BTUSB_WAKEUP_DISABLE, &data->flags);
> }
> -#endif
I prefer that we stick another ifdef around the btusb_rtl_cmd_timeout function since that is how we did it for the other vendors as well.
However I start to wonder if we need all these vendor ifdef anyway. The vendor specific functions should turn into empty stubs if their support is not selected.
Regards
Marcel
Powered by blists - more mailing lists