linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rt2x00pci: Disable memory-write-invalidate when the driver exits
@ 2016-01-04  7:55 Jia-Ju Bai
  2016-01-04 16:50 ` Helmut Schaa
  2016-01-07  9:23 ` Kalle Valo
  0 siblings, 2 replies; 5+ messages in thread
From: Jia-Ju Bai @ 2016-01-04  7:55 UTC (permalink / raw)
  To: sgruszka, helmut.schaa, kvalo
  Cc: linux-wireless, netdev, linux-kernel, Jia-Ju Bai

The driver calls pci_set_mwi to enable memory-write-invalidate when it
is initialized, but does not call pci_clear_mwi when it is removed. Many
other drivers calls pci_clear_mwi when pci_set_mwi is called, such as
r8169, 8139cp and e1000.

This patch adds pci_clear_mwi in error handling and removal procedure, 
which can fix the problem.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/wireless/rt2x00/rt2x00pci.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index d93db4b..eb6dbcd 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -149,6 +149,7 @@ exit_free_device:
 	ieee80211_free_hw(hw);
 
 exit_release_regions:
+	pci_clear_mwi(pci_dev);
 	pci_release_regions(pci_dev);
 
 exit_disable_device:
@@ -173,6 +174,7 @@ void rt2x00pci_remove(struct pci_dev *pci_dev)
 	/*
 	 * Free the PCI device data.
 	 */
+	pci_clear_mwi(pci_dev);
 	pci_disable_device(pci_dev);
 	pci_release_regions(pci_dev);
 }
-- 
1.7.9.5



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

* Re: [PATCH] rt2x00pci: Disable memory-write-invalidate when the driver exits
  2016-01-04  7:55 [PATCH] rt2x00pci: Disable memory-write-invalidate when the driver exits Jia-Ju Bai
@ 2016-01-04 16:50 ` Helmut Schaa
  2016-01-05  1:27   ` Jia-Ju Bai
  2016-01-07  9:23 ` Kalle Valo
  1 sibling, 1 reply; 5+ messages in thread
From: Helmut Schaa @ 2016-01-04 16:50 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: Stanislaw Gruszka, kvalo, linux-wireless, netdev, LKML

On Mon, Jan 4, 2016 at 8:55 AM, Jia-Ju Bai <baijiaju1990@163.com> wrote:
> The driver calls pci_set_mwi to enable memory-write-invalidate when it
> is initialized, but does not call pci_clear_mwi when it is removed. Many
> other drivers calls pci_clear_mwi when pci_set_mwi is called, such as
> r8169, 8139cp and e1000.
>
> This patch adds pci_clear_mwi in error handling and removal procedure,
> which can fix the problem.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>

Looks good to me.
Does this fix any actual issue?
If yes it might we worth to mention it in the commit message.
Helmut


> ---
>  drivers/net/wireless/rt2x00/rt2x00pci.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
> index d93db4b..eb6dbcd 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
> @@ -149,6 +149,7 @@ exit_free_device:
>         ieee80211_free_hw(hw);
>
>  exit_release_regions:
> +       pci_clear_mwi(pci_dev);
>         pci_release_regions(pci_dev);
>
>  exit_disable_device:
> @@ -173,6 +174,7 @@ void rt2x00pci_remove(struct pci_dev *pci_dev)
>         /*
>          * Free the PCI device data.
>          */
> +       pci_clear_mwi(pci_dev);
>         pci_disable_device(pci_dev);
>         pci_release_regions(pci_dev);
>  }
> --
> 1.7.9.5
>
>

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

* Re: [PATCH] rt2x00pci: Disable memory-write-invalidate when the driver exits
  2016-01-04 16:50 ` Helmut Schaa
@ 2016-01-05  1:27   ` Jia-Ju Bai
  2016-01-05 10:17     ` Helmut Schaa
  0 siblings, 1 reply; 5+ messages in thread
From: Jia-Ju Bai @ 2016-01-05  1:27 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: Stanislaw Gruszka, kvalo, linux-wireless, netdev, LKML

On 01/05/2016 12:50 AM, Helmut Schaa wrote:
> On Mon, Jan 4, 2016 at 8:55 AM, Jia-Ju Bai<baijiaju1990@163.com>  wrote:
>> The driver calls pci_set_mwi to enable memory-write-invalidate when it
>> is initialized, but does not call pci_clear_mwi when it is removed. Many
>> other drivers calls pci_clear_mwi when pci_set_mwi is called, such as
>> r8169, 8139cp and e1000.
>>
>> This patch adds pci_clear_mwi in error handling and removal procedure,
>> which can fix the problem.
>>
>> Signed-off-by: Jia-Ju Bai<baijiaju1990@163.com>
> Looks good to me.
> Does this fix any actual issue?
> If yes it might we worth to mention it in the commit message.
> Helmut
>

Lacking pci_clear_mwi may cause a resource-release omission,
but this omission may not cause obvious issues.
For reliability, it is better to add pci_clear_mwi in the driver.
Many other drivers do so, such as r8169, 8139cp and e1000.


Jia-Ju Bai


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

* Re: [PATCH] rt2x00pci: Disable memory-write-invalidate when the driver exits
  2016-01-05  1:27   ` Jia-Ju Bai
@ 2016-01-05 10:17     ` Helmut Schaa
  0 siblings, 0 replies; 5+ messages in thread
From: Helmut Schaa @ 2016-01-05 10:17 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: Stanislaw Gruszka, kvalo, linux-wireless, netdev, LKML

On Tue, Jan 5, 2016 at 2:27 AM, Jia-Ju Bai <baijiaju1990@163.com> wrote:
> On 01/05/2016 12:50 AM, Helmut Schaa wrote:
>>
>> On Mon, Jan 4, 2016 at 8:55 AM, Jia-Ju Bai<baijiaju1990@163.com>  wrote:
>>>
>>> The driver calls pci_set_mwi to enable memory-write-invalidate when it
>>> is initialized, but does not call pci_clear_mwi when it is removed. Many
>>> other drivers calls pci_clear_mwi when pci_set_mwi is called, such as
>>> r8169, 8139cp and e1000.
>>>
>>> This patch adds pci_clear_mwi in error handling and removal procedure,
>>> which can fix the problem.
>>>
>>> Signed-off-by: Jia-Ju Bai<baijiaju1990@163.com>
>>
>> Looks good to me.
>> Does this fix any actual issue?
>> If yes it might we worth to mention it in the commit message.
>> Helmut
>>
>
> Lacking pci_clear_mwi may cause a resource-release omission,
> but this omission may not cause obvious issues.
> For reliability, it is better to add pci_clear_mwi in the driver.
> Many other drivers do so, such as r8169, 8139cp and e1000.

Thanks for clarification, fine with me then.

Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>

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

* Re: rt2x00pci: Disable memory-write-invalidate when the driver exits
  2016-01-04  7:55 [PATCH] rt2x00pci: Disable memory-write-invalidate when the driver exits Jia-Ju Bai
  2016-01-04 16:50 ` Helmut Schaa
@ 2016-01-07  9:23 ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2016-01-07  9:23 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: sgruszka, helmut.schaa, linux-wireless, netdev, linux-kernel, Jia-Ju Bai


> The driver calls pci_set_mwi to enable memory-write-invalidate when it
> is initialized, but does not call pci_clear_mwi when it is removed. Many
> other drivers calls pci_clear_mwi when pci_set_mwi is called, such as
> r8169, 8139cp and e1000.
> 
> This patch adds pci_clear_mwi in error handling and removal procedure, 
> which can fix the problem.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
> Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>

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

Kalle Valo

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

end of thread, other threads:[~2016-01-07  9:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04  7:55 [PATCH] rt2x00pci: Disable memory-write-invalidate when the driver exits Jia-Ju Bai
2016-01-04 16:50 ` Helmut Schaa
2016-01-05  1:27   ` Jia-Ju Bai
2016-01-05 10:17     ` Helmut Schaa
2016-01-07  9:23 ` Kalle Valo

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).