brcmfmac: fix invalid access to struct acpi_device fields
PATCH 1/1 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;
^--- drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +14 -5
@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata; +static void brcmf_sdiod_acpi_set_power_manageable (struct device *dev, +int val) +{ +#if IS_ENABLED (CONFIG_ACPI ) +struct acpi_device *adev; + + adev =ACPI_COMPANION (dev); +if (adev) + adev->flags.power_manageable =0 ; +#endif +} +static int brcmf_ops_sdio_probe (struct sdio_func *func,const struct sdio_device_id *id) {
@@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,struct brcmf_sdio_dev *sdiodev;struct brcmf_bus *bus_if;struct device *dev; -struct acpi_device *adev;brcmf_dbg (SDIO ,"Enter\n" );brcmf_dbg (SDIO ,"Class=%x\n" , func->class);
@@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,brcmf_dbg (SDIO ,"sdio device ID: 0x%04x\n" , func->device);brcmf_dbg (SDIO ,"Function#: %d\n" , func->num); -/* prohibit ACPI power management for this device */ dev = &func->dev; - adev =ACPI_COMPANION (dev); -if (adev) - adev->flags.power_manageable =0 ; +/* prohibit ACPI power management for this device */ +brcmf_sdiod_acpi_set_power_manageable (dev,0 );/* Consume func num 1 but dont do anything with it. */ if (func->num ==1 )
Signature · 1 line
1.9.1
Kalle Valo
AppliedQuoted 7 lines
The fields of struct
acpi_deviceare only known whenCONFIG_ACPIis 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
Quoted 7 lines
adev->flags.power_manageable = 0; ^Fixes f0992ace680c ("brcmfmac: prohibit ACPI power management ...")Cc Fu, Zhonghui <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Arend van Spriel <[email protected]>
Thanks, applied to wireless-drivers-next.git.
Kalle Valo
Quoted 7 lines · Arend van Spriel
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +0
-0@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); · line 1128
Quoted 10 lines
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +9
-0+static void brcmf_sdiod_acpi_set_power_manageable (struct device *dev, +int val) +{ +#if IS_ENABLED (CONFIG_ACPI ) +struct acpi_device *adev; + + adev =ACPI_COMPANION (dev); +if (adev) + adev->flags.power_manageable =0 ;
Shouldn't this be " = val"?
-Jason
Quoted 6 lines
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +3
-0+#endif +} +static int brcmf_ops_sdio_probe (struct sdio_func *func,const struct sdio_device_id *id) {
Quoted 9 lines · Jason Andryuk
Quoted 8 lines · Arend van Spriel
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +0
-0@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
Quoted 11 lines
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); · line 1128
Quoted 9 lines
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +9
-0+static void brcmf_sdiod_acpi_set_power_manageable (struct device *dev, +int val) +{ +#if IS_ENABLED (CONFIG_ACPI ) +struct acpi_device *adev; + + adev =ACPI_COMPANION (dev); +if (adev) + adev->flags.power_manageable =0 ;Shouldn't this be " = val"?
Definitely. The only place where it is called uses 0 for val parameter so there is no big issue, but I will fix it.
Thanks for spotting that bit.
Regards,
Arend
Quoted 8 lines
-Jason
Quoted 6 lines
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +3
-0+#endif +} +static int brcmf_ops_sdio_probe (struct sdio_func *func,const struct sdio_device_id *id) {