Re: [PATCH 16/20] e1000: Add functions for register polling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 17, 2016 at 07:52:37PM -0800, Andrey Smirnov wrote:
> Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
> ---
>  drivers/net/e1000/e1000.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
> index 291e64d..5e24758 100644
> --- a/drivers/net/e1000/e1000.h
> +++ b/drivers/net/e1000/e1000.h
> @@ -2176,5 +2176,24 @@ static inline uint32_t e1000_read_reg(struct e1000_hw *hw, uint32_t reg)
>  }
> 
> 
> +static inline int e1000_poll_reg(struct e1000_hw *hw, uint32_t reg,
> +				 uint32_t mask, uint32_t value,
> +				 uint64_t timeout)

We should let the compiler decide whether to inline this or not. Can we
remove the inline?

> +{
> +	const uint64_t start = get_time_ns();
> +
> +	do {
> +		const uint32_t v = e1000_read_reg(hw, reg);
> +
> +		if ((v & mask) == value)
> +			return 0;
> +
> +	} while (!is_timeout(start, timeout));
> +
> +	return -ETIMEDOUT;
> +}
> +
> +#define E1000_POLL_REG(a, reg, mask, value, timeout)	\
> +	e1000_poll_reg((a), E1000_##reg, (mask), (value), (timeout))

Can we drop this define? All it does is to put E1000_ in front of the
register name which could also be done by the caller.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux