add chaos_calmer branch
[15.05/openwrt.git] / package / kernel / mac80211 / patches / 368-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
1 From: Arend van Spriel <arend@broadcom.com>
2 Date: Wed, 20 May 2015 14:09:47 +0200
3 Subject: [PATCH] brcmfmac: allow device tree node without 'interrupts'
4  property
5
6 As described in the device tree bindings for 'brcm,bcm4329-fmac'
7 nodes, the interrupts property is optional. So adding a check
8 for the presence of this property before attempting to parse
9 and map the interrupt. If not present or parsing fails return
10 and fallback to in-band sdio interrupt.
11
12 Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
13 Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
14 Signed-off-by: Arend van Spriel <arend@broadcom.com>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
16 ---
17
18 --- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
19 +++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
20 @@ -39,10 +39,16 @@ void brcmf_of_probe(struct brcmf_sdio_de
21         if (!sdiodev->pdata)
22                 return;
23  
24 +       if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
25 +               sdiodev->pdata->drive_strength = val;
26 +
27 +       /* make sure there are interrupts defined in the node */
28 +       if (!of_find_property(np, "interrupts", NULL))
29 +               return;
30 +
31         irq = irq_of_parse_and_map(np, 0);
32         if (!irq) {
33                 brcmf_err("interrupt could not be mapped\n");
34 -               devm_kfree(dev, sdiodev->pdata);
35                 return;
36         }
37         irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
38 @@ -50,7 +56,4 @@ void brcmf_of_probe(struct brcmf_sdio_de
39         sdiodev->pdata->oob_irq_supported = true;
40         sdiodev->pdata->oob_irq_nr = irq;
41         sdiodev->pdata->oob_irq_flags = irqf;
42 -
43 -       if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
44 -               sdiodev->pdata->drive_strength = val;
45  }