[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2026011507-sierra-armhole-95be@gregkh>
Date: Thu, 15 Jan 2026 12:24:00 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Minu Jin <s9430939@...er.com>
Cc: ovidiu.panait.oss@...il.com, gshahrouzi@...il.com,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
lkp@...el.com
Subject: Re: [PATCH v2 1/2] staging: axis-fifo: introduce helper functions
for register access
On Thu, Jan 15, 2026 at 11:25:08AM +0900, Minu Jin wrote:
> This patch introduces axis_fifo_read_reg(), axis_fifo_write_reg()
> to wrap raw ioread32, iowrite32 calls. Using these helper functions
> improves code readability and provides a cleaner abstraction for
> hardware register access.
Not really. Normally wrapper functions are not a good idea, why are
they needed here? What is asking for this change?
> All existing single register I/O calls updated to use these
> new helpers. This refactoring also ensures a consistent access
> pattern and makes future maintenance easier.
>
> Signed-off-by: Minu Jin <s9430939@...er.com>
> ---
> v2: No changes.
>
> drivers/staging/axis-fifo/axis-fifo.c | 45 ++++++++++++++++-----------
> 1 file changed, 27 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
> index 509d620d6ce7..525156583c4a 100644
> --- a/drivers/staging/axis-fifo/axis-fifo.c
> +++ b/drivers/staging/axis-fifo/axis-fifo.c
> @@ -145,16 +145,26 @@ struct axis_fifo_debug_reg {
> * ----------------------------
> */
>
> +static inline u32 axis_fifo_read_reg(struct axis_fifo *fifo, int offset)
> +{
> + return ioread32(fifo->base_addr + offset);
> +}
> +
> +static inline void axis_fifo_write_reg(struct axis_fifo *fifo, int offset, u32 val)
> +{
> + iowrite32(val, fifo->base_addr + offset);
> +}
> +
> static void reset_ip_core(struct axis_fifo *fifo)
> {
> - iowrite32(XLLF_SRR_RESET_MASK, fifo->base_addr + XLLF_SRR_OFFSET);
> - iowrite32(XLLF_TDFR_RESET_MASK, fifo->base_addr + XLLF_TDFR_OFFSET);
> - iowrite32(XLLF_RDFR_RESET_MASK, fifo->base_addr + XLLF_RDFR_OFFSET);
> - iowrite32(XLLF_INT_TC_MASK | XLLF_INT_RC_MASK | XLLF_INT_RPURE_MASK |
> + axis_fifo_write_reg(fifo, XLLF_SRR_OFFSET, XLLF_SRR_RESET_MASK);
> + axis_fifo_write_reg(fifo, XLLF_TDFR_OFFSET, XLLF_TDFR_RESET_MASK);
> + axis_fifo_write_reg(fifo, XLLF_RDFR_OFFSET, XLLF_RDFR_RESET_MASK);
> + axis_fifo_write_reg(fifo, XLLF_IER_OFFSET, XLLF_INT_TC_MASK |
> + XLLF_INT_RC_MASK | XLLF_INT_RPURE_MASK |
> XLLF_INT_RPORE_MASK | XLLF_INT_RPUE_MASK |
Odd indentation :(
I don't really see the need for this change, sorry. When reading code,
it's much simpler to see iowrite32() and know what is happening instead
of having to go look up axis_fifo_write_reg() and determine that "hey,
that's just a wrapper for iowrite32()".
thanks,
greg k-h
Powered by blists - more mailing lists