Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@linux.it>
To: linux-mips@linux-mips.org
Subject: Re: au1000_lowlevel_probe on au1000_eth.c
Date: Tue, 27 Jun 2006 17:59:14 +0200	[thread overview]
Message-ID: <20060627155914.GD10595@enneenne.com> (raw)
In-Reply-To: <20060626221441.GA10595@enneenne.com>


[-- Attachment #1.1: Type: text/plain, Size: 566 bytes --]

On Tue, Jun 27, 2006 at 12:14:41AM +0200, Rodolfo Giometti wrote:
> 
> I notice that during sleep/wakeup au1000_lowlevel_probe() tries to
> access to variables arcs_cmdline,prom_envp & Co.. This sometime does
> an oops.

Here my proposal to avoid oops during wake up.

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

[-- Attachment #1.2: patch-au1000_eth-pm-bugfix --]
[-- Type: text/plain, Size: 3434 bytes --]

diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 341fdc4..c49004a 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -84,7 +84,7 @@ MODULE_LICENSE("GPL");
 // prototypes
 static void hard_stop(struct net_device *);
 static void enable_rx_tx(struct net_device *dev);
-static int au1000_lowlevel_probe(struct net_device *ndev, void *ioaddr, void *macen_addr, int port_num);
+static int au1000_lowlevel_probe(struct net_device *ndev, void *ioaddr, void *macen_addr, int port_num, int skip_prom);
 static void au1000_lowlevel_remove(struct net_device *ndev);
 static int au1000_init(struct net_device *);
 static int au1000_open(struct net_device *);
@@ -1393,7 +1393,7 @@ static struct ethtool_ops au1000_ethtool
 };
 
 static int 
-au1000_lowlevel_probe(struct net_device *ndev, void *ioaddr, void *macen_addr, int port_num)
+au1000_lowlevel_probe(struct net_device *ndev, void *ioaddr, void *macen_addr, int port_num, int skip_prom)
 {
 	struct au1000_private *aup = ndev->priv;
 	db_dest_t *pDB, *pDBfree;
@@ -1419,24 +1419,25 @@ au1000_lowlevel_probe(struct net_device 
 	/* Setup some variables for quick register address access */
 	if (port_num == 0)
 	{
-		/* check env variables first */
-		if (!get_ethernet_addr(ethaddr)) { 
-			memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
-		} else {
-			/* Check command line */
-			argptr = prom_getcmdline();
-			if ((pmac = strstr(argptr, "ethaddr=")) == NULL) {
-				printk(KERN_INFO "%s: No mac address found\n", 
-						ndev->name);
-				/* use the hard coded mac addresses */
+		if (!skip_prom) {
+			/* check env variables first */
+			if (!get_ethernet_addr(ethaddr)) { 
+				memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
 			} else {
-				str2eaddr(ethaddr, pmac + strlen("ethaddr="));
-				memcpy(au1000_mac_addr, ethaddr, 
-						sizeof(au1000_mac_addr));
+				/* Check command line */
+				argptr = prom_getcmdline();
+				if ((pmac = strstr(argptr, "ethaddr=")) == NULL) {
+					printk(KERN_INFO "%s: No mac address found\n", 
+							ndev->name);
+					/* use the hard coded mac addresses */
+				} else {
+					str2eaddr(ethaddr, pmac + strlen("ethaddr="));
+					memcpy(au1000_mac_addr, ethaddr, 
+							sizeof(au1000_mac_addr));
+				}
 			}
 		}
-			aup->enable = (volatile u32 *) 
-				((unsigned long) macen_addr);
+		aup->enable = (volatile u32 *) ((unsigned long) macen_addr);
 		memcpy(ndev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
 		setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
 		aup->mac_id = 0;
@@ -2196,7 +2197,7 @@ static int au1000_drv_probe(struct devic
 
 	/* Force the device name to a know state... */
 	sprintf(ndev->name, "au1xxx_eth(%d)", pdev->id);
-	ret = au1000_lowlevel_probe(ndev, base_addr, macen_addr, pdev->id);
+	ret = au1000_lowlevel_probe(ndev, base_addr, macen_addr, pdev->id, 0);
 	if (ret < 0) {
 		printk (KERN_ERR "%s: low level probe failed\n", DRV_NAME);  
 		goto out_free_netdev;
@@ -2304,7 +2305,7 @@ static int au1000_drv_resume(struct devi
 	if (!ndev)
 		return 0;
 
-	ret = au1000_lowlevel_probe(ndev, (void *) aup->mac, (void *) aup->enable, aup->mac_id);
+	ret = au1000_lowlevel_probe(ndev, (void *) aup->mac, (void *) aup->enable, aup->mac_id, ~0);
 	if (ret < 0) {
 		printk (KERN_ERR "%s: low level probe failed\n", DRV_NAME);  
 		return ret;

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2006-06-27 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 22:14 au1000_lowlevel_probe on au1000_eth.c Rodolfo Giometti
2006-06-27  6:36 ` Ulrich Eckhardt
2006-06-27  7:34   ` Rodolfo Giometti
2006-06-27 15:59 ` Rodolfo Giometti [this message]
2006-06-29 15:03   ` Sergei Shtylyov
2006-06-29 15:11     ` Rodolfo Giometti
2006-07-02 19:22       ` Sergei Shtylyov

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=20060627155914.GD10595@enneenne.com \
    --to=giometti@linux.it \
    --cc=linux-mips@linux-mips.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