Message ID | 20220305112127.68529-4-kurt@linutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 3914a9c07e8c3a30f178f1c92e2354b9cffdecb5 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ptp: Add generic is_sync() function | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 25 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
> -----Original Message----- > From: Kurt Kanzenbach <kurt@linutronix.de> > Sent: Saturday, March 5, 2022 4:51 PM > To: Richard Cochran <richardcochran@gmail.com>; David S. Miller > <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org> > Cc: Andrew Lunn <andrew@lunn.ch>; Heiner Kallweit > <hkallweit1@gmail.com>; Russell King <linux@armlinux.org.uk>; Yonghong > Song <yhs@fb.com>; Daniel Borkmann <daniel@iogearbox.net>; Andrii > Nakryiko <andrii@kernel.org>; Divya Koppera - I30481 > <Divya.Koppera@microchip.com>; Horatiu Vultur - M31836 > <Horatiu.Vultur@microchip.com>; netdev@vger.kernel.org; Kurt Kanzenbach > <kurt@linutronix.de> > Subject: [PATCH net-next 3/3] micrel: Use generic ptp_msg_is_sync() function > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the > content is safe > > Use generic ptp_msg_is_sync() function to avoid code duplication. > > Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> > --- > drivers/net/phy/micrel.c | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index > 81a76322254c..9e6b29b23935 100644 > --- a/drivers/net/phy/micrel.c > +++ b/drivers/net/phy/micrel.c > @@ -1976,17 +1976,6 @@ 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) { @@ -1994,7 +1983,7 @@ static > void lan8814_txtstamp(struct mii_timestamper *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; > } > -- > 2.30.2 For the patch: Tested-and-reviewed-by: Divya Koppera <Divya.Koppera@microchip.com>
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 81a76322254c..9e6b29b23935 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1976,17 +1976,6 @@ 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) { @@ -1994,7 +1983,7 @@ static void lan8814_txtstamp(struct mii_timestamper *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; }
Use generic ptp_msg_is_sync() function to avoid code duplication. Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> --- drivers/net/phy/micrel.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)