Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
pull request: bluetooth-next 2018-12-19

Here's the main bluetooth-next pull request for 4.21:

- Multiple fixes & improvements for Broadcom-based controllers
- New USB ID for an Intel controller
- Support for new Broadcom controller variants
- Use DEFINE_SHOW_ATTRIBUTE to simplify debugfs code
- Eliminate confusing "last event is not cmd complete" warning message
- Added vendor suspend/resume support for H:5 (3-Wire UART) controllers
- Various other smaller improvements & fixes

Please let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+280 -132
+9 -2
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
··· 10 10 Required properties: 11 11 12 12 - compatible: should contain one of the following: 13 + * "brcm,bcm20702a1" 14 + * "brcm,bcm4330-bt" 13 15 * "brcm,bcm43438-bt" 14 16 15 17 Optional properties: ··· 20 18 - shutdown-gpios: GPIO specifier, used to enable the BT module 21 19 - device-wakeup-gpios: GPIO specifier, used to wakeup the controller 22 20 - host-wakeup-gpios: GPIO specifier, used to wakeup the host processor 23 - - clocks: clock specifier if external clock provided to the controller 24 - - clock-names: should be "extclk" 21 + - clocks: 1 or 2 clocks as defined in clock-names below, in that order 22 + - clock-names: names for clock inputs, matching the clocks given 23 + - "extclk": deprecated, replaced by "txco" 24 + - "txco": external reference clock (not a standalone crystal) 25 + - "lpo": external low power 32.768 kHz clock 26 + - vbat-supply: phandle to regulator supply for VBAT 27 + - vddio-supply: phandle to regulator supply for VDDIO 25 28 26 29 27 30 Example:
+13 -1
drivers/bluetooth/btbcm.c
··· 33 33 #define VERSION "0.1" 34 34 35 35 #define BDADDR_BCM20702A0 (&(bdaddr_t) {{0x00, 0xa0, 0x02, 0x70, 0x20, 0x00}}) 36 + #define BDADDR_BCM20702A1 (&(bdaddr_t) {{0x00, 0x00, 0xa0, 0x02, 0x70, 0x20}}) 37 + #define BDADDR_BCM43430A0 (&(bdaddr_t) {{0xac, 0x1f, 0x12, 0xa0, 0x43, 0x43}}) 36 38 #define BDADDR_BCM4324B3 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb3, 0x24, 0x43}}) 37 39 #define BDADDR_BCM4330B1 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb1, 0x30, 0x43}}) 38 40 ··· 66 64 * The address 00:20:70:02:A0:00 indicates a BCM20702A0 controller 67 65 * with no configured address. 68 66 * 67 + * The address 20:70:02:A0:00:00 indicates a BCM20702A1 controller 68 + * with no configured address. 69 + * 69 70 * The address 43:24:B3:00:00:00 indicates a BCM4324B3 controller 70 71 * with waiting for configuration state. 71 72 * 72 73 * The address 43:30:B1:00:00:00 indicates a BCM4330B1 controller 73 74 * with waiting for configuration state. 75 + * 76 + * The address 43:43:A0:12:1F:AC indicates a BCM43430A0 controller 77 + * with no configured address. 74 78 */ 75 79 if (!bacmp(&bda->bdaddr, BDADDR_BCM20702A0) || 80 + !bacmp(&bda->bdaddr, BDADDR_BCM20702A1) || 76 81 !bacmp(&bda->bdaddr, BDADDR_BCM4324B3) || 77 - !bacmp(&bda->bdaddr, BDADDR_BCM4330B1)) { 82 + !bacmp(&bda->bdaddr, BDADDR_BCM4330B1) || 83 + !bacmp(&bda->bdaddr, BDADDR_BCM43430A0)) { 78 84 bt_dev_info(hdev, "BCM: Using default device address (%pMR)", 79 85 &bda->bdaddr); 80 86 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); ··· 340 330 { 0x2209, "BCM43430A1" }, /* 001.002.009 */ 341 331 { 0x6119, "BCM4345C0" }, /* 003.001.025 */ 342 332 { 0x230f, "BCM4356A2" }, /* 001.003.015 */ 333 + { 0x220e, "BCM20702A1" }, /* 001.002.014 */ 334 + { 0x4217, "BCM4329B1" }, /* 002.002.023 */ 343 335 { } 344 336 }; 345 337
+39 -41
drivers/bluetooth/btusb.c
··· 344 344 /* Intel Bluetooth devices */ 345 345 { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW }, 346 346 { USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW }, 347 + { USB_DEVICE(0x8087, 0x0029), .driver_info = BTUSB_INTEL_NEW }, 347 348 { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR }, 348 349 { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, 349 350 { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, ··· 1936 1935 if (len != sizeof(*evt)) 1937 1936 return; 1938 1937 1939 - if (test_and_clear_bit(BTUSB_BOOTING, &data->flags)) { 1940 - smp_mb__after_atomic(); 1938 + if (test_and_clear_bit(BTUSB_BOOTING, &data->flags)) 1941 1939 wake_up_bit(&data->flags, BTUSB_BOOTING); 1942 - } 1943 1940 } 1944 1941 1945 1942 static void btusb_intel_secure_send_result(struct btusb_data *data, ··· 1952 1953 set_bit(BTUSB_FIRMWARE_FAILED, &data->flags); 1953 1954 1954 1955 if (test_and_clear_bit(BTUSB_DOWNLOADING, &data->flags) && 1955 - test_bit(BTUSB_FIRMWARE_LOADED, &data->flags)) { 1956 - smp_mb__after_atomic(); 1956 + test_bit(BTUSB_FIRMWARE_LOADED, &data->flags)) 1957 1957 wake_up_bit(&data->flags, BTUSB_DOWNLOADING); 1958 - } 1959 1958 } 1960 1959 1961 1960 static int btusb_recv_event_intel(struct hci_dev *hdev, struct sk_buff *skb) ··· 2052 2055 return -EILSEQ; 2053 2056 } 2054 2057 2058 + static bool btusb_setup_intel_new_get_fw_name(struct intel_version *ver, 2059 + struct intel_boot_params *params, 2060 + char *fw_name, size_t len, 2061 + const char *suffix) 2062 + { 2063 + switch (ver->hw_variant) { 2064 + case 0x0b: /* SfP */ 2065 + case 0x0c: /* WsP */ 2066 + snprintf(fw_name, len, "intel/ibt-%u-%u.%s", 2067 + le16_to_cpu(ver->hw_variant), 2068 + le16_to_cpu(params->dev_revid), 2069 + suffix); 2070 + break; 2071 + case 0x11: /* JfP */ 2072 + case 0x12: /* ThP */ 2073 + case 0x13: /* HrP */ 2074 + case 0x14: /* CcP */ 2075 + snprintf(fw_name, len, "intel/ibt-%u-%u-%u.%s", 2076 + le16_to_cpu(ver->hw_variant), 2077 + le16_to_cpu(ver->hw_revision), 2078 + le16_to_cpu(ver->fw_revision), 2079 + suffix); 2080 + break; 2081 + default: 2082 + return false; 2083 + } 2084 + return true; 2085 + } 2086 + 2055 2087 static int btusb_setup_intel_new(struct hci_dev *hdev) 2056 2088 { 2057 2089 struct btusb_data *data = hci_get_drvdata(hdev); ··· 2132 2106 case 0x11: /* JfP */ 2133 2107 case 0x12: /* ThP */ 2134 2108 case 0x13: /* HrP */ 2135 - case 0x14: /* QnJ, IcP */ 2109 + case 0x14: /* CcP */ 2136 2110 break; 2137 2111 default: 2138 2112 bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)", ··· 2216 2190 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi. 2217 2191 * 2218 2192 */ 2219 - switch (ver.hw_variant) { 2220 - case 0x0b: /* SfP */ 2221 - case 0x0c: /* WsP */ 2222 - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi", 2223 - le16_to_cpu(ver.hw_variant), 2224 - le16_to_cpu(params.dev_revid)); 2225 - break; 2226 - case 0x11: /* JfP */ 2227 - case 0x12: /* ThP */ 2228 - case 0x13: /* HrP */ 2229 - case 0x14: /* QnJ, IcP */ 2230 - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi", 2231 - le16_to_cpu(ver.hw_variant), 2232 - le16_to_cpu(ver.hw_revision), 2233 - le16_to_cpu(ver.fw_revision)); 2234 - break; 2235 - default: 2193 + err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname, 2194 + sizeof(fwname), "sfi"); 2195 + if (!err) { 2236 2196 bt_dev_err(hdev, "Unsupported Intel firmware naming"); 2237 2197 return -EINVAL; 2238 2198 } ··· 2234 2222 /* Save the DDC file name for later use to apply once the firmware 2235 2223 * downloading is done. 2236 2224 */ 2237 - switch (ver.hw_variant) { 2238 - case 0x0b: /* SfP */ 2239 - case 0x0c: /* WsP */ 2240 - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc", 2241 - le16_to_cpu(ver.hw_variant), 2242 - le16_to_cpu(params.dev_revid)); 2243 - break; 2244 - case 0x11: /* JfP */ 2245 - case 0x12: /* ThP */ 2246 - case 0x13: /* HrP */ 2247 - case 0x14: /* QnJ, IcP */ 2248 - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc", 2249 - le16_to_cpu(ver.hw_variant), 2250 - le16_to_cpu(ver.hw_revision), 2251 - le16_to_cpu(ver.fw_revision)); 2252 - break; 2253 - default: 2225 + err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname, 2226 + sizeof(fwname), "ddc"); 2227 + if (!err) { 2254 2228 bt_dev_err(hdev, "Unsupported Intel firmware naming"); 2255 2229 return -EINVAL; 2256 2230 }
+120 -14
drivers/bluetooth/hci_bcm.c
··· 31 31 #include <linux/property.h> 32 32 #include <linux/platform_data/x86/apple.h> 33 33 #include <linux/platform_device.h> 34 + #include <linux/regulator/consumer.h> 34 35 #include <linux/clk.h> 35 36 #include <linux/gpio/consumer.h> 36 37 #include <linux/tty.h> ··· 52 51 #define BCM_LM_DIAG_PKT 0x07 53 52 #define BCM_LM_DIAG_SIZE 63 54 53 54 + #define BCM_TYPE49_PKT 0x31 55 + #define BCM_TYPE49_SIZE 0 56 + 57 + #define BCM_TYPE52_PKT 0x34 58 + #define BCM_TYPE52_SIZE 0 59 + 55 60 #define BCM_AUTOSUSPEND_DELAY 5000 /* default autosleep delay */ 61 + 62 + #define BCM_NUM_SUPPLIES 2 56 63 57 64 /** 58 65 * struct bcm_device - device driver resources ··· 80 71 * @btlp: Apple ACPI method to toggle BT_WAKE pin ("Bluetooth Low Power") 81 72 * @btpu: Apple ACPI method to drive BT_REG_ON pin high ("Bluetooth Power Up") 82 73 * @btpd: Apple ACPI method to drive BT_REG_ON pin low ("Bluetooth Power Down") 83 - * @clk: clock used by Bluetooth device 84 - * @clk_enabled: whether @clk is prepared and enabled 74 + * @txco_clk: external reference frequency clock used by Bluetooth device 75 + * @lpo_clk: external LPO clock used by Bluetooth device 76 + * @supplies: VBAT and VDDIO supplies used by Bluetooth device 77 + * @res_enabled: whether clocks and supplies are prepared and enabled 85 78 * @init_speed: default baudrate of Bluetooth device; 86 79 * the host UART is initially set to this baudrate so that 87 80 * it can configure the Bluetooth device for @oper_speed ··· 113 102 int gpio_int_idx; 114 103 #endif 115 104 116 - struct clk *clk; 117 - bool clk_enabled; 105 + struct clk *txco_clk; 106 + struct clk *lpo_clk; 107 + struct regulator_bulk_data supplies[BCM_NUM_SUPPLIES]; 108 + bool res_enabled; 118 109 119 110 u32 init_speed; 120 111 u32 oper_speed; ··· 227 214 { 228 215 int err; 229 216 230 - if (powered && !IS_ERR(dev->clk) && !dev->clk_enabled) { 231 - err = clk_prepare_enable(dev->clk); 217 + if (powered && !dev->res_enabled) { 218 + err = regulator_bulk_enable(BCM_NUM_SUPPLIES, dev->supplies); 232 219 if (err) 233 220 return err; 221 + 222 + /* LPO clock needs to be 32.768 kHz */ 223 + err = clk_set_rate(dev->lpo_clk, 32768); 224 + if (err) { 225 + dev_err(dev->dev, "Could not set LPO clock rate\n"); 226 + goto err_regulator_disable; 227 + } 228 + 229 + err = clk_prepare_enable(dev->lpo_clk); 230 + if (err) 231 + goto err_regulator_disable; 232 + 233 + err = clk_prepare_enable(dev->txco_clk); 234 + if (err) 235 + goto err_lpo_clk_disable; 234 236 } 235 237 236 238 err = dev->set_shutdown(dev, powered); 237 239 if (err) 238 - goto err_clk_disable; 240 + goto err_txco_clk_disable; 239 241 240 242 err = dev->set_device_wakeup(dev, powered); 241 243 if (err) 242 244 goto err_revert_shutdown; 243 245 244 - if (!powered && !IS_ERR(dev->clk) && dev->clk_enabled) 245 - clk_disable_unprepare(dev->clk); 246 + if (!powered && dev->res_enabled) { 247 + clk_disable_unprepare(dev->txco_clk); 248 + clk_disable_unprepare(dev->lpo_clk); 249 + regulator_bulk_disable(BCM_NUM_SUPPLIES, dev->supplies); 250 + } 246 251 247 - dev->clk_enabled = powered; 252 + /* wait for device to power on and come out of reset */ 253 + usleep_range(10000, 20000); 254 + 255 + dev->res_enabled = powered; 248 256 249 257 return 0; 250 258 251 259 err_revert_shutdown: 252 260 dev->set_shutdown(dev, !powered); 253 - err_clk_disable: 254 - if (powered && !IS_ERR(dev->clk) && !dev->clk_enabled) 255 - clk_disable_unprepare(dev->clk); 261 + err_txco_clk_disable: 262 + if (powered && !dev->res_enabled) 263 + clk_disable_unprepare(dev->txco_clk); 264 + err_lpo_clk_disable: 265 + if (powered && !dev->res_enabled) 266 + clk_disable_unprepare(dev->lpo_clk); 267 + err_regulator_disable: 268 + if (powered && !dev->res_enabled) 269 + regulator_bulk_disable(BCM_NUM_SUPPLIES, dev->supplies); 256 270 return err; 257 271 } 258 272 ··· 601 561 .lsize = 0, \ 602 562 .maxlen = BCM_NULL_SIZE 603 563 564 + #define BCM_RECV_TYPE49 \ 565 + .type = BCM_TYPE49_PKT, \ 566 + .hlen = BCM_TYPE49_SIZE, \ 567 + .loff = 0, \ 568 + .lsize = 0, \ 569 + .maxlen = BCM_TYPE49_SIZE 570 + 571 + #define BCM_RECV_TYPE52 \ 572 + .type = BCM_TYPE52_PKT, \ 573 + .hlen = BCM_TYPE52_SIZE, \ 574 + .loff = 0, \ 575 + .lsize = 0, \ 576 + .maxlen = BCM_TYPE52_SIZE 577 + 604 578 static const struct h4_recv_pkt bcm_recv_pkts[] = { 605 579 { H4_RECV_ACL, .recv = hci_recv_frame }, 606 580 { H4_RECV_SCO, .recv = hci_recv_frame }, 607 581 { H4_RECV_EVENT, .recv = hci_recv_frame }, 608 582 { BCM_RECV_LM_DIAG, .recv = hci_recv_diag }, 609 583 { BCM_RECV_NULL, .recv = hci_recv_diag }, 584 + { BCM_RECV_TYPE49, .recv = hci_recv_diag }, 585 + { BCM_RECV_TYPE52, .recv = hci_recv_diag }, 610 586 }; 611 587 612 588 static int bcm_recv(struct hci_uart *hu, const void *data, int count) ··· 952 896 return 0; 953 897 } 954 898 899 + /* Try a bunch of names for TXCO */ 900 + static struct clk *bcm_get_txco(struct device *dev) 901 + { 902 + struct clk *clk; 903 + 904 + /* New explicit name */ 905 + clk = devm_clk_get(dev, "txco"); 906 + if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER) 907 + return clk; 908 + 909 + /* Deprecated name */ 910 + clk = devm_clk_get(dev, "extclk"); 911 + if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER) 912 + return clk; 913 + 914 + /* Original code used no name at all */ 915 + return devm_clk_get(dev, NULL); 916 + } 917 + 955 918 static int bcm_get_resources(struct bcm_device *dev) 956 919 { 957 920 const struct dmi_system_id *dmi_id; 921 + int err; 958 922 959 923 dev->name = dev_name(dev->dev); 960 924 961 925 if (x86_apple_machine && !bcm_apple_get_resources(dev)) 962 926 return 0; 963 927 964 - dev->clk = devm_clk_get(dev->dev, NULL); 928 + dev->txco_clk = bcm_get_txco(dev->dev); 929 + 930 + /* Handle deferred probing */ 931 + if (dev->txco_clk == ERR_PTR(-EPROBE_DEFER)) 932 + return PTR_ERR(dev->txco_clk); 933 + 934 + /* Ignore all other errors as before */ 935 + if (IS_ERR(dev->txco_clk)) 936 + dev->txco_clk = NULL; 937 + 938 + dev->lpo_clk = devm_clk_get(dev->dev, "lpo"); 939 + if (dev->lpo_clk == ERR_PTR(-EPROBE_DEFER)) 940 + return PTR_ERR(dev->lpo_clk); 941 + 942 + if (IS_ERR(dev->lpo_clk)) 943 + dev->lpo_clk = NULL; 944 + 945 + /* Check if we accidentally fetched the lpo clock twice */ 946 + if (dev->lpo_clk && clk_is_match(dev->lpo_clk, dev->txco_clk)) { 947 + devm_clk_put(dev->dev, dev->txco_clk); 948 + dev->txco_clk = NULL; 949 + } 965 950 966 951 dev->device_wakeup = devm_gpiod_get_optional(dev->dev, "device-wakeup", 967 952 GPIOD_OUT_LOW); ··· 1016 919 1017 920 dev->set_device_wakeup = bcm_gpio_set_device_wakeup; 1018 921 dev->set_shutdown = bcm_gpio_set_shutdown; 922 + 923 + dev->supplies[0].supply = "vbat"; 924 + dev->supplies[1].supply = "vddio"; 925 + err = devm_regulator_bulk_get(dev->dev, BCM_NUM_SUPPLIES, 926 + dev->supplies); 927 + if (err) 928 + return err; 1019 929 1020 930 /* IRQ can be declared in ACPI table as Interrupt or GpioInt */ 1021 931 if (dev->irq <= 0) { ··· 1418 1314 1419 1315 #ifdef CONFIG_OF 1420 1316 static const struct of_device_id bcm_bluetooth_of_match[] = { 1317 + { .compatible = "brcm,bcm20702a1" }, 1318 + { .compatible = "brcm,bcm4330-bt" }, 1421 1319 { .compatible = "brcm,bcm43438-bt" }, 1422 1320 { }, 1423 1321 };
+81
drivers/bluetooth/hci_h5.c
··· 115 115 int (*setup)(struct h5 *h5); 116 116 void (*open)(struct h5 *h5); 117 117 void (*close)(struct h5 *h5); 118 + int (*suspend)(struct h5 *h5); 119 + int (*resume)(struct h5 *h5); 118 120 const struct acpi_gpio_mapping *acpi_gpio_map; 119 121 }; 120 122 ··· 843 841 hci_uart_unregister_device(&h5->serdev_hu); 844 842 } 845 843 844 + static int __maybe_unused h5_serdev_suspend(struct device *dev) 845 + { 846 + struct h5 *h5 = dev_get_drvdata(dev); 847 + int ret = 0; 848 + 849 + if (h5->vnd && h5->vnd->suspend) 850 + ret = h5->vnd->suspend(h5); 851 + 852 + return ret; 853 + } 854 + 855 + static int __maybe_unused h5_serdev_resume(struct device *dev) 856 + { 857 + struct h5 *h5 = dev_get_drvdata(dev); 858 + int ret = 0; 859 + 860 + if (h5->vnd && h5->vnd->resume) 861 + ret = h5->vnd->resume(h5); 862 + 863 + return ret; 864 + } 865 + 846 866 #ifdef CONFIG_BT_HCIUART_RTL 847 867 static int h5_btrtl_setup(struct h5 *h5) 848 868 { ··· 931 907 gpiod_set_value_cansleep(h5->enable_gpio, 0); 932 908 } 933 909 910 + /* Suspend/resume support. On many devices the RTL BT device loses power during 911 + * suspend/resume, causing it to lose its firmware and all state. So we simply 912 + * turn it off on suspend and reprobe on resume. This mirrors how RTL devices 913 + * are handled in the USB driver, where the USB_QUIRK_RESET_RESUME is used which 914 + * also causes a reprobe on resume. 915 + */ 916 + static int h5_btrtl_suspend(struct h5 *h5) 917 + { 918 + serdev_device_set_flow_control(h5->hu->serdev, false); 919 + gpiod_set_value_cansleep(h5->device_wake_gpio, 0); 920 + gpiod_set_value_cansleep(h5->enable_gpio, 0); 921 + return 0; 922 + } 923 + 924 + struct h5_btrtl_reprobe { 925 + struct device *dev; 926 + struct work_struct work; 927 + }; 928 + 929 + static void h5_btrtl_reprobe_worker(struct work_struct *work) 930 + { 931 + struct h5_btrtl_reprobe *reprobe = 932 + container_of(work, struct h5_btrtl_reprobe, work); 933 + int ret; 934 + 935 + ret = device_reprobe(reprobe->dev); 936 + if (ret && ret != -EPROBE_DEFER) 937 + dev_err(reprobe->dev, "Reprobe error %d\n", ret); 938 + 939 + put_device(reprobe->dev); 940 + kfree(reprobe); 941 + module_put(THIS_MODULE); 942 + } 943 + 944 + static int h5_btrtl_resume(struct h5 *h5) 945 + { 946 + struct h5_btrtl_reprobe *reprobe; 947 + 948 + reprobe = kzalloc(sizeof(*reprobe), GFP_KERNEL); 949 + if (!reprobe) 950 + return -ENOMEM; 951 + 952 + __module_get(THIS_MODULE); 953 + 954 + INIT_WORK(&reprobe->work, h5_btrtl_reprobe_worker); 955 + reprobe->dev = get_device(&h5->hu->serdev->dev); 956 + queue_work(system_long_wq, &reprobe->work); 957 + return 0; 958 + } 959 + 934 960 static const struct acpi_gpio_params btrtl_device_wake_gpios = { 0, 0, false }; 935 961 static const struct acpi_gpio_params btrtl_enable_gpios = { 1, 0, false }; 936 962 static const struct acpi_gpio_params btrtl_host_wake_gpios = { 2, 0, false }; ··· 995 921 .setup = h5_btrtl_setup, 996 922 .open = h5_btrtl_open, 997 923 .close = h5_btrtl_close, 924 + .suspend = h5_btrtl_suspend, 925 + .resume = h5_btrtl_resume, 998 926 .acpi_gpio_map = acpi_btrtl_gpios, 999 927 }; 1000 928 #endif ··· 1011 935 MODULE_DEVICE_TABLE(acpi, h5_acpi_match); 1012 936 #endif 1013 937 938 + static const struct dev_pm_ops h5_serdev_pm_ops = { 939 + SET_SYSTEM_SLEEP_PM_OPS(h5_serdev_suspend, h5_serdev_resume) 940 + }; 941 + 1014 942 static struct serdev_device_driver h5_serdev_driver = { 1015 943 .probe = h5_serdev_probe, 1016 944 .remove = h5_serdev_remove, 1017 945 .driver = { 1018 946 .name = "hci_uart_h5", 1019 947 .acpi_match_table = ACPI_PTR(h5_acpi_match), 948 + .pm = &h5_serdev_pm_ops, 1020 949 }, 1021 950 }; 1022 951
+6 -14
drivers/bluetooth/hci_intel.c
··· 596 596 * is in bootloader mode or if it already has operational firmware 597 597 * loaded. 598 598 */ 599 - err = btintel_read_version(hdev, &ver); 600 - if (err) 599 + err = btintel_read_version(hdev, &ver); 600 + if (err) 601 601 return err; 602 602 603 603 /* The hardware platform number has a fixed value of 0x37 and ··· 909 909 set_bit(STATE_FIRMWARE_FAILED, &intel->flags); 910 910 911 911 if (test_and_clear_bit(STATE_DOWNLOADING, &intel->flags) && 912 - test_bit(STATE_FIRMWARE_LOADED, &intel->flags)) { 913 - smp_mb__after_atomic(); 912 + test_bit(STATE_FIRMWARE_LOADED, &intel->flags)) 914 913 wake_up_bit(&intel->flags, STATE_DOWNLOADING); 915 - } 916 914 917 915 /* When switching to the operational firmware the device 918 916 * sends a vendor specific event indicating that the bootup ··· 918 920 */ 919 921 } else if (skb->len == 9 && hdr->evt == 0xff && hdr->plen == 0x07 && 920 922 skb->data[2] == 0x02) { 921 - if (test_and_clear_bit(STATE_BOOTING, &intel->flags)) { 922 - smp_mb__after_atomic(); 923 + if (test_and_clear_bit(STATE_BOOTING, &intel->flags)) 923 924 wake_up_bit(&intel->flags, STATE_BOOTING); 924 - } 925 925 } 926 926 recv: 927 927 return hci_recv_frame(hdev, skb); ··· 956 960 break; 957 961 case LPM_OP_SUSPEND_ACK: 958 962 set_bit(STATE_SUSPENDED, &intel->flags); 959 - if (test_and_clear_bit(STATE_LPM_TRANSACTION, &intel->flags)) { 960 - smp_mb__after_atomic(); 963 + if (test_and_clear_bit(STATE_LPM_TRANSACTION, &intel->flags)) 961 964 wake_up_bit(&intel->flags, STATE_LPM_TRANSACTION); 962 - } 963 965 break; 964 966 case LPM_OP_RESUME_ACK: 965 967 clear_bit(STATE_SUSPENDED, &intel->flags); 966 - if (test_and_clear_bit(STATE_LPM_TRANSACTION, &intel->flags)) { 967 - smp_mb__after_atomic(); 968 + if (test_and_clear_bit(STATE_LPM_TRANSACTION, &intel->flags)) 968 969 wake_up_bit(&intel->flags, STATE_LPM_TRANSACTION); 969 - } 970 970 break; 971 971 default: 972 972 bt_dev_err(hdev, "Unknown LPM opcode (%02x)", lpm->opcode);
-3
drivers/bluetooth/hci_serdev.c
··· 333 333 if (test_bit(HCI_UART_EXT_CONFIG, &hu->hdev_flags)) 334 334 set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks); 335 335 336 - if (!test_bit(HCI_UART_RESET_ON_INIT, &hu->hdev_flags)) 337 - set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); 338 - 339 336 if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags)) 340 337 hdev->dev_type = HCI_AMP; 341 338 else
+1 -12
net/6lowpan/debugfs.c
··· 232 232 233 233 return 0; 234 234 } 235 - 236 - static int lowpan_context_open(struct inode *inode, struct file *file) 237 - { 238 - return single_open(file, lowpan_context_show, inode->i_private); 239 - } 240 - 241 - static const struct file_operations lowpan_context_fops = { 242 - .open = lowpan_context_open, 243 - .read = seq_read, 244 - .llseek = seq_lseek, 245 - .release = single_release, 246 - }; 235 + DEFINE_SHOW_ATTRIBUTE(lowpan_context); 247 236 248 237 static int lowpan_short_addr_get(void *data, u64 *val) 249 238 {
+6
net/bluetooth/hci_event.c
··· 5711 5711 return true; 5712 5712 } 5713 5713 5714 + /* Check if request ended in Command Status - no way to retreive 5715 + * any extra parameters in this case. 5716 + */ 5717 + if (hdr->evt == HCI_EV_CMD_STATUS) 5718 + return false; 5719 + 5714 5720 if (hdr->evt != HCI_EV_CMD_COMPLETE) { 5715 5721 bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)", 5716 5722 hdr->evt);
+1 -1
net/bluetooth/hci_request.c
··· 1556 1556 connectable = (flags & MGMT_ADV_FLAG_CONNECTABLE) || 1557 1557 mgmt_get_connectable(hdev); 1558 1558 1559 - if (!is_advertising_allowed(hdev, connectable)) 1559 + if (!is_advertising_allowed(hdev, connectable)) 1560 1560 return -EPERM; 1561 1561 1562 1562 /* Set require_privacy to true only when non-connectable
+1 -11
net/bluetooth/l2cap_core.c
··· 7650 7650 return 0; 7651 7651 } 7652 7652 7653 - static int l2cap_debugfs_open(struct inode *inode, struct file *file) 7654 - { 7655 - return single_open(file, l2cap_debugfs_show, inode->i_private); 7656 - } 7657 - 7658 - static const struct file_operations l2cap_debugfs_fops = { 7659 - .open = l2cap_debugfs_open, 7660 - .read = seq_read, 7661 - .llseek = seq_lseek, 7662 - .release = single_release, 7663 - }; 7653 + DEFINE_SHOW_ATTRIBUTE(l2cap_debugfs); 7664 7654 7665 7655 static struct dentry *l2cap_debugfs; 7666 7656
+1 -11
net/bluetooth/rfcomm/core.c
··· 2166 2166 return 0; 2167 2167 } 2168 2168 2169 - static int rfcomm_dlc_debugfs_open(struct inode *inode, struct file *file) 2170 - { 2171 - return single_open(file, rfcomm_dlc_debugfs_show, inode->i_private); 2172 - } 2173 - 2174 - static const struct file_operations rfcomm_dlc_debugfs_fops = { 2175 - .open = rfcomm_dlc_debugfs_open, 2176 - .read = seq_read, 2177 - .llseek = seq_lseek, 2178 - .release = single_release, 2179 - }; 2169 + DEFINE_SHOW_ATTRIBUTE(rfcomm_dlc_debugfs); 2180 2170 2181 2171 static struct dentry *rfcomm_dlc_debugfs; 2182 2172
+1 -11
net/bluetooth/rfcomm/sock.c
··· 1020 1020 return 0; 1021 1021 } 1022 1022 1023 - static int rfcomm_sock_debugfs_open(struct inode *inode, struct file *file) 1024 - { 1025 - return single_open(file, rfcomm_sock_debugfs_show, inode->i_private); 1026 - } 1027 - 1028 - static const struct file_operations rfcomm_sock_debugfs_fops = { 1029 - .open = rfcomm_sock_debugfs_open, 1030 - .read = seq_read, 1031 - .llseek = seq_lseek, 1032 - .release = single_release, 1033 - }; 1023 + DEFINE_SHOW_ATTRIBUTE(rfcomm_sock_debugfs); 1034 1024 1035 1025 static struct dentry *rfcomm_sock_debugfs; 1036 1026
+1 -11
net/bluetooth/sco.c
··· 1173 1173 return 0; 1174 1174 } 1175 1175 1176 - static int sco_debugfs_open(struct inode *inode, struct file *file) 1177 - { 1178 - return single_open(file, sco_debugfs_show, inode->i_private); 1179 - } 1180 - 1181 - static const struct file_operations sco_debugfs_fops = { 1182 - .open = sco_debugfs_open, 1183 - .read = seq_read, 1184 - .llseek = seq_lseek, 1185 - .release = single_release, 1186 - }; 1176 + DEFINE_SHOW_ATTRIBUTE(sco_debugfs); 1187 1177 1188 1178 static struct dentry *sco_debugfs; 1189 1179