netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bnx2x: Fix compilation when CONFIG_PCI_IOV is not defined
@ 2013-01-02 13:36 Ariel Elior
  2013-01-03  2:47 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ariel Elior @ 2013-01-02 13:36 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, eilong, Ariel Elior

This patch ifdefs out the use of PCI_IOV_RESOURCES which exists in the
kernel only when CONFIG_PCI_IOV is defined. There is no point in doing
the same for the invocation of SRIOV functionality in the driver as it
will be immediately failed by a kernel which was thus compiled.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 71fcef0..2142839 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -1792,6 +1792,7 @@ static int bnx2x_vf_devfn(struct bnx2x *bp, int vfid)
 
 static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf)
 {
+#ifdef CONFIG_PCI_IOV
 	int i, n;
 	struct pci_dev *dev = bp->pdev;
 	struct bnx2x_sriov *iov = &bp->vfdb->sriov;
@@ -1804,6 +1805,7 @@ static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf)
 		vf->bars[n].bar = start + size * vf->abs_vfid;
 		vf->bars[n].size = size;
 	}
+#endif /* CONFIG_PCI_IOV */
 }
 
 static int bnx2x_ari_enabled(struct pci_dev *dev)
-- 
1.7.9.GIT

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

* Re: [PATCH net-next] bnx2x: Fix compilation when CONFIG_PCI_IOV is not defined
  2013-01-02 13:36 [PATCH net-next] bnx2x: Fix compilation when CONFIG_PCI_IOV is not defined Ariel Elior
@ 2013-01-03  2:47 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-01-03  2:47 UTC (permalink / raw)
  To: ariele; +Cc: netdev, eilong

From: "Ariel Elior" <ariele@broadcom.com>
Date: Wed, 2 Jan 2013 15:36:25 +0200

> This patch ifdefs out the use of PCI_IOV_RESOURCES which exists in the
> kernel only when CONFIG_PCI_IOV is defined. There is no point in doing
> the same for the invocation of SRIOV functionality in the driver as it
> will be immediately failed by a kernel which was thus compiled.
> 
> Signed-off-by: Ariel Elior <ariele@broadcom.com>

This fixes the build but this is a very disappointing patch.

None of your SR-IOV support can possibly work if CONFIG_PCI_IOV
is not set.

Look at how the SFC driver has a special Kconfig option and elides
all of it's SR-IOV code when that Kconfig option is not set.

That kind of Kconfig option is where you express the CONFIG_PCI_IOV
dependency, rather than in a hackish way with ifdefs as a knee-jerk
response to a build failure reports.

I'm not applying this patch, segregate your driver properly and use
Kconfig dependencies to elide the building of all of the SR-IOV
support code in this driver.

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

end of thread, other threads:[~2013-01-03  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-02 13:36 [PATCH net-next] bnx2x: Fix compilation when CONFIG_PCI_IOV is not defined Ariel Elior
2013-01-03  2:47 ` David Miller

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