1 From: Arend van Spriel <arend@broadcom.com>
2 Date: Wed, 27 May 2015 19:31:41 +0200
3 Subject: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
5 The fields of struct acpi_device are only known when CONFIG_ACPI is
6 defined. Fix this by using a helper function. This will resolve the
7 issue found in linux-next:
9 ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe':
10 ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type
11 adev->flags.power_manageable = 0;
14 Fixes: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
15 Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
16 Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
17 Signed-off-by: Arend van Spriel <arend@broadcom.com>
18 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
21 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
22 +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
23 @@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_id
24 static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
27 +static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
30 +#if IS_ENABLED(CONFIG_ACPI)
31 + struct acpi_device *adev;
33 + adev = ACPI_COMPANION(dev);
35 + adev->flags.power_manageable = 0;
39 static int brcmf_ops_sdio_probe(struct sdio_func *func,
40 const struct sdio_device_id *id)
42 @@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct s
43 struct brcmf_sdio_dev *sdiodev;
44 struct brcmf_bus *bus_if;
46 - struct acpi_device *adev;
48 brcmf_dbg(SDIO, "Enter\n");
49 brcmf_dbg(SDIO, "Class=%x\n", func->class);
50 @@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct s
51 brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
52 brcmf_dbg(SDIO, "Function#: %d\n", func->num);
54 - /* prohibit ACPI power management for this device */
56 - adev = ACPI_COMPANION(dev);
58 - adev->flags.power_manageable = 0;
59 + /* prohibit ACPI power management for this device */
60 + brcmf_sdiod_acpi_set_power_manageable(dev, 0);
62 /* Consume func num 1 but dont do anything with it. */