From: Joe Perches <joe@perches.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH 1/3] msi vector targeting abstractions
Date: Thu, 12 Jan 2006 16:55:15 +0000 [thread overview]
Message-ID: <1137084916.9940.30.camel@localhost> (raw)
In-Reply-To: <20051222171621.8240.71918.22618@lnx-maule.americas.sgi.com>
On Thu, 2006-01-12 at 00:33 -0700, Grant Grundler wrote:
> On Thu, Jan 12, 2006 at 04:47:27PM +1100, Paul Mackerras wrote:
> > Grant Grundler writes:
> > > > + if ((status = msi_arch_init()) < 0) {
> > > Willy told me I should always complain about assignment in if() statements :)
> > We are getting incredibly politically correct these days, aren't we.
> I'm not asking greg to reject the patch nor dictating Mark Mauler change it.
> Since greg is willing to accept a patch to "fix" it, I'm willing to provide
> the patch in this case. I think that's fairly normal way to clean things up.
(me too)
Here's a patch for drivers/pci
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 202b750..257dbbe 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -103,9 +103,9 @@ static void set_msi_affinity(unsigned in
switch (entry->msi_attrib.type) {
case PCI_CAP_ID_MSI:
{
- int pos;
+ int pos = pci_find_capability(entry->dev, PCI_CAP_ID_MSI);
- if (!(pos = pci_find_capability(entry->dev, PCI_CAP_ID_MSI)))
+ if (!pos)
return;
pci_read_config_dword(entry->dev, msi_lower_address_reg(pos),
@@ -345,9 +345,9 @@ static int assign_msi_vector(void)
static int get_new_vector(void)
{
- int vector;
+ int vector = assign_msi_vector();
- if ((vector = assign_msi_vector()) > 0)
+ if (vector > 0)
set_intr_gate(vector, interrupt[vector]);
return vector;
@@ -367,7 +367,8 @@ static int msi_init(void)
return status;
}
- if ((status = msi_cache_init()) < 0) {
+ status = msi_cache_init();
+ if (status < 0) {
pci_msi_enable = 0;
printk(KERN_WARNING "PCI: MSI cache init failed\n");
return status;
@@ -519,10 +520,12 @@ static int msi_capability_init(struct pc
pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
pci_read_config_word(dev, msi_control_reg(pos), &control);
/* MSI Entry Initialization */
- if (!(entry = alloc_msi_entry()))
+ entry = alloc_msi_entry();
+ if (!entry)
return -ENOMEM;
- if ((vector = get_msi_vector(dev)) < 0) {
+ vector = get_msi_vector(dev);
+ if (vector < 0) {
kmem_cache_free(msi_cachep, entry);
return -EBUSY;
}
@@ -616,7 +619,8 @@ static int msix_capability_init(struct p
entry = alloc_msi_entry();
if (!entry)
break;
- if ((vector = get_msi_vector(dev)) < 0)
+ vector = get_msi_vector(dev);
+ if (vector < 0)
break;
j = entries[i].entry;
@@ -697,10 +701,12 @@ int pci_enable_msi(struct pci_dev* dev)
temp = dev->irq;
- if ((status = msi_init()) < 0)
+ status = msi_init();
+ if (status < 0)
return status;
- if (!(pos = pci_find_capability(dev, PCI_CAP_ID_MSI)))
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
+ if (!pos)
return -EINVAL;
pci_read_config_word(dev, msi_control_reg(pos), &control);
@@ -724,7 +730,8 @@ int pci_enable_msi(struct pci_dev* dev)
dev->irq = temp;
}
/* Check whether driver already requested for MSI-X vectors */
- if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)) > 0 &&
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+ if (pos > 0 &&
!msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) {
printk(KERN_INFO "PCI: %s: Can't enable MSI. "
"Device already has MSI-X vectors assigned\n",
@@ -751,7 +758,10 @@ void pci_disable_msi(struct pci_dev* dev
u16 control;
unsigned long flags;
- if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSI)))
+ if (!dev)
+ return;
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
+ if (!pos)
return;
pci_read_config_word(dev, msi_control_reg(pos), &control);
@@ -920,10 +930,12 @@ int pci_enable_msix(struct pci_dev* dev,
if (!pci_msi_enable || !dev || !entries)
return -EINVAL;
- if ((status = msi_init()) < 0)
+ status = msi_init();
+ if (status < 0)
return status;
- if (!(pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)))
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+ if (!pos)
return -EINVAL;
pci_read_config_word(dev, msi_control_reg(pos), &control);
@@ -1002,7 +1014,11 @@ void pci_disable_msix(struct pci_dev* de
int pos, temp;
u16 control;
- if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)))
+ if (!dev)
+ return;
+
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+ if (!pos)
return;
pci_read_config_word(dev, msi_control_reg(pos), &control);
@@ -1062,7 +1078,8 @@ void msi_remove_pci_irq_vectors(struct p
return;
temp = dev->irq; /* Save IOAPIC IRQ */
- if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSI)) > 0 &&
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
+ if (pos > 0 &&
!msi_lookup_vector(dev, PCI_CAP_ID_MSI)) {
spin_lock_irqsave(&msi_lock, flags);
state = msi_desc[dev->irq]->msi_attrib.state;
@@ -1076,7 +1093,8 @@ void msi_remove_pci_irq_vectors(struct p
msi_free_vector(dev, dev->irq, 0);
dev->irq = temp; /* Restore IOAPIC IRQ */
}
- if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)) > 0 &&
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+ if (pos > 0 &&
!msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) {
int vector, head, tail = 0, warning = 0;
void __iomem *base = NULL;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d2a633e..b6e3381 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -493,9 +493,8 @@ pci_enable_device_bars(struct pci_dev *d
int
pci_enable_device(struct pci_dev *dev)
{
- int err;
-
- if ((err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1)))
+ int err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
+ if (err)
return err;
pci_fixup_device(pci_fixup_enable, dev);
dev->is_enabled = 1;
next prev parent reply other threads:[~2006-01-12 16:55 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-22 17:15 [PATCH 0/3] msi abstractions and support for altix Mark Maule
2005-12-22 17:15 ` [PATCH 1/3] msi vector targeting abstractions Mark Maule
2005-12-22 19:58 ` Greg KH
2005-12-22 20:09 ` Mark Maule
2005-12-22 20:19 ` Greg KH
2006-01-12 16:55 ` Joe Perches [this message]
2006-01-12 17:17 ` Greg KH
2006-01-14 7:34 ` Grant Grundler
2005-12-22 17:15 ` [PATCH 2/3] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2005-12-22 20:01 ` Greg KH
2005-12-22 20:06 ` Mark Maule
2005-12-22 17:15 ` [PATCH 2/3] altix: msi support Mark Maule
2005-12-22 20:15 ` [PATCH 0/3] msi abstractions and support for altix Mark Maule
2005-12-22 20:15 ` [PATCH 1/3] msi vector targeting abstractions Mark Maule
2006-01-03 22:39 ` Grant Grundler
2006-01-03 23:50 ` Mark Maule
2006-01-04 0:20 ` Grant Grundler
2006-01-04 0:27 ` Greg KH
2006-01-04 3:52 ` Mark Maule
2005-12-22 20:15 ` [PATCH 2/3] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2006-01-04 0:01 ` Grant Grundler
2005-12-22 20:16 ` [PATCH 2/3] altix: msi support Mark Maule
2005-12-22 20:22 ` [PATCH 0/3] msi abstractions and support for altix Greg KH
2005-12-22 20:26 ` Mark Maule
2005-12-22 20:34 ` Greg KH
2005-12-22 20:38 ` Mark Maule
2005-12-22 20:50 ` Matthew Wilcox
2006-01-03 3:22 ` Mark Maule
2006-01-03 6:07 ` Greg KH
2006-01-10 17:00 ` Mark Maule
2006-01-10 17:03 ` Christoph Hellwig
2006-01-10 17:11 ` Greg KH
2005-12-22 21:44 ` Greg KH
2005-12-23 15:32 ` Mark Maule
2005-12-23 16:32 ` Greg KH
2006-01-11 15:52 ` Mark Maule
2006-01-11 15:52 ` [PATCH 1/3] msi vector targeting abstractions Mark Maule
2006-01-11 20:21 ` Greg KH
2006-01-11 20:49 ` Mark Maule
2006-01-11 20:57 ` Greg KH
2006-01-12 4:53 ` Grant Grundler
2006-01-12 5:36 ` Greg KH
2006-01-12 5:47 ` Paul Mackerras
2006-01-12 7:33 ` Grant Grundler
2006-01-11 15:53 ` [PATCH 2/3] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2006-01-11 15:53 ` [PATCH 2/3] altix: msi support Mark Maule
2006-01-11 22:16 ` [PATCH 0/3] msi abstractions and support for altix Mark Maule
2006-01-11 22:16 ` [PATCH 1/3] msi vector targeting abstractions Mark Maule
2006-01-11 22:16 ` [PATCH 2/3] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2006-01-11 22:16 ` [PATCH 3/3] altix: msi support Mark Maule
2006-01-19 19:46 ` [PATCH 0/3] msi abstractions and support for altix Mark Maule
2006-01-19 19:46 ` [PATCH 1/3] msi vector targeting abstractions Mark Maule
2006-01-20 2:15 ` Greg KH
2006-01-19 19:46 ` [PATCH 2/3] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2006-01-19 19:47 ` [PATCH 3/3] altix: msi support Mark Maule
2006-02-04 4:14 ` Altix SN2 2.6.16-rc1-mm5 build breakage (was: msi support) Paul Jackson
2006-02-04 4:25 ` Andrew Morton
2006-02-04 4:27 ` Andrew Morton
2006-02-04 4:42 ` Mark Maule
2006-02-04 5:08 ` Andrew Morton
2006-02-23 0:50 ` Paul Jackson
2006-02-23 1:01 ` Andrew Morton
2006-03-21 14:34 ` [PATCH 0/3] msi abstractions and support for altix Mark Maule
2006-03-21 14:34 ` [PATCH 1/3] msi vector targeting abstractions Mark Maule
2006-03-21 16:29 ` Jun'ichi Nomura
2006-03-21 16:38 ` Andreas Schwab
2006-03-21 19:14 ` Mark Maule
2006-03-21 19:23 ` Jun'ichi Nomura
2006-03-21 19:38 ` Mark Maule
2006-03-21 14:34 ` [PATCH 2/3] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2006-03-21 14:34 ` [PATCH 3/3] altix: msi support Mark Maule
2006-03-21 21:53 ` [PATCH 0/3] msi abstractions and support for altix David S. Miller
2006-03-29 2:31 ` Mark Maule
2006-03-29 2:31 ` [PATCH 1/3] msi vector targeting abstractions Mark Maule
2006-03-29 2:31 ` [PATCH 2/3] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2006-03-29 2:31 ` [PATCH 3/3] altix: msi support Mark Maule
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1137084916.9940.30.camel@localhost \
--to=joe@perches.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox