netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-xtensa@linux-xtensa.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Chris Zankel <chris@zankel.net>, Marc Gauthier <marc@cadence.com>,
	"David S. Miller" <davem@davemloft.net>,
	Ben Hutchings <ben@decadent.org.uk>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH v2 1/4] phy: provide accessors for 'advertising' and 'supported' fields
Date: Wed, 29 Jan 2014 10:00:15 +0400	[thread overview]
Message-ID: <1390975218-13863-2-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1390975218-13863-1-git-send-email-jcmvbkbc@gmail.com>

Many network drivers directly modify phy_device::advertising and
phy_device::supported. Provide accessors to these fields to better
isolate phylib from its users.

Suggested-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1->v2:
- new patch

 include/linux/phy.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index 48a4dc3..2ae58f8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -559,6 +559,18 @@ static inline int phy_read_status(struct phy_device *phydev) {
 	return phydev->drv->read_status(phydev);
 }
 
+static inline void phy_update_advert(struct phy_device *phydev, u32 clear,
+				     u32 set)
+{
+	phydev->advertising = (phydev->advertising & ~clear) | set;
+}
+
+static inline void phy_update_supported(struct phy_device *phydev, u32 clear,
+					u32 set)
+{
+	phydev->supported = (phydev->supported & ~clear) | set;
+}
+
 int genphy_setup_forced(struct phy_device *phydev);
 int genphy_restart_aneg(struct phy_device *phydev);
 int genphy_config_aneg(struct phy_device *phydev);
-- 
1.8.1.4

  reply	other threads:[~2014-01-29  6:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29  6:00 [PATCH v2 0/4] Max Filippov
2014-01-29  6:00 ` Max Filippov [this message]
2014-01-29 17:14   ` [PATCH v2 1/4] phy: provide accessors for 'advertising' and 'supported' fields Florian Fainelli
2014-01-29  6:00 ` [PATCH v2 2/4] net: ethoc: don't advertise gigabit speed on attached PHY Max Filippov
2014-01-29  6:47   ` Florian Fainelli
2014-01-29  7:01     ` Max Filippov
     [not found]       ` <CAGVrzcboHp8-qHZseGOVm14u1-cTcOjRZGExFxNu_nbK__XCSA@mail.gmail.com>
2014-01-29 18:32         ` Max Filippov
2014-01-31  6:07           ` Max Filippov
2014-02-01  0:40             ` Florian Fainelli
2014-02-01  0:54               ` Florian Fainelli
2014-02-01  1:10                 ` Max Filippov
2014-02-01  1:36                   ` Florian Fainelli
2014-01-29  6:00 ` [PATCH v2 3/4] net: ethoc: set up MII management bus clock Max Filippov
2014-01-29  7:01   ` Florian Fainelli
2014-01-30  0:14     ` Max Filippov
2014-01-29  6:00 ` [PATCH v2 4/4] net: ethoc: implement ethtool operations Max Filippov
2014-01-29  6:52   ` Florian Fainelli
2014-01-30  1:59   ` Ben Hutchings
2014-01-30  3:04     ` Max Filippov
2014-01-30 14:04       ` Ben Hutchings

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=1390975218-13863-2-git-send-email-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=ben@decadent.org.uk \
    --cc=chris@zankel.net \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=marc@cadence.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 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).