On Mon, Jan 21, 2019 at 02:53:53PM +0000, Igor Russkikh wrote:
> From: Nikita Danilov <[email protected]>
>
> David noticed this define was hiding 'err' variable
> reference. Thats confusing and counterintuitive.
>
> Adding err argument explicitly for better visibility
> that err is changed inside macro.
>
> Signed-off-by: Nikita Danilov <[email protected]>
> Signed-off-by: Igor Russkikh <[email protected]>
> ---
> .../ethernet/aquantia/atlantic/aq_hw_utils.h | 4 ++--
> .../aquantia/atlantic/hw_atl/hw_atl_a0.c | 8 ++++----
> .../aquantia/atlantic/hw_atl/hw_atl_b0.c | 4 ++--
> .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 18 +++++++++---------
> .../atlantic/hw_atl/hw_atl_utils_fw2x.c | 10 +++++-----
> 5 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
> b/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
> index dc88a1221f1d..ca1d20d64a39 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
> @@ -23,7 +23,7 @@
>
> #define AQ_HW_SLEEP(_US_) mdelay(_US_)
>
> -#define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \
> +#define AQ_HW_WAIT_FOR(_B_, _US_, _N_, _err_) \
> do { \
> unsigned int AQ_HW_WAIT_FOR_i; \
> for (AQ_HW_WAIT_FOR_i = _N_; (!(_B_)) && (AQ_HW_WAIT_FOR_i);\
> @@ -31,7 +31,7 @@ do { \
> udelay(_US_); \
> } \
> if (!AQ_HW_WAIT_FOR_i) {\
> - err = -ETIME; \
> + *(_err_) = -ETIME; \
> } \
> } while (0)
Hi Igor
How about throwing this horrible macro away and using one of the
readx_poll_timeout() variants.
Andrew