linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
@ 2015-05-27 17:31 Arend van Spriel
  2015-05-28  8:29 ` Kalle Valo
  2015-05-28 16:48 ` [PATCH] " Jason Andryuk
  0 siblings, 2 replies; 4+ messages in thread
From: Arend van Spriel @ 2015-05-27 17:31 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, Arend van Spriel, Fu, Zhonghui

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: commit f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index b0d0ff5..71779b9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -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)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: brcmfmac: fix invalid access to struct acpi_device fields
  2015-05-27 17:31 [PATCH] brcmfmac: fix invalid access to struct acpi_device fields Arend van Spriel
@ 2015-05-28  8:29 ` Kalle Valo
  2015-05-28 16:48 ` [PATCH] " Jason Andryuk
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2015-05-28  8:29 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linux-wireless, Arend van Spriel, Fu, Zhonghui


> 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: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
> Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Arend van Spriel <arend@broadcom.com>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  2015-05-27 17:31 [PATCH] brcmfmac: fix invalid access to struct acpi_device fields Arend van Spriel
  2015-05-28  8:29 ` Kalle Valo
@ 2015-05-28 16:48 ` Jason Andryuk
  2015-05-28 18:31   ` Arend van Spriel
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Andryuk @ 2015-05-28 16:48 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: Kalle Valo, linux-wireless, Fu, Zhonghui

On Wed, May 27, 2015 at 1:31 PM, Arend van Spriel <arend@broadcom.com> wrote:
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
> index b0d0ff5..71779b9 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
> @@ -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;

Shouldn't this be " = val"?

-Jason

> +#endif
> +}
> +
>  static int brcmf_ops_sdio_probe(struct sdio_func *func,
>                                 const struct sdio_device_id *id)
>  {

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  2015-05-28 16:48 ` [PATCH] " Jason Andryuk
@ 2015-05-28 18:31   ` Arend van Spriel
  0 siblings, 0 replies; 4+ messages in thread
From: Arend van Spriel @ 2015-05-28 18:31 UTC (permalink / raw)
  To: Jason Andryuk; +Cc: Kalle Valo, linux-wireless, Fu, Zhonghui

On 05/28/15 18:48, Jason Andryuk wrote:
> On Wed, May 27, 2015 at 1:31 PM, Arend van Spriel<arend@broadcom.com>  wrote:
>> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
>> index b0d0ff5..71779b9 100644
>> --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
>> +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
>> @@ -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;
>
> 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

> -Jason
>
>> +#endif
>> +}
>> +
>>   static int brcmf_ops_sdio_probe(struct sdio_func *func,
>>                                  const struct sdio_device_id *id)
>>   {


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-28 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 17:31 [PATCH] brcmfmac: fix invalid access to struct acpi_device fields Arend van Spriel
2015-05-28  8:29 ` Kalle Valo
2015-05-28 16:48 ` [PATCH] " Jason Andryuk
2015-05-28 18:31   ` Arend van Spriel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).