374-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch 2.1 KB

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