From 9af02d86e11dc409e5c3de46e81c0a492ba58905 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Mon, 23 Jan 2017 12:18:51 +0800 Subject: btmrvl: avoid double-disable_irq() race It's much the same as what we did for mwifiex in: b9da4d2 mwifiex: avoid double-disable_irq() race "We have a race where the wakeup IRQ might be in flight while we're calling mwifiex_disable_wake() from resume(). This can leave us disabling the IRQ twice. Let's disable the IRQ and enable it in case if we have double-disabled it." Signed-off-by: Jeffy Chen Reviewed-by: Brian Norris Signed-off-by: Marcel Holtmann --- drivers/bluetooth/btmrvl_sdio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/bluetooth/btmrvl_sdio.c') diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index d02f2c14df32..c738baeb6d45 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c @@ -1682,8 +1682,12 @@ static int btmrvl_sdio_resume(struct device *dev) /* Disable platform specific wakeup interrupt */ if (card->plt_wake_cfg && card->plt_wake_cfg->irq_bt >= 0) { disable_irq_wake(card->plt_wake_cfg->irq_bt); - if (!card->plt_wake_cfg->wake_by_bt) - disable_irq(card->plt_wake_cfg->irq_bt); + disable_irq(card->plt_wake_cfg->irq_bt); + if (card->plt_wake_cfg->wake_by_bt) + /* Undo our disable, since interrupt handler already + * did this. + */ + enable_irq(card->plt_wake_cfg->irq_bt); } return 0; -- cgit v1.2.3 From fd1a88da81d60a27960174bd9cda312c712961d1 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Mon, 23 Jan 2017 12:18:52 +0800 Subject: btmrvl: set irq_bt to -1 when failed to parse it The irq_of_parse_and_map will return 0 as a invalid irq. Set irq_bt to -1 in this case, so that the btmrvl resume/suspend code would not try to enable/disable it. Signed-off-by: Jeffy Chen Reviewed-by: Brian Norris Signed-off-by: Marcel Holtmann --- drivers/bluetooth/btmrvl_sdio.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/bluetooth/btmrvl_sdio.c') diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index c738baeb6d45..796f7194a772 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c @@ -97,6 +97,7 @@ static int btmrvl_sdio_probe_of(struct device *dev, cfg->irq_bt = irq_of_parse_and_map(card->plt_of_node, 0); if (!cfg->irq_bt) { dev_err(dev, "fail to parse irq_bt from device tree"); + cfg->irq_bt = -1; } else { ret = devm_request_irq(dev, cfg->irq_bt, btmrvl_wake_irq_bt, -- cgit v1.2.3 From ffb955dba61dd823c3d52a083b6c8d0dcfda0efe Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Mon, 23 Jan 2017 12:18:53 +0800 Subject: btmrvl: use dt's irqflags for wakeup pin Use irqflags parsed from dt. Signed-off-by: Jeffy Chen Reviewed-by: Brian Norris Signed-off-by: Marcel Holtmann --- drivers/bluetooth/btmrvl_sdio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/bluetooth/btmrvl_sdio.c') diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index 796f7194a772..23711fe9e0a5 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c @@ -101,8 +101,7 @@ static int btmrvl_sdio_probe_of(struct device *dev, } else { ret = devm_request_irq(dev, cfg->irq_bt, btmrvl_wake_irq_bt, - IRQF_TRIGGER_LOW, - "bt_wake", cfg); + 0, "bt_wake", cfg); if (ret) { dev_err(dev, "Failed to request irq_bt %d (%d)\n", -- cgit v1.2.3 From 8f91566f99fab8f7a0d2728a1e3defb13675837a Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sat, 18 Feb 2017 22:52:55 +0000 Subject: btmrvl: fix spelling mistake: "actived" -> "activated" trivial fix to spelling mistake in error message Signed-off-by: Colin Ian King Signed-off-by: Marcel Holtmann --- drivers/bluetooth/btmrvl_sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/bluetooth/btmrvl_sdio.c') diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index 23711fe9e0a5..08e01f002bad 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c @@ -1624,7 +1624,7 @@ static int btmrvl_sdio_suspend(struct device *dev) if (priv->adapter->hs_state != HS_ACTIVATED) { if (btmrvl_enable_hs(priv)) { - BT_ERR("HS not actived, suspend failed!"); + BT_ERR("HS not activated, suspend failed!"); priv->adapter->is_suspending = false; return -EBUSY; } -- cgit v1.2.3