From: Stephen Hemminger <shemminger@vyatta•com>
To: David Miller <davem@davemloft•net>
Cc: netdev@vger•kernel.org, Mike McCormack <mikem@ring3k•org>
Subject: [PATCH 07/10] sky2: Refactor sky2_up into two functions
Date: Fri, 12 Feb 2010 08:58:04 -0800 [thread overview]
Message-ID: <20100212165938.003565152@vyatta.com> (raw)
In-Reply-To: 20100212165757.767062851@vyatta.com
[-- Attachment #1: sky2-mike3.patch --]
[-- Type: text/plain, Size: 2194 bytes --]
From: Mike McCormack <mikem@ring3k•org>
Move hardware initialization into sky2_hw_up.
Signed-off-by: Mike McCormack <mikem@ring3k•org>
Acked-by: Stephen Hemminger <shemminger@vyatta•com>
---
drivers/net/sky2.c | 41 +++++++++++++++++++++++++----------------
1 files changed, 25 insertions(+), 16 deletions(-)
--- a/drivers/net/sky2.c 2010-02-11 15:33:40.351545123 -0800
+++ b/drivers/net/sky2.c 2010-02-11 15:33:44.579670361 -0800
@@ -1525,16 +1525,16 @@ static void sky2_free_buffers(struct sky
sky2->rx_ring = NULL;
}
-/* Bring up network interface. */
-static int sky2_up(struct net_device *dev)
+static void sky2_hw_up(struct sky2_port *sky2)
{
- struct sky2_port *sky2 = netdev_priv(dev);
struct sky2_hw *hw = sky2->hw;
unsigned port = sky2->port;
- u32 imask, ramsize;
- int cap, err;
+ u32 ramsize;
+ int cap;
struct net_device *otherdev = hw->dev[sky2->port^1];
+ tx_init(sky2);
+
/*
* On dual port PCI-X card, there is an problem where status
* can be received out of order due to split transactions
@@ -1546,16 +1546,7 @@ static int sky2_up(struct net_device *de
cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
cmd &= ~PCI_X_CMD_MAX_SPLIT;
sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
-
- }
-
- netif_carrier_off(dev);
-
- err = sky2_alloc_buffers(sky2);
- if (err)
- goto err_out;
-
- tx_init(sky2);
+ }
sky2_mac_init(hw, port);
@@ -1564,7 +1555,7 @@ static int sky2_up(struct net_device *de
if (ramsize > 0) {
u32 rxspace;
- pr_debug(PFX "%s: ram buffer %dK\n", dev->name, ramsize);
+ pr_debug(PFX "%s: ram buffer %dK\n", sky2->netdev->name, ramsize);
if (ramsize < 16)
rxspace = ramsize / 2;
else
@@ -1597,6 +1588,24 @@ static int sky2_up(struct net_device *de
#endif
sky2_rx_start(sky2);
+}
+
+/* Bring up network interface. */
+static int sky2_up(struct net_device *dev)
+{
+ struct sky2_port *sky2 = netdev_priv(dev);
+ struct sky2_hw *hw = sky2->hw;
+ unsigned port = sky2->port;
+ u32 imask;
+ int err;
+
+ netif_carrier_off(dev);
+
+ err = sky2_alloc_buffers(sky2);
+ if (err)
+ goto err_out;
+
+ sky2_hw_up(sky2);
/* Enable interrupts from phy/mac for port */
imask = sky2_read32(hw, B0_IMSK);
--
next prev parent reply other threads:[~2010-02-12 17:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-12 16:57 [PATCH 00/10] sky2 update for net-next Stephen Hemminger
2010-02-12 16:57 ` [PATCH 01/10] sky2: fix sparse warning Stephen Hemminger
2010-02-12 16:57 ` [PATCH 02/10] sky2: WoL changes Stephen Hemminger
2010-02-12 16:58 ` [PATCH 03/10] sky2: dont enable PME legacy mode Stephen Hemminger
2010-02-12 16:58 ` [PATCH 04/10] sky2: jumbo packet changes Stephen Hemminger
2010-02-12 16:58 ` [PATCH 05/10] sky2: Factor out code to calculate packet sizes Stephen Hemminger
2010-02-12 16:58 ` [PATCH 06/10] sky2: Allocate initial skbs in sky2_alloc_buffers Stephen Hemminger
2010-02-12 16:58 ` Stephen Hemminger [this message]
2010-02-12 16:58 ` [PATCH 08/10] sky2: Refactor sky2_down into two functions Stephen Hemminger
2010-02-12 16:58 ` [PATCH 09/10] sky2: Avoid down and up during sky2_reset Stephen Hemminger
2010-02-12 16:58 ` [PATCH 10/10] sky2: version 1.27 Stephen Hemminger
2010-02-13 0:21 ` [PATCH 00/10] sky2 update for net-next 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=20100212165938.003565152@vyatta.com \
--to=shemminger@vyatta$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=mikem@ring3k$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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