linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/MSI: Simplify default_restore_msi_irq()
@ 2014-09-11  1:30 Yijing Wang
  2014-09-23 18:24 ` Bjorn Helgaas
  0 siblings, 1 reply; 3+ messages in thread
From: Yijing Wang @ 2014-09-11  1:30 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, Konrad Rzeszutek Wilk, Yijing Wang

Both MSI and MSI-X irq will be associate to msi_desc,
Use irq_get_msi_desc() to get the msi_desc for MSI-X
to simplify code. Also use __write_msi_msg() instead
of write_msi_msg() to avoid the redundant calls.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/msi.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 5a40516..9ad920a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -119,18 +119,9 @@ static void default_restore_msi_irq(struct pci_dev *dev, int irq)
 {
 	struct msi_desc *entry;
 
-	entry = NULL;
-	if (dev->msix_enabled) {
-		list_for_each_entry(entry, &dev->msi_list, list) {
-			if (irq == entry->irq)
-				break;
-		}
-	} else if (dev->msi_enabled)  {
-		entry = irq_get_msi_desc(irq);
-	}
-
+	entry = irq_get_msi_desc(irq);
 	if (entry)
-		write_msi_msg(irq, &entry->msg);
+		__write_msi_msg(entry, &entry->msg);
 }
 
 void __weak arch_restore_msi_irqs(struct pci_dev *dev)
-- 
1.7.1


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

* Re: [PATCH] PCI/MSI: Simplify default_restore_msi_irq()
  2014-09-11  1:30 [PATCH] PCI/MSI: Simplify default_restore_msi_irq() Yijing Wang
@ 2014-09-23 18:24 ` Bjorn Helgaas
  2014-09-24  3:15   ` Yijing Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2014-09-23 18:24 UTC (permalink / raw)
  To: Yijing Wang; +Cc: linux-pci, Konrad Rzeszutek Wilk

On Thu, Sep 11, 2014 at 09:30:55AM +0800, Yijing Wang wrote:
> Both MSI and MSI-X irq will be associate to msi_desc,
> Use irq_get_msi_desc() to get the msi_desc for MSI-X
> to simplify code. Also use __write_msi_msg() instead
> of write_msi_msg() to avoid the redundant calls.

Again, this should mention exactly where the MSI and MSI-X IRQs are
associated with the msi_desc.

> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>  drivers/pci/msi.c |   13 ++-----------
>  1 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 5a40516..9ad920a 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -119,18 +119,9 @@ static void default_restore_msi_irq(struct pci_dev *dev, int irq)
>  {
>  	struct msi_desc *entry;
>  
> -	entry = NULL;
> -	if (dev->msix_enabled) {
> -		list_for_each_entry(entry, &dev->msi_list, list) {
> -			if (irq == entry->irq)
> -				break;
> -		}
> -	} else if (dev->msi_enabled)  {
> -		entry = irq_get_msi_desc(irq);
> -	}
> -
> +	entry = irq_get_msi_desc(irq);
>  	if (entry)
> -		write_msi_msg(irq, &entry->msg);
> +		__write_msi_msg(entry, &entry->msg);
>  }
>  
>  void __weak arch_restore_msi_irqs(struct pci_dev *dev)
> -- 
> 1.7.1
> 

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

* Re: [PATCH] PCI/MSI: Simplify default_restore_msi_irq()
  2014-09-23 18:24 ` Bjorn Helgaas
@ 2014-09-24  3:15   ` Yijing Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Yijing Wang @ 2014-09-24  3:15 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, Konrad Rzeszutek Wilk

On 2014/9/24 2:24, Bjorn Helgaas wrote:
> On Thu, Sep 11, 2014 at 09:30:55AM +0800, Yijing Wang wrote:
>> Both MSI and MSI-X irq will be associate to msi_desc,
>> Use irq_get_msi_desc() to get the msi_desc for MSI-X
>> to simplify code. Also use __write_msi_msg() instead
>> of write_msi_msg() to avoid the redundant calls.
> 
> Again, this should mention exactly where the MSI and MSI-X IRQs are
> associated with the msi_desc.

As mentioned in another mail, ARCH MSI code call irq_set_msi_desc() regardless of MSI or MSI-X type.

So I think use irq_get_msi_desc() for MSI-X is ok .

Thanks!
Yijing.

> 
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>  drivers/pci/msi.c |   13 ++-----------
>>  1 files changed, 2 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
>> index 5a40516..9ad920a 100644
>> --- a/drivers/pci/msi.c
>> +++ b/drivers/pci/msi.c
>> @@ -119,18 +119,9 @@ static void default_restore_msi_irq(struct pci_dev *dev, int irq)
>>  {
>>  	struct msi_desc *entry;
>>  
>> -	entry = NULL;
>> -	if (dev->msix_enabled) {
>> -		list_for_each_entry(entry, &dev->msi_list, list) {
>> -			if (irq == entry->irq)
>> -				break;
>> -		}
>> -	} else if (dev->msi_enabled)  {
>> -		entry = irq_get_msi_desc(irq);
>> -	}
>> -
>> +	entry = irq_get_msi_desc(irq);
>>  	if (entry)
>> -		write_msi_msg(irq, &entry->msg);
>> +		__write_msi_msg(entry, &entry->msg);
>>  }
>>  
>>  void __weak arch_restore_msi_irqs(struct pci_dev *dev)
>> -- 
>> 1.7.1
>>
> 
> 


-- 
Thanks!
Yijing


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

end of thread, other threads:[~2014-09-24  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11  1:30 [PATCH] PCI/MSI: Simplify default_restore_msi_irq() Yijing Wang
2014-09-23 18:24 ` Bjorn Helgaas
2014-09-24  3:15   ` Yijing Wang

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