Bluetooth: btusb: Use an error label for error paths
Subsystems (4)
PATCH v7 1/3 Bluetooth: btusb: Use an error label for error paths
Use a label to remove the repetetive cleanup, for error cases.
---
v7: same as v6
v6: same as v5
v5: same as v4
v4: same as v3
v3: Added Brian's "Reviewed-by"
v2: same as v1
drivers/bluetooth/btusb.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/bluetooth/btusb.c +9 -10
@@ -2991,18 +2991,15 @@ static int btusb_probe(struct usb_interface *intf, err =usb_set_interface (data->udev,0 ,0 );if (err <0 ) {BT_ERR ("failed to set interface 0, alt 0 %d" , err); -hci_free_dev (hdev); -return err; + goto out_free_dev; } }if (data->isoc) { err =usb_driver_claim_interface (&btusb_driver, data->isoc, data); -if (err <0 ) { -hci_free_dev (hdev); -return err; - } +if (err <0 ) + goto out_free_dev; }#ifdef CONFIG_BT_HCIBTUSB_BCM
@@ -3016,14 +3013,16 @@ static int btusb_probe(struct usb_interface *intf,#endif err =hci_register_dev (hdev); -if (err <0 ) { -hci_free_dev (hdev); -return err; - } +if (err <0 ) + goto out_free_dev;usb_set_intfdata (intf, data);return 0 ; + +out_free_dev: +hci_free_dev (hdev); +return err; }static void btusb_disconnect (struct usb_interface *intf)
Signature · 1 line
2.11.0.483.g087da7b7c-goog
PATCH v7 2/3 Bluetooth: btusb: Add out-of-band wakeup support
Some onboard BT chips (e.g. Marvell 8997) contain a wakeup pin that can be connected to a gpio on the CPU side, and can be used to wakeup the host out-of-band. This can be useful in situations where the in-band wakeup is not possible or not preferable (e.g. the in-band wakeup may require the USB host controller to remain active, and hence consuming more system power during system sleep).
The oob gpio interrupt to be used for wakeup on the CPU side, is read from the device tree node, (using standard interrupt descriptors). A devcie tree binding document is also added for the driver. The compatible string is in compliance with Documentation/devicetree/bindings/usb/usb-device.txt
---
v7: Change the BTUSB_OOB_WAKE_DISABLED flag to BTUSB_OOB_WAKE_ENABLED
v6: Remove the newlines in error statements ("\n")
v5: Move the call to pm_wakeup_event() to the begining of irq handler.
v4: Move the set_bit(BTUSB_OOB_WAKE_DISABLED,..) call to the beginning of
btusb_config_oob_wake()
v3: Add Brian's "Reviewed-by"
v2: * Use interrupt-names ("wakeup") instead of assuming first interrupt.
* Leave it on device tree to specify IRQ flags (level /edge triggered)
* Mark the device as non wakeable on exit.
Documentation/devicetree/bindings/net/btusb.txt | 40 ++++++++++++ drivers/bluetooth/btusb.c | 85 +++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/btusb.txt
Documentation/devicetree/bindings/net/btusb.txt new file +40 -0
@@ -0,0 +1,40 @@ +Generic Bluetooth controller over USB (btusb driver) +--------------------------------------------------- + +Required properties: + + - compatible : should comply with the format "usbVID,PID" specified in + Documentation/devicetree/bindings/usb/usb-device.txt + At the time of writing, the only OF supported devices + (more may be added later) are: + + "usb1286,204e" (Marvell 8997) + +Optional properties: + + - interrupt-parent: phandle of the parent interrupt controller + - interrupt-names: (see below) + - interrupts : The interrupt specified by the name "wakeup" is the interrupt + that shall be used for out-of-band wake-on-bt. Driver will + request this interrupt for wakeup. During system suspend, the + irq will be enabled so that the bluetooth chip can wakeup host + platform out of band. During system resume, the irq will be + disabled to make sure unnecessary interrupt is not received. + +Example: + +Following example uses irq pin number 3 of gpio0 for out of band wake-on-bt: + +&usb_host1_ehci { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + mvl_bt1: bt@1 { + compatible = "usb1286,204e"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupt-name = "wakeup"; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + }; +};
drivers/bluetooth/btusb.c +85 -0
133 lines not on this page · raw message
Signature · 1 line
2.11.0.483.g087da7b7c-goog
PATCH v7 3/3 Bluetooth: btusb: Configure Marvell to use one of the pins for oob wakeup
In reply to Rajat JainThe Marvell devices may have many gpio pins, and hence for wakeup on these out-of-band pins, the chip needs to be told which pin is to be used for wakeup, using an hci command.
Thus, we read the pin number etc from the device tree node and send a command to the chip.
---
v7: Same as v6
v6: same as v5
v5: same as v5
v4: same as v3
v3: * remove the Marvell specific id table and check
* Add reference to marvell-bt-8xxx.txt in btusb.txt
* Add "Reviewed-by" and "Acked-by"
v2: Fix the binding document to specify to use "wakeup" interrupt-name
Documentation/devicetree/bindings/net/btusb.txt | 3 ++
.../{marvell-bt-sd8xxx.txt => marvell-bt-8xxx.txt} | 46 +++++++++++++++----
drivers/bluetooth/btusb.c | 51 ++++++++++++++++++++++
3 files changed, 92 insertions(+), 8 deletions(-)
rename Documentation/devicetree/bindings/net/{marvell-bt-sd8xxx.txt => marvell-bt-8xxx.txt} (50%)Documentation/devicetree/bindings/net/btusb.txt +3 -0
@@ -10,6 +10,9 @@ Required properties: "usb1286,204e" (Marvell 8997) +Also, vendors that use btusb may have device additional properties, e.g: +Documentation/devicetree/bindings/net/marvell-bt-8xxx.txt + Optional properties: - interrupt-parent: phandle of the parent interrupt controller
Documentation/devicetree/bindings/net/marvell-bt-8xxx.txt renamed from Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt +38 -8
74 lines not on this page · raw message
drivers/bluetooth/btusb.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.11.0.483.g087da7b7c-goog
Marcel Holtmann
maintainerRe: [PATCH v7 3/3] Bluetooth: btusb: Configure Marvell to use one of the pins for oob wakeup
Hi,
Quoted 20 lines
The Marvell devices may have many gpio pins, and hence for wakeup on these out-of-band pins, the chip needs to be told which pin is to be used for wakeup, using an hci command.
Thus, we read the pin number etc from the device tree node and send a command to the chip.
Signed-off-by Rajat Jain <[email protected]>Reviewed-by Brian Norris <[email protected]>Acked-by Rob Herring <[email protected]>---
v7: Same as v6
v6: same as v5
v5: same as v5
v4: same as v3
v3: * remove the Marvell specific id table and check
* Add reference to marvell-bt-8xxx.txt in btusb.txt
* Add "Reviewed-by" and "Acked-by"
v2: Fix the binding document to specify to use "wakeup" interrupt-name
Quoted 5 lines
Documentation/devicetree/bindings/net/btusb.txt | 3 ++ .../{marvell-bt-sd8xxx.txt => marvell-bt-8xxx.txt} | 46 +++++++++++++++---- drivers/bluetooth/btusb.c | 51 ++++++++++++++++++++++ 3 files changed, 92 insertions(+), 8 deletions(-)rename
Documentation/devicetree/bindings/net/{marvell-bt-sd8xxx.txt=> marvell-bt-8xxx.txt} (50%)
all 3 patches have been applied to bluetooth-next tree.
Regards
Marcel