Skip to content

Commit

Permalink
net: ptp: clock: Create a dummy inline func for net_eth_get_ptp_clock()
Browse files Browse the repository at this point in the history
Follow the style in other similar functions in this file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information
jukkar committed Jun 25, 2019
1 parent a506aa3 commit def6b14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 9 additions & 0 deletions include/net/ethernet.h
Expand Up @@ -671,7 +671,16 @@ int net_eth_promisc_mode(struct net_if *iface, bool enable);
* @return Pointer to PTP clock if found, NULL if not found or if this
* ethernet interface does not support PTP.
*/
#if defined(CONFIG_PTP_CLOCK)
struct device *net_eth_get_ptp_clock(struct net_if *iface);
#else
static inline struct device *net_eth_get_ptp_clock(struct net_if *iface)
{
ARG_UNUSED(iface);

return NULL;
}
#endif

/**
* @brief Return gPTP port number attached to this interface.
Expand Down
6 changes: 2 additions & 4 deletions subsys/net/l2/ethernet/ethernet.c
Expand Up @@ -965,9 +965,9 @@ void net_eth_carrier_off(struct net_if *iface)
handle_carrier(ctx, iface, carrier_off);
}

#if defined(CONFIG_PTP_CLOCK)
struct device *net_eth_get_ptp_clock(struct net_if *iface)
{
#if defined(CONFIG_PTP_CLOCK)
struct device *dev = net_if_get_device(iface);
const struct ethernet_api *api = dev->driver_api;

Expand All @@ -984,10 +984,8 @@ struct device *net_eth_get_ptp_clock(struct net_if *iface)
}

return api->get_ptp_clock(net_if_get_device(iface));
#else
return NULL;
#endif
}
#endif /* CONFIG_PTP_CLOCK */

#if defined(CONFIG_NET_GPTP)
int net_eth_get_ptp_port(struct net_if *iface)
Expand Down

0 comments on commit def6b14

Please sign in to comment.