netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
	andrew+netdev@lunn.ch, netdev@vger.kernel.org,
	Karol Kolacinski <karol.kolacinski@intel.com>,
	jacob.e.keller@intel.com, przemyslaw.kitszel@intel.com,
	richardcochran@gmail.com, Michal Kubiak <michal.kubiak@intel.com>,
	Milena Olech <milena.olech@intel.com>,
	Rinitha S <sx.rinitha@intel.com>
Subject: Re: [PATCH net-next 07/15] ice: add ICE_READ/WRITE_CGU_REG_OR_DIE helpers
Date: Sat, 21 Jun 2025 08:23:21 -0700	[thread overview]
Message-ID: <20250621082321.724b65dd@kernel.org> (raw)
In-Reply-To: <20250618174231.3100231-8-anthony.l.nguyen@intel.com>

On Wed, 18 Jun 2025 10:42:19 -0700 Tony Nguyen wrote:
> +#define ICE_READ_CGU_REG_OR_DIE(hw, addr, val)                     \
> +	do {                                                       \
> +		int __err = ice_read_cgu_reg((hw), (addr), (val)); \
> +								   \
> +		if (__err)                                         \
> +			return __err;                              \
> +	} while (0)
>  int ice_write_cgu_reg(struct ice_hw *hw, u32 addr, u32 val);
> +#define ICE_WRITE_CGU_REG_OR_DIE(hw, addr, val)                     \
> +	do {                                                        \
> +		int __err = ice_write_cgu_reg((hw), (addr), (val)); \
> +								    \
> +		if (__err)                                          \
> +			return __err;                               \
> +	} while (0)

Quoting documentation:

  12) Macros, Enums and RTL
  -------------------------
  
[...]

  Things to avoid when using macros:
  
  1) macros that affect control flow:
  
  .. code-block:: c
  
  	#define FOO(x)					\
  		do {					\
  			if (blah(x) < 0)		\
  				return -EBUGGERED;	\
  		} while (0)
  
  is a **very** bad idea.  It looks like a function call but exits the ``calling``
  function; don't break the internal parsers of those who will read the code.
  
See: https://www.kernel.org/doc/html/next/process/coding-style.html#macros-enums-and-rtl

  reply	other threads:[~2025-06-21 15:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 17:42 [PATCH net-next 00/15][pull request] ice: Separate TSPLL from PTP and clean up Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 01/15] ice: move TSPLL functions to a separate file Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 02/15] ice: rename TSPLL and CGU functions and definitions Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 03/15] ice: fix E825-C TSPLL register definitions Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 04/15] ice: remove ice_tspll_params_e825 definitions Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 05/15] ice: use designated initializers for TSPLL consts Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 06/15] ice: add TSPLL log config helper Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 07/15] ice: add ICE_READ/WRITE_CGU_REG_OR_DIE helpers Tony Nguyen
2025-06-21 15:23   ` Jakub Kicinski [this message]
2025-06-23 23:43     ` Jacob Keller
2025-06-18 17:42 ` [PATCH net-next 08/15] ice: clear time_sync_en field for E825-C during reprogramming Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 09/15] ice: read TSPLL registers again before reporting status Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 10/15] ice: use bitfields instead of unions for CGU regs Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 11/15] ice: add multiple TSPLL helpers Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 12/15] ice: wait before enabling TSPLL Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 13/15] ice: fall back to TCXO on TSPLL lock fail Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 14/15] ice: move TSPLL init calls to ice_ptp.c Tony Nguyen
2025-06-18 17:42 ` [PATCH net-next 15/15] ice: default to TIME_REF instead of TXCO on E825-C Tony Nguyen
2025-06-21 15:23 ` [PATCH net-next 00/15][pull request] ice: Separate TSPLL from PTP and clean up Jakub Kicinski
2025-06-21 15:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250621082321.724b65dd@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=karol.kolacinski@intel.com \
    --cc=michal.kubiak@intel.com \
    --cc=milena.olech@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=richardcochran@gmail.com \
    --cc=sx.rinitha@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).