netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Francois Romieu <romieu@fr.zoreil.com>,
	Edward Hsu <edward_hsu@realtek.com.tw>
Cc: "David S. Miller" <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: [PATCH 1/2] r8169: allow rtl_hw_phy_config() and rtl8169_init_phy() to return error codes
Date: Sun, 01 Nov 2009 22:51:04 +0000	[thread overview]
Message-ID: <1257115864.3136.338.camel@localhost> (raw)
In-Reply-To: <1257115687.3136.337.camel@localhost>

[-- Attachment #1: Type: text/plain, Size: 2247 bytes --]

This is preparation for loading PHY firmware, which may fail.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
This one belongs before the other.  Sorry about sending them in the
wrong order.

Ben.

 drivers/net/r8169.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index f98ef52..8ceecd0 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2607,7 +2607,7 @@ static void rtl8102e_hw_phy_config(void __iomem *ioaddr)
 	rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
 }
 
-static void rtl_hw_phy_config(struct net_device *dev)
+static int rtl_hw_phy_config(struct net_device *dev)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
 	void __iomem *ioaddr = tp->mmio_addr;
@@ -2676,6 +2676,8 @@ static void rtl_hw_phy_config(struct net_device *dev)
 	default:
 		break;
 	}
+
+	return 0;
 }
 
 static void rtl8169_phy_timer(unsigned long __opaque)
@@ -2780,11 +2782,14 @@ static void rtl8169_phy_reset(struct net_device *dev,
 		printk(KERN_ERR "%s: PHY reset failed.\n", dev->name);
 }
 
-static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
+static int rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 {
 	void __iomem *ioaddr = tp->mmio_addr;
+	int rc;
 
-	rtl_hw_phy_config(dev);
+	rc = rtl_hw_phy_config(dev);
+	if (rc)
+		return rc;
 
 	if (tp->mac_version <= RTL_GIGA_MAC_VER_06) {
 		dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
@@ -2813,6 +2818,8 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 
 	if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
 		printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
+
+	return 0;
 }
 
 static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
@@ -3199,7 +3206,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		       dev->dev_addr[4], dev->dev_addr[5], xid, dev->irq);
 	}
 
-	rtl8169_init_phy(dev, tp);
+	rc = rtl8169_init_phy(dev, tp);
+	if (rc)
+		goto err_out_msi_5;
 
 	/*
 	 * Pretend we are using VLANs; This bypasses a nasty bug where
-- 
1.6.5.2




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2009-11-01 22:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-01 22:48 [PATCH] r8169: remove firmware for RTL8169D PHY Ben Hutchings
2009-11-01 22:51 ` Ben Hutchings [this message]
2009-11-02  6:47 ` David Miller

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=1257115864.3136.338.camel@localhost \
    --to=ben@decadent.org.uk \
    --cc=davem@davemloft.net \
    --cc=edward_hsu@realtek.com.tw \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /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;
as well as URLs for NNTP newsgroup(s).