netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netdev: fix compile issues for !CONFIG_PCI in 3c59x
@ 2012-03-26  1:11 Paul Gortmaker
  2012-03-26 13:38 ` Paul Gortmaker
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2012-03-26  1:11 UTC (permalink / raw)
  To: klassert; +Cc: netdev, linux-mips, Paul Gortmaker

I hate to add in more #ifdef CONFIG_PCI but there are already
quite a few in this driver, and it seems like it hasn't been
built with CONFIG_PCI set to off in quite some time.  The
MIPS allmodconfig (ISA/EISA based) doesn't set CONFIG_PCI
and that is why we are here looking at this, even though any
modern platform has had PCI since 1995 or so.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index e463d10..36ad150 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -999,6 +999,7 @@ static int __init vortex_eisa_init(void)
 	return vortex_cards_found - orig_cards_found + eisa_found;
 }
 
+#ifdef CONFIG_PCI
 /* returns count (>= 0), or negative on error */
 static int __devinit vortex_init_one(struct pci_dev *pdev,
 				      const struct pci_device_id *ent)
@@ -1045,6 +1046,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
 out:
 	return rc;
 }
+#endif
 
 static const struct net_device_ops boomrang_netdev_ops = {
 	.ndo_open		= vortex_open,
@@ -1177,6 +1179,7 @@ static int __devinit vortex_probe1(struct device *gendev,
 		compaq_net_device = dev;
 	}
 
+#ifdef CONFIG_PCI
 	/* PCI-only startup logic */
 	if (pdev) {
 		/* EISA resources already marked, so only PCI needs to do this here */
@@ -1204,6 +1207,7 @@ static int __devinit vortex_probe1(struct device *gendev,
 			}
 		}
 	}
+#endif
 
 	spin_lock_init(&vp->lock);
 	spin_lock_init(&vp->mii_lock);
@@ -1321,7 +1325,7 @@ static int __devinit vortex_probe1(struct device *gendev,
 			step, (eeprom[4]>>5) & 15, eeprom[4] & 31, eeprom[4]>>9);
 	}
 
-
+#ifdef CONFIG_PCI
 	if (pdev && vci->drv_flags & HAS_CB_FNS) {
 		unsigned short n;
 
@@ -1348,6 +1352,7 @@ static int __devinit vortex_probe1(struct device *gendev,
 			window_write16(vp, 0x0800, 0, 0);
 		}
 	}
+#endif
 
 	/* Extract our information from the EEPROM data. */
 	vp->info1 = eeprom[13];
@@ -3222,6 +3227,7 @@ static void acpi_set_WOL(struct net_device *dev)
 }
 
 
+#ifdef CONFIG_PCI
 static void __devexit vortex_remove_one(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
@@ -3269,6 +3275,7 @@ static struct pci_driver vortex_driver = {
 	.id_table	= vortex_pci_tbl,
 	.driver.pm	= VORTEX_PM_OPS,
 };
+#endif
 
 
 static int vortex_have_pci;
@@ -3277,9 +3284,13 @@ static int vortex_have_eisa;
 
 static int __init vortex_init(void)
 {
-	int pci_rc, eisa_rc;
+	int eisa_rc;
+#ifdef CONFIG_PCI
+	int pci_rc = pci_register_driver(&vortex_driver);
+#else
+	int pci_rc = -ENODEV;
+#endif
 
-	pci_rc = pci_register_driver(&vortex_driver);
 	eisa_rc = vortex_eisa_init();
 
 	if (pci_rc == 0)
@@ -3318,8 +3329,10 @@ static void __exit vortex_eisa_cleanup(void)
 
 static void __exit vortex_cleanup(void)
 {
+#ifdef CONFIG_PCI
 	if (vortex_have_pci)
 		pci_unregister_driver(&vortex_driver);
+#endif
 	if (vortex_have_eisa)
 		vortex_eisa_cleanup();
 }
-- 
1.7.9.4

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

* Re: [PATCH] netdev: fix compile issues for !CONFIG_PCI in 3c59x
  2012-03-26  1:11 [PATCH] netdev: fix compile issues for !CONFIG_PCI in 3c59x Paul Gortmaker
@ 2012-03-26 13:38 ` Paul Gortmaker
  2012-03-26 14:55   ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2012-03-26 13:38 UTC (permalink / raw)
  To: klassert; +Cc: netdev, linux-mips, Paul Gortmaker

On Sun, Mar 25, 2012 at 9:11 PM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> I hate to add in more #ifdef CONFIG_PCI but there are already
> quite a few in this driver, and it seems like it hasn't been
> built with CONFIG_PCI set to off in quite some time.

Actually, please scrap this patch.  The uglyness of more ifdefs
made me look at it again.  It should be do-able in a cleaner way
with stubs, and it appears this may even be similar to an old fail
from the past:

http://lkml.indiana.edu/hypermail/linux/kernel/1107.3/00109.html

I'll dig into it some more and follow up.

Thanks,
Paul.

> The
> MIPS allmodconfig (ISA/EISA based) doesn't set CONFIG_PCI
> and that is why we are here looking at this, even though any
> modern platform has had PCI since 1995 or so.
>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>
> diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
> index e463d10..36ad150 100644
> --- a/drivers/net/ethernet/3com/3c59x.c
> +++ b/drivers/net/ethernet/3com/3c59x.c
> @@ -999,6 +999,7 @@ static int __init vortex_eisa_init(void)
>        return vortex_cards_found - orig_cards_found + eisa_found;
>  }
>
> +#ifdef CONFIG_PCI
>  /* returns count (>= 0), or negative on error */
>  static int __devinit vortex_init_one(struct pci_dev *pdev,
>                                      const struct pci_device_id *ent)
> @@ -1045,6 +1046,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
>  out:
>        return rc;
>  }
> +#endif
>
>  static const struct net_device_ops boomrang_netdev_ops = {
>        .ndo_open               = vortex_open,
> @@ -1177,6 +1179,7 @@ static int __devinit vortex_probe1(struct device *gendev,
>                compaq_net_device = dev;
>        }
>
> +#ifdef CONFIG_PCI
>        /* PCI-only startup logic */
>        if (pdev) {
>                /* EISA resources already marked, so only PCI needs to do this here */
> @@ -1204,6 +1207,7 @@ static int __devinit vortex_probe1(struct device *gendev,
>                        }
>                }
>        }
> +#endif
>
>        spin_lock_init(&vp->lock);
>        spin_lock_init(&vp->mii_lock);
> @@ -1321,7 +1325,7 @@ static int __devinit vortex_probe1(struct device *gendev,
>                        step, (eeprom[4]>>5) & 15, eeprom[4] & 31, eeprom[4]>>9);
>        }
>
> -
> +#ifdef CONFIG_PCI
>        if (pdev && vci->drv_flags & HAS_CB_FNS) {
>                unsigned short n;
>
> @@ -1348,6 +1352,7 @@ static int __devinit vortex_probe1(struct device *gendev,
>                        window_write16(vp, 0x0800, 0, 0);
>                }
>        }
> +#endif
>
>        /* Extract our information from the EEPROM data. */
>        vp->info1 = eeprom[13];
> @@ -3222,6 +3227,7 @@ static void acpi_set_WOL(struct net_device *dev)
>  }
>
>
> +#ifdef CONFIG_PCI
>  static void __devexit vortex_remove_one(struct pci_dev *pdev)
>  {
>        struct net_device *dev = pci_get_drvdata(pdev);
> @@ -3269,6 +3275,7 @@ static struct pci_driver vortex_driver = {
>        .id_table       = vortex_pci_tbl,
>        .driver.pm      = VORTEX_PM_OPS,
>  };
> +#endif
>
>
>  static int vortex_have_pci;
> @@ -3277,9 +3284,13 @@ static int vortex_have_eisa;
>
>  static int __init vortex_init(void)
>  {
> -       int pci_rc, eisa_rc;
> +       int eisa_rc;
> +#ifdef CONFIG_PCI
> +       int pci_rc = pci_register_driver(&vortex_driver);
> +#else
> +       int pci_rc = -ENODEV;
> +#endif
>
> -       pci_rc = pci_register_driver(&vortex_driver);
>        eisa_rc = vortex_eisa_init();
>
>        if (pci_rc == 0)
> @@ -3318,8 +3329,10 @@ static void __exit vortex_eisa_cleanup(void)
>
>  static void __exit vortex_cleanup(void)
>  {
> +#ifdef CONFIG_PCI
>        if (vortex_have_pci)
>                pci_unregister_driver(&vortex_driver);
> +#endif
>        if (vortex_have_eisa)
>                vortex_eisa_cleanup();
>  }
> --
> 1.7.9.4
>
>

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

* Re: [PATCH] netdev: fix compile issues for !CONFIG_PCI in 3c59x
  2012-03-26 13:38 ` Paul Gortmaker
@ 2012-03-26 14:55   ` Sergei Shtylyov
  2012-03-26 15:38     ` Paul Gortmaker
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2012-03-26 14:55 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: klassert, netdev, linux-mips, Paul Gortmaker

Hello.

On 03/26/2012 05:38 PM, Paul Gortmaker wrote:

>> I hate to add in more #ifdef CONFIG_PCI but there are already
>> quite a few in this driver, and it seems like it hasn't been
>> built with CONFIG_PCI set to off in quite some time.

> Actually, please scrap this patch.  The uglyness of more ifdefs
> made me look at it again.  It should be do-able in a cleaner way
> with stubs, and it appears this may even be similar to an old fail
> from the past:

> http://lkml.indiana.edu/hypermail/linux/kernel/1107.3/00109.html

    Also, see this patch:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0da0ead90122578ef6e4afba9ba4bcd3455fd8e8

    The driver patch this was done for is still in the -mm tree after all these 
years.:-)

> I'll dig into it some more and follow up.

    I thought I addressed all issues with compilation of this driver with 
CONFIG_PCI=n. Apparently not, and some seem to have accumulated over time...

> Thanks,
> Paul.

WBR, Sergei

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

* Re: [PATCH] netdev: fix compile issues for !CONFIG_PCI in 3c59x
  2012-03-26 14:55   ` Sergei Shtylyov
@ 2012-03-26 15:38     ` Paul Gortmaker
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Gortmaker @ 2012-03-26 15:38 UTC (permalink / raw)
  To: Sergei Shtylyov, James Bottomley, Randy Dunlap
  Cc: Paul Gortmaker, klassert, netdev, linux-mips

On 12-03-26 10:55 AM, Sergei Shtylyov wrote:
> Hello.
> 
> On 03/26/2012 05:38 PM, Paul Gortmaker wrote:
> 
>>> I hate to add in more #ifdef CONFIG_PCI but there are already
>>> quite a few in this driver, and it seems like it hasn't been
>>> built with CONFIG_PCI set to off in quite some time.
> 
>> Actually, please scrap this patch.  The uglyness of more ifdefs
>> made me look at it again.  It should be do-able in a cleaner way
>> with stubs, and it appears this may even be similar to an old fail
>> from the past:
> 
>> http://lkml.indiana.edu/hypermail/linux/kernel/1107.3/00109.html
> 
>     Also, see this patch:
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0da0ead90122578ef6e4afba9ba4bcd3455fd8e8
> 
>     The driver patch this was done for is still in the -mm tree after all these 
> years.:-)
> 
>> I'll dig into it some more and follow up.
> 
>     I thought I addressed all issues with compilation of this driver with 
> CONFIG_PCI=n. Apparently not, and some seem to have accumulated over time...

I got sidetracked working on other things, but I did manage to
learn this so far - It turns out that Randy fixed it and then
James un-fixed it in this commit:

commit 97a29d59fc222b36bac3ee3a8ae994f65bf7ffdf
Author: James Bottomley <James.Bottomley@HansenPartnership.com>
Date:   Mon Jan 30 10:40:47 2012 -0600

    [PARISC] fix compile break caused by iomap: make IOPORT/PCI mapping functions conditional

Reverting the above and mips builds 3c59x just fine.  Note that MIPS
allmodconfig does not have either CONFIG_GENERIC_IOMAP or the other
CONFIG_GENERIC_PCI_IOMAP options.

Paul.
--

> 
>> Thanks,
>> Paul.
> 
> WBR, Sergei

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

end of thread, other threads:[~2012-03-26 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-26  1:11 [PATCH] netdev: fix compile issues for !CONFIG_PCI in 3c59x Paul Gortmaker
2012-03-26 13:38 ` Paul Gortmaker
2012-03-26 14:55   ` Sergei Shtylyov
2012-03-26 15:38     ` Paul Gortmaker

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