aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/3c509.c70
1 files changed, 23 insertions, 47 deletions
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index 830528dce0ca..dc845f36fe49 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -100,6 +100,10 @@ static int max_interrupt_work = 10;
100static char versionA[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " becker@scyld.com\n"; 100static char versionA[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " becker@scyld.com\n";
101static char versionB[] __initdata = "http://www.scyld.com/network/3c509.html\n"; 101static char versionB[] __initdata = "http://www.scyld.com/network/3c509.html\n";
102 102
103#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA))
104#define EL3_SUSPEND
105#endif
106
103#ifdef EL3_DEBUG 107#ifdef EL3_DEBUG
104static int el3_debug = EL3_DEBUG; 108static int el3_debug = EL3_DEBUG;
105#else 109#else
@@ -174,9 +178,6 @@ struct el3_private {
174 /* skb send-queue */ 178 /* skb send-queue */
175 int head, size; 179 int head, size;
176 struct sk_buff *queue[SKB_QUEUE_SIZE]; 180 struct sk_buff *queue[SKB_QUEUE_SIZE];
177#ifdef CONFIG_PM_LEGACY
178 struct pm_dev *pmdev;
179#endif
180 enum { 181 enum {
181 EL3_MCA, 182 EL3_MCA,
182 EL3_PNP, 183 EL3_PNP,
@@ -201,11 +202,15 @@ static void el3_tx_timeout (struct net_device *dev);
201static void el3_down(struct net_device *dev); 202static void el3_down(struct net_device *dev);
202static void el3_up(struct net_device *dev); 203static void el3_up(struct net_device *dev);
203static struct ethtool_ops ethtool_ops; 204static struct ethtool_ops ethtool_ops;
204#ifdef CONFIG_PM_LEGACY 205#ifdef EL3_SUSPEND
205static int el3_suspend(struct pm_dev *pdev); 206static int el3_suspend(struct device *, pm_message_t);
206static int el3_resume(struct pm_dev *pdev); 207static int el3_resume(struct device *);
207static int el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data); 208#else
209#define el3_suspend NULL
210#define el3_resume NULL
208#endif 211#endif
212
213
209/* generic device remove for all device types */ 214/* generic device remove for all device types */
210#if defined(CONFIG_EISA) || defined(CONFIG_MCA) 215#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
211static int el3_device_remove (struct device *device); 216static int el3_device_remove (struct device *device);
@@ -229,7 +234,9 @@ static struct eisa_driver el3_eisa_driver = {
229 .driver = { 234 .driver = {
230 .name = "3c509", 235 .name = "3c509",
231 .probe = el3_eisa_probe, 236 .probe = el3_eisa_probe,
232 .remove = __devexit_p (el3_device_remove) 237 .remove = __devexit_p (el3_device_remove),
238 .suspend = el3_suspend,
239 .resume = el3_resume,
233 } 240 }
234}; 241};
235#endif 242#endif
@@ -262,6 +269,8 @@ static struct mca_driver el3_mca_driver = {
262 .bus = &mca_bus_type, 269 .bus = &mca_bus_type,
263 .probe = el3_mca_probe, 270 .probe = el3_mca_probe,
264 .remove = __devexit_p(el3_device_remove), 271 .remove = __devexit_p(el3_device_remove),
272 .suspend = el3_suspend,
273 .resume = el3_resume,
265 }, 274 },
266}; 275};
267#endif /* CONFIG_MCA */ 276#endif /* CONFIG_MCA */
@@ -362,10 +371,6 @@ static void el3_common_remove (struct net_device *dev)
362 struct el3_private *lp = netdev_priv(dev); 371 struct el3_private *lp = netdev_priv(dev);
363 372
364 (void) lp; /* Keep gcc quiet... */ 373 (void) lp; /* Keep gcc quiet... */
365#ifdef CONFIG_PM_LEGACY
366 if (lp->pmdev)
367 pm_unregister(lp->pmdev);
368#endif
369#if defined(__ISAPNP__) 374#if defined(__ISAPNP__)
370 if (lp->type == EL3_PNP) 375 if (lp->type == EL3_PNP)
371 pnp_device_detach(to_pnp_dev(lp->dev)); 376 pnp_device_detach(to_pnp_dev(lp->dev));
@@ -572,16 +577,6 @@ no_pnp:
572 if (err) 577 if (err)
573 goto out1; 578 goto out1;
574 579
575#ifdef CONFIG_PM_LEGACY
576 /* register power management */
577 lp->pmdev = pm_register(PM_ISA_DEV, card_idx, el3_pm_callback);
578 if (lp->pmdev) {
579 struct pm_dev *p;
580 p = lp->pmdev;
581 p->data = (struct net_device *)dev;
582 }
583#endif
584
585 el3_cards++; 580 el3_cards++;
586 lp->next_dev = el3_root_dev; 581 lp->next_dev = el3_root_dev;
587 el3_root_dev = dev; 582 el3_root_dev = dev;
@@ -1480,20 +1475,17 @@ el3_up(struct net_device *dev)
1480} 1475}
1481 1476
1482/* Power Management support functions */ 1477/* Power Management support functions */
1483#ifdef CONFIG_PM_LEGACY 1478#ifdef EL3_SUSPEND
1484 1479
1485static int 1480static int
1486el3_suspend(struct pm_dev *pdev) 1481el3_suspend(struct device *pdev, pm_message_t state)
1487{ 1482{
1488 unsigned long flags; 1483 unsigned long flags;
1489 struct net_device *dev; 1484 struct net_device *dev;
1490 struct el3_private *lp; 1485 struct el3_private *lp;
1491 int ioaddr; 1486 int ioaddr;
1492 1487
1493 if (!pdev && !pdev->data) 1488 dev = pdev->driver_data;
1494 return -EINVAL;
1495
1496 dev = (struct net_device *)pdev->data;
1497 lp = netdev_priv(dev); 1489 lp = netdev_priv(dev);
1498 ioaddr = dev->base_addr; 1490 ioaddr = dev->base_addr;
1499 1491
@@ -1510,17 +1502,14 @@ el3_suspend(struct pm_dev *pdev)
1510} 1502}
1511 1503
1512static int 1504static int
1513el3_resume(struct pm_dev *pdev) 1505el3_resume(struct device *pdev)
1514{ 1506{
1515 unsigned long flags; 1507 unsigned long flags;
1516 struct net_device *dev; 1508 struct net_device *dev;
1517 struct el3_private *lp; 1509 struct el3_private *lp;
1518 int ioaddr; 1510 int ioaddr;
1519 1511
1520 if (!pdev && !pdev->data) 1512 dev = pdev->driver_data;
1521 return -EINVAL;
1522
1523 dev = (struct net_device *)pdev->data;
1524 lp = netdev_priv(dev); 1513 lp = netdev_priv(dev);
1525 ioaddr = dev->base_addr; 1514 ioaddr = dev->base_addr;
1526 1515
@@ -1536,20 +1525,7 @@ el3_resume(struct pm_dev *pdev)
1536 return 0; 1525 return 0;
1537} 1526}
1538 1527
1539static int 1528#endif /* EL3_SUSPEND */
1540el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data)
1541{
1542 switch (rqst) {
1543 case PM_SUSPEND:
1544 return el3_suspend(pdev);
1545
1546 case PM_RESUME:
1547 return el3_resume(pdev);
1548 }
1549 return 0;
1550}
1551
1552#endif /* CONFIG_PM_LEGACY */
1553 1529
1554/* Parameters that may be passed into the module. */ 1530/* Parameters that may be passed into the module. */
1555static int debug = -1; 1531static int debug = -1;