Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3053761ybn; Thu, 26 Sep 2019 23:51:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJLaivBNLzFgIGFJTSHQ9BnvdRvnkayFuPIYIFyC/LxyOrKmkzcUS961LCd/OxQHZdF2n/ X-Received: by 2002:a50:eb93:: with SMTP id y19mr2796824edr.94.1569567101261; Thu, 26 Sep 2019 23:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569567101; cv=none; d=google.com; s=arc-20160816; b=A+7udhQxBs2p3BDGBmb9Yx4qLfa75fSV+qEq2kYURRZlt7Zi1tE3kPUgyG/1d7XgJB lb5vRdu+ZQlnr/IjgwFaupFZ5PvTmVa4RfobPIhmTTDQA6oCwDdBoh9I80dsanYlH1gi 7h1yvKxxPCzswsjTHksVU7mU/YHZ+enfAAUdXrwI3bMpxFsRzcl9YE1ik3TLbLUH5d9q ncvrypC9zFzEkw373mZH6/LmqPZfJZqdRVo9ewpOGG4lvGKRfGejFTt1Yr6dFUSCJjeB ZW4CTOUnrNevQk3L0CEgi5wpwpareNQX9vkYUYu8uVLTWz3OymOHxlfrLTXirFDQ9At1 ekBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=rQxCGxJ6UmVFOMRzZCHZlgrHp7DEoKbkxzwqyn0FM3c=; b=CVp9YwvTTjCxXkRcq+lFnPou5YMQWOaCn6TCGpEtFpeoc2QXX8SCPk4L4z98Tja2FL iQ4fxvrRyQl/fZbAjRdI54h3EoCdKumUrChDMUy4pY9gDIpzidpI8cO2MOcGXZpb7Mqv MXM18Mx4V5pZIdYaqDMgnvSI4jOxnJIlwEUEv89lCfFuVnSzl+kQgFGl8VAOp+Pk0UNi YECjLs9ItSzCDt8JJ0JBXGgN1uFOoX/zc1SO0Oa8LMlzOL1MU1bhwJ7Mxr6X439FxwdL gxBxFktqe5q4UuwpxkCMhaXdVOAYQpWiEx4YsvMbosZ106cy+sft07nxqQ7cWnKERmNa 1qvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si902118edr.446.2019.09.26.23.51.14; Thu, 26 Sep 2019 23:51:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726217AbfI0GtE (ORCPT + 99 others); Fri, 27 Sep 2019 02:49:04 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:42779 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbfI0GtE (ORCPT ); Fri, 27 Sep 2019 02:49:04 -0400 Received: from localhost.localdomain (p4FEFC197.dip0.t-ipconnect.de [79.239.193.151]) by mail.holtmann.org (Postfix) with ESMTPSA id ABDEECECE9 for ; Fri, 27 Sep 2019 08:57:56 +0200 (CEST) From: Marcel Holtmann To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: btusb: Use IS_ENABLED instead of #ifdef Date: Fri, 27 Sep 2019 08:48:58 +0200 Message-Id: <20190927064858.121461-1-marcel@holtmann.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org For the different hardware support options, it is better to use IS_ENABLED check. Let the compiler do the needed optimizations. Signed-off-by: Marcel Holtmann --- drivers/bluetooth/btusb.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 0f1b99ff5aec..5d7bc3410104 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2496,8 +2496,6 @@ static int btusb_shutdown_intel_new(struct hci_dev *hdev) return 0; } -#ifdef CONFIG_BT_HCIBTUSB_MTK - #define FIRMWARE_MT7663 "mediatek/mt7663pr2h.bin" #define FIRMWARE_MT7668 "mediatek/mt7668pr2h.bin" @@ -3058,7 +3056,6 @@ static int btusb_mtk_shutdown(struct hci_dev *hdev) MODULE_FIRMWARE(FIRMWARE_MT7663); MODULE_FIRMWARE(FIRMWARE_MT7668); -#endif #ifdef CONFIG_PM /* Configure an out-of-band gpio as wake-up pin, if specified in device tree */ @@ -3418,7 +3415,6 @@ static int btusb_setup_qca(struct hci_dev *hdev) return 0; } -#ifdef CONFIG_BT_HCIBTUSB_BCM static inline int __set_diag_interface(struct hci_dev *hdev) { struct btusb_data *data = hci_get_drvdata(hdev); @@ -3505,7 +3501,6 @@ static int btusb_bcm_set_diag(struct hci_dev *hdev, bool enable) return submit_or_queue_tx_urb(hdev, urb); } -#endif #ifdef CONFIG_PM static irqreturn_t btusb_oob_wake_handler(int irq, void *priv) @@ -3731,8 +3726,8 @@ static int btusb_probe(struct usb_interface *intf, if (id->driver_info & BTUSB_BCM92035) hdev->setup = btusb_setup_bcm92035; -#ifdef CONFIG_BT_HCIBTUSB_BCM - if (id->driver_info & BTUSB_BCM_PATCHRAM) { + if (IS_ENABLED(CONFIG_BT_HCIBTUSB_BCM) && + (id->driver_info & BTUSB_BCM_PATCHRAM)) { hdev->manufacturer = 15; hdev->setup = btbcm_setup_patchram; hdev->set_diag = btusb_bcm_set_diag; @@ -3742,7 +3737,8 @@ static int btusb_probe(struct usb_interface *intf, data->diag = usb_ifnum_to_if(data->udev, ifnum_base + 2); } - if (id->driver_info & BTUSB_BCM_APPLE) { + if (IS_ENABLED(CONFIG_BT_HCIBTUSB_BCM) && + (id->driver_info & BTUSB_BCM_APPLE)) { hdev->manufacturer = 15; hdev->setup = btbcm_setup_apple; hdev->set_diag = btusb_bcm_set_diag; @@ -3750,7 +3746,6 @@ static int btusb_probe(struct usb_interface *intf, /* Broadcom LM_DIAG Interface numbers are hardcoded */ data->diag = usb_ifnum_to_if(data->udev, ifnum_base + 2); } -#endif if (id->driver_info & BTUSB_INTEL) { hdev->manufacturer = 2; @@ -3781,14 +3776,13 @@ static int btusb_probe(struct usb_interface *intf, if (id->driver_info & BTUSB_MARVELL) hdev->set_bdaddr = btusb_set_bdaddr_marvell; -#ifdef CONFIG_BT_HCIBTUSB_MTK - if (id->driver_info & BTUSB_MEDIATEK) { + if (IS_ENABLED(CONFIG_BT_HCIBTUSB_MTK) && + (id->driver_info & BTUSB_MEDIATEK)) { hdev->setup = btusb_mtk_setup; hdev->shutdown = btusb_mtk_shutdown; hdev->manufacturer = 70; set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks); } -#endif if (id->driver_info & BTUSB_SWAVE) { set_bit(HCI_QUIRK_FIXUP_INQUIRY_MODE, &hdev->quirks); @@ -3893,15 +3887,13 @@ static int btusb_probe(struct usb_interface *intf, goto out_free_dev; } -#ifdef CONFIG_BT_HCIBTUSB_BCM - if (data->diag) { + if (IS_ENABLED(CONFIG_BT_HCIBTUSB_BCM) && data->diag) { if (!usb_driver_claim_interface(&btusb_driver, data->diag, data)) __set_diag_interface(hdev); else data->diag = NULL; } -#endif if (enable_autosuspend) usb_enable_autosuspend(data->udev); -- 2.20.1