Skip to content

Commit

Permalink
micrel: Use generic ptp_msg_is_sync() function
Browse files Browse the repository at this point in the history
Use generic ptp_msg_is_sync() function to avoid code duplication.

Signed-off-by: Kurt Kanzenbach <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
shifty91 authored and davem330 committed Mar 7, 2022
1 parent 1246b22 commit 3914a9c
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions drivers/net/phy/micrel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1976,25 +1976,14 @@ static int lan8814_hwtstamp(struct mii_timestamper *mii_ts, struct ifreq *ifr)
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? -EFAULT : 0;
}

static bool is_sync(struct sk_buff *skb, int type)
{
struct ptp_header *hdr;

hdr = ptp_parse_header(skb, type);
if (!hdr)
return false;

return ((ptp_get_msgtype(hdr, type) & 0xf) == 0);
}

static void lan8814_txtstamp(struct mii_timestamper *mii_ts,
struct sk_buff *skb, int type)
{
struct kszphy_ptp_priv *ptp_priv = container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);

switch (ptp_priv->hwts_tx_type) {
case HWTSTAMP_TX_ONESTEP_SYNC:
if (is_sync(skb, type)) {
if (ptp_msg_is_sync(skb, type)) {
kfree_skb(skb);
return;
}
Expand Down

0 comments on commit 3914a9c

Please sign in to comment.