Re: [PATCH net-next v2 1/2] net: macb: Enable PTP unicast

From: Jakub Kicinski
Date: Thu Mar 23 2023 - 01:24:11 EST


On Tue, 21 Mar 2023 18:10:04 +0530 Harini Katakam wrote:
> +#ifdef CONFIG_MACB_USE_HWSTAMP
> + if (gem_has_ptp(bp)) {
> + gem_writel(bp, RXPTPUNI, bottom);
> + gem_writel(bp, TXPTPUNI, bottom);
> + }
> +#endif

You can use the same IS_ENABLED() trick here as you used in the if ()
below, to avoid the direct preprocessor use. In fact why not just
add the IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) to the condition inside
gem_has_ptp() ? It looks like all callers want that extra check.

> + if (IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) && gem_has_ptp(bp))
> + ctrl |= MACB_BIT(PTPUNI);