All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: John Linville <linville@tuxdriver.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH] b44-ssb: Powerup the bus before using the device.
Date: Tue, 14 Aug 2007 20:15:53 +0200	[thread overview]
Message-ID: <200708142015.53926.mb@bu3sch.de> (raw)

We must turn on buspower before poking with the device

Signed-off-by: Michael Buesch <mb@bu3sch.de>

Index: wireless-dev-new/drivers/net/b44.c
===================================================================
--- wireless-dev-new.orig/drivers/net/b44.c	2007-08-11 00:45:55.000000000 +0200
+++ wireless-dev-new/drivers/net/b44.c	2007-08-12 22:18:34.000000000 +0200
@@ -2154,17 +2154,23 @@ static int __devinit b44_init_one(struct
 
 	netif_carrier_off(dev);
 
+	err = ssb_bus_powerup(sdev->bus, 0);
+	if (err) {
+		dev_err(sdev->dev,
+			"Failed to powerup the bus\n");
+		goto err_out_free_dev;
+	}
 	err = ssb_dma_set_mask(sdev, DMA_30BIT_MASK);
 	if (err) {
 		dev_err(sdev->dev,
 			"Required 30BIT DMA mask unsupported by the system.\n");
-		goto err_out_free_dev;
+		goto err_out_powerdown;
 	}
 	err = b44_get_invariants(bp);
 	if (err) {
 		dev_err(sdev->dev,
 			"Problem fetching invariants of chip, aborting.\n");
-		goto err_out_free_dev;
+		goto err_out_powerdown;
 	}
 
 	bp->mii_if.dev = dev;
@@ -2184,7 +2190,7 @@ static int __devinit b44_init_one(struct
 	err = register_netdev(dev);
 	if (err) {
 		dev_err(sdev->dev, "Cannot register net device, aborting.\n");
-		goto out;
+		goto err_out_powerdown;
 	}
 
 	ssb_set_drvdata(sdev, dev);
@@ -2201,6 +2207,9 @@ static int __devinit b44_init_one(struct
 
 	return 0;
 
+err_out_powerdown:
+	ssb_bus_may_powerdown(sdev->bus);
+
 err_out_free_dev:
 	free_netdev(dev);
 
@@ -2208,13 +2217,14 @@ out:
 	return err;
 }
 
-static void __devexit b44_remove_one(struct ssb_device *pdev)
+static void __devexit b44_remove_one(struct ssb_device *sdev)
 {
-	struct net_device *dev = ssb_get_drvdata(pdev);
+	struct net_device *dev = ssb_get_drvdata(sdev);
 
 	unregister_netdev(dev);
+	ssb_bus_may_powerdown(sdev->bus);
 	free_netdev(dev);
-	ssb_set_drvdata(pdev, NULL);
+	ssb_set_drvdata(sdev, NULL);
 }
 
 static int b44_suspend(struct ssb_device *sdev, pm_message_t state)
@@ -2251,6 +2261,13 @@ static int b44_resume(struct ssb_device 
 	struct b44 *bp = netdev_priv(dev);
 	int rc = 0;
 
+	rc = ssb_bus_powerup(sdev->bus, 0);
+	if (rc) {
+		dev_err(sdev->dev,
+			"Failed to powerup the bus\n");
+		return rc;
+	}
+
 	if (!netif_running(dev))
 		return 0;
 

                 reply	other threads:[~2007-08-14 18:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200708142015.53926.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=linville@tuxdriver.com \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.