Commit bfd57b59 authored by Richard Cochran's avatar Richard Cochran Committed by David S. Miller

net: netcp_ethss: Use the PHY time stamping interface.

The netcp_ethss driver tests fields of the phy_device in order to
determine whether to defer to the PHY's time stamping functionality.
This patch replaces the open coded logic with an invocation of the
proper methods.
Signed-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7774ee23
...@@ -2533,8 +2533,6 @@ static int gbe_del_vid(void *intf_priv, int vid) ...@@ -2533,8 +2533,6 @@ static int gbe_del_vid(void *intf_priv, int vid)
} }
#if IS_ENABLED(CONFIG_TI_CPTS) #if IS_ENABLED(CONFIG_TI_CPTS)
#define HAS_PHY_TXTSTAMP(p) ((p)->drv && (p)->drv->txtstamp)
#define HAS_PHY_RXTSTAMP(p) ((p)->drv && (p)->drv->rxtstamp)
static void gbe_txtstamp(void *context, struct sk_buff *skb) static void gbe_txtstamp(void *context, struct sk_buff *skb)
{ {
...@@ -2566,7 +2564,7 @@ static int gbe_txtstamp_mark_pkt(struct gbe_intf *gbe_intf, ...@@ -2566,7 +2564,7 @@ static int gbe_txtstamp_mark_pkt(struct gbe_intf *gbe_intf,
* We mark it here because skb_tx_timestamp() is called * We mark it here because skb_tx_timestamp() is called
* after all the txhooks are called. * after all the txhooks are called.
*/ */
if (phydev && HAS_PHY_TXTSTAMP(phydev)) { if (phy_has_txtstamp(phydev)) {
skb_shinfo(p_info->skb)->tx_flags |= SKBTX_IN_PROGRESS; skb_shinfo(p_info->skb)->tx_flags |= SKBTX_IN_PROGRESS;
return 0; return 0;
} }
...@@ -2588,7 +2586,7 @@ static int gbe_rxtstamp(struct gbe_intf *gbe_intf, struct netcp_packet *p_info) ...@@ -2588,7 +2586,7 @@ static int gbe_rxtstamp(struct gbe_intf *gbe_intf, struct netcp_packet *p_info)
if (p_info->rxtstamp_complete) if (p_info->rxtstamp_complete)
return 0; return 0;
if (phydev && HAS_PHY_RXTSTAMP(phydev)) { if (phy_has_rxtstamp(phydev)) {
p_info->rxtstamp_complete = true; p_info->rxtstamp_complete = true;
return 0; return 0;
} }
...@@ -2830,7 +2828,7 @@ static int gbe_ioctl(void *intf_priv, struct ifreq *req, int cmd) ...@@ -2830,7 +2828,7 @@ static int gbe_ioctl(void *intf_priv, struct ifreq *req, int cmd)
struct gbe_intf *gbe_intf = intf_priv; struct gbe_intf *gbe_intf = intf_priv;
struct phy_device *phy = gbe_intf->slave->phy; struct phy_device *phy = gbe_intf->slave->phy;
if (!phy || !phy->drv->hwtstamp) { if (!phy_has_hwtstamp(phy)) {
switch (cmd) { switch (cmd) {
case SIOCGHWTSTAMP: case SIOCGHWTSTAMP:
return gbe_hwtstamp_get(gbe_intf, req); return gbe_hwtstamp_get(gbe_intf, req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment