diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-08-12 09:20:56 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-08-12 16:35:44 +0200 |
commit | 62aaefa7d03804aef30639ab362f845b1f3e92ed (patch) | |
tree | 247152b0833b0d56a2e63e75f91565f2cbe6d229 /drivers/bluetooth/hci_bcm.c | |
parent | ea9eb698b2f59e16fbf9f480a9b35ddfb3c3a789 (diff) | |
download | lwn-62aaefa7d03804aef30639ab362f845b1f3e92ed.tar.gz lwn-62aaefa7d03804aef30639ab362f845b1f3e92ed.zip |
Bluetooth: hci_bcm: improve use of gpios API
devm_gpiod_get currently has an optional parameter to set initial
direction and value for the requested gpio. Make use of this to simplify
the driver and make it not fail to build when this parameter is made
mandatory (which is scheduled for 4.3-rc1).
Moreover use the _optional variant of devm_gpiod_get to simplify error
handling (which also gets more strict for free).
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/hci_bcm.c')
-rw-r--r-- | drivers/bluetooth/hci_bcm.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index cb7fe837f7d9..6070303418d8 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -408,7 +408,6 @@ static int bcm_acpi_probe(struct bcm_device *dev) { struct platform_device *pdev = dev->pdev; const struct acpi_device_id *id; - struct gpio_desc *gpio; struct acpi_device *adev; LIST_HEAD(resources); int ret; @@ -426,21 +425,16 @@ static int bcm_acpi_probe(struct bcm_device *dev) dev->clk = devm_clk_get(&pdev->dev, NULL); - gpio = devm_gpiod_get(&pdev->dev, "device-wakeup"); - if (!IS_ERR(gpio)) { - ret = gpiod_direction_output(gpio, 0); - if (ret) - return ret; - dev->device_wakeup = gpio; - } + dev->device_wakeup = devm_gpiod_get_optional(&pdev->dev, + "device-wakeup", + GPIOD_OUT_LOW); + if (IS_ERR(dev->device_wakeup)) + return PTR_ERR(dev->device_wakeup); - gpio = devm_gpiod_get(&pdev->dev, "shutdown"); - if (!IS_ERR(gpio)) { - ret = gpiod_direction_output(gpio, 0); - if (ret) - return ret; - dev->shutdown = gpio; - } + dev->shutdown = devm_gpiod_get_optional(&pdev->dev, "shutdown", + GPIOD_OUT_LOW); + if (IS_ERR(dev->shutdown)) + return PTR_ERR(dev->shutdown); /* Make sure at-least one of the GPIO is defined and that * a name is specified for this instance |