Skip to content

Commit 00e27ee

Browse files
Arend van SprielKalle Valo
authored andcommitted
brcmfmac: fix invalid access to struct acpi_device fields
The fields of struct acpi_device are only known when CONFIG_ACPI is defined. Fix this by using a helper function. This will resolve the issue found in linux-next: ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe': ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type adev->flags.power_manageable = 0; ^ Fixes: f0992ac ("brcmfmac: prohibit ACPI power management ...") Cc: Fu, Zhonghui <[email protected]> Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Arend van Spriel <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent f3550ae commit 00e27ee

File tree

1 file changed

+14
-5
lines changed
  • drivers/net/wireless/brcm80211/brcmfmac

1 file changed

+14
-5
lines changed

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,26 +1117,35 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
11171117
static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
11181118

11191119

1120+
static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
1121+
int val)
1122+
{
1123+
#if IS_ENABLED(CONFIG_ACPI)
1124+
struct acpi_device *adev;
1125+
1126+
adev = ACPI_COMPANION(dev);
1127+
if (adev)
1128+
adev->flags.power_manageable = 0;
1129+
#endif
1130+
}
1131+
11201132
static int brcmf_ops_sdio_probe(struct sdio_func *func,
11211133
const struct sdio_device_id *id)
11221134
{
11231135
int err;
11241136
struct brcmf_sdio_dev *sdiodev;
11251137
struct brcmf_bus *bus_if;
11261138
struct device *dev;
1127-
struct acpi_device *adev;
11281139

11291140
brcmf_dbg(SDIO, "Enter\n");
11301141
brcmf_dbg(SDIO, "Class=%x\n", func->class);
11311142
brcmf_dbg(SDIO, "sdio vendor ID: 0x%04x\n", func->vendor);
11321143
brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
11331144
brcmf_dbg(SDIO, "Function#: %d\n", func->num);
11341145

1135-
/* prohibit ACPI power management for this device */
11361146
dev = &func->dev;
1137-
adev = ACPI_COMPANION(dev);
1138-
if (adev)
1139-
adev->flags.power_manageable = 0;
1147+
/* prohibit ACPI power management for this device */
1148+
brcmf_sdiod_acpi_set_power_manageable(dev, 0);
11401149

11411150
/* Consume func num 1 but dont do anything with it. */
11421151
if (func->num == 1)

0 commit comments

Comments
 (0)