public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Einon <mark.einon@gmail.com>
To: gregkh@suse.de
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	o.hartmann@telovital.com, Mark Einon <mark.einon@gmail.com>
Subject: [PATCH 02/12] staging: et131x: Remove private adapter->duplex_mode and use phydev->duplex instead
Date: Sun,  4 Sep 2011 11:24:33 +0100	[thread overview]
Message-ID: <1315131883-11068-3-git-send-email-mark.einon@gmail.com> (raw)
In-Reply-To: <1315131883-11068-1-git-send-email-mark.einon@gmail.com>

The phy device keeps a note of the duplex mode, so use that value instead of duplex mode.

Also use the phydev defines for duplex modes, and remove the driver private ones.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_mac.c     |    8 +++++---
 drivers/staging/et131x/et1310_phy.c     |    4 ----
 drivers/staging/et131x/et1310_phy.h     |    4 ----
 drivers/staging/et131x/et131x_adapter.h |    1 -
 4 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index efabc03..08d7691 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -205,11 +205,11 @@ void et1310_config_mac_regs2(struct et131x_adapter *adapter)
 	cfg2 &= ~0x0021;
 
 	/* Turn on duplex if needed */
-	if (adapter->duplex_mode)
+	if (phydev && phydev->duplex == DUPLEX_FULL)
 		cfg2 |= 0x01;
 
 	ifctrl &= ~(1 << 26);
-	if (!adapter->duplex_mode)
+	if (phydev && phydev->duplex == DUPLEX_HALF)
 		ifctrl |= (1<<26);	/* Enable ghd */
 
 	writel(ifctrl, &mac->if_ctrl);
@@ -450,7 +450,9 @@ void et1310_config_macstat_regs(struct et131x_adapter *adapter)
 
 void et1310_config_flow_control(struct et131x_adapter *adapter)
 {
-	if (adapter->duplex_mode == 0) {
+	struct phy_device *phydev = adapter->phydev;
+
+	if (phydev->duplex == DUPLEX_HALF) {
 		adapter->flowcontrol = FLOW_NONE;
 	} else {
 		char remote_pause, remote_async_pause;
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index c5d0d02..41f0afa 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -477,8 +477,6 @@ void et131x_mii_check(struct et131x_adapter *adapter,
 
 			netif_carrier_off(adapter->netdev);
 
-			adapter->duplex_mode = 0;
-
 			/* Free the packets being actively sent & stopped */
 			et131x_free_busy_send_packets(adapter);
 
@@ -516,8 +514,6 @@ void et131x_mii_check(struct et131x_adapter *adapter,
 					     &speed, &duplex, &mdi_mdix,
 					     &masterslave, &polarity);
 
-			adapter->duplex_mode = duplex;
-
 			adapter->boot_coma = 20;
 
 			if (phydev && phydev->speed == SPEED_10) {
diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h
index 3e95c66..d996e8e 100644
--- a/drivers/staging/et131x/et1310_phy.h
+++ b/drivers/staging/et131x/et1310_phy.h
@@ -242,10 +242,6 @@ struct mi_regs {
 #define TRUEPHY_MASK                    2
 #endif
 
-/* Define duplex modes */
-#define TRUEPHY_DUPLEX_HALF             0
-#define TRUEPHY_DUPLEX_FULL             1
-
 /* Define master/slave configuration values */
 #define TRUEPHY_CFG_SLAVE               0
 #define TRUEPHY_CFG_MASTER              1
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 1e65e79..a63f376 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -169,7 +169,6 @@ struct et131x_adapter {
 
 	/* Packet Filter and look ahead size */
 	u32 packet_filter;
-	u32 duplex_mode;
 
 	/* multicast list */
 	u32 multicast_addr_count;
-- 
1.7.6


  parent reply	other threads:[~2011-09-04 10:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-04 10:24 [PATCH 00/12] staging: et131x: Following mvoe to use phydev, remove detritus Mark Einon
2011-09-04 10:24 ` [PATCH 01/12] staging: et131x: Remove private adapter->linkspeed and use phydev->speed instead Mark Einon
2011-09-04 10:24 ` Mark Einon [this message]
2011-09-04 10:24 ` [PATCH 03/12] staging: et131x: Remove redundant struct adapter members Mark Einon
2011-09-04 10:24 ` [PATCH 04/12] staging: et131x: Remove PHY interrupt handling code from driver isr handler Mark Einon
2011-09-04 10:24 ` [PATCH 05/12] staging: et131x: remove calls to netif_carrier_[on|off] from et131x_mii_check Mark Einon
2011-09-04 10:24 ` [PATCH 06/12] staging: et131x: Remove registry_rx_mem_end from struct et131x_adapter Mark Einon
2011-09-04 10:24 ` [PATCH 07/12] staging: et131x: Remove cached_mask_value from et131x_adapter Mark Einon
2011-09-04 10:24 ` [PATCH 08/12] staging: et131x: Remove duplicated register defines from et1310_phy.h Mark Einon
2011-09-04 10:24 ` [PATCH 09/12] staging: et131x: Replace magic numbers in et1310_phy.c with defines Mark Einon
2011-09-04 10:24 ` [PATCH 10/12] staging: et131x: Remove struct mi_regs from et1310_phy.h Mark Einon
2011-09-04 10:24 ` [PATCH 11/12] staging: et131x: Remove ai_force_[duplex|speed] from et131x_adapter Mark Einon
2011-09-04 10:24 ` [PATCH 12/12] staging: et131x: Update README file Mark Einon

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=1315131883-11068-3-git-send-email-mark.einon@gmail.com \
    --to=mark.einon@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.hartmann@telovital.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