[PATCH 6/7] ocxl: afu_irq only deals with IRQ IDs, not offsets

Alastair D'Silva alastair at au1.ibm.com
Wed Mar 20 11:28:43 AEDT 2019


On Fri, 2019-03-15 at 14:56 +0100, Greg Kurz wrote:
> On Wed, 13 Mar 2019 15:15:21 +1100
> "Alastair D'Silva" <alastair at au1.ibm.com> wrote:
> 
> > From: Alastair D'Silva <alastair at d-silva.org>
> > 
> > The use of offsets is required only in the frontend, so alter
> > the IRQ API to only work with IRQ IDs in the backend.
> > 
> > Signed-off-by: Alastair D'Silva <alastair at d-silva.org>
> > ---
> >  drivers/misc/ocxl/afu_irq.c       | 31 +++++++++++++------------
> > ------
> >  drivers/misc/ocxl/context.c       |  7 +++++--
> >  drivers/misc/ocxl/file.c          | 13 ++++++++-----
> >  drivers/misc/ocxl/ocxl_internal.h | 10 ++++++----
> >  drivers/misc/ocxl/trace.h         | 12 ++++--------
> >  5 files changed, 36 insertions(+), 37 deletions(-)
> > 
> > diff --git a/drivers/misc/ocxl/afu_irq.c
> > b/drivers/misc/ocxl/afu_irq.c
> > index 11ab996657a2..1885c472df58 100644
> > --- a/drivers/misc/ocxl/afu_irq.c
> > +++ b/drivers/misc/ocxl/afu_irq.c
> > @@ -14,14 +14,14 @@ struct afu_irq {
> >  	struct eventfd_ctx *ev_ctx;
> >  };
> >  
> > -static int irq_offset_to_id(struct ocxl_context *ctx, u64 offset)
> > +int ocxl_irq_offset_to_id(struct ocxl_context *ctx, u64 offset)
> >  {
> >  	return (offset - ctx->afu->irq_base_offset) >> PAGE_SHIFT;
> >  }
> >  
> > -static u64 irq_id_to_offset(struct ocxl_context *ctx, int id)
> > +u64 ocxl_irq_id_to_offset(struct ocxl_context *ctx, int irq_id)
> >  {
> > -	return ctx->afu->irq_base_offset + (id << PAGE_SHIFT);
> > +	return ctx->afu->irq_base_offset + (irq_id << PAGE_SHIFT);
> >  }
> >  
> >  static irqreturn_t afu_irq_handler(int virq, void *data)
> > @@ -69,7 +69,7 @@ static void release_afu_irq(struct afu_irq *irq)
> >  	kfree(irq->name);
> >  }
> >  
> > -int ocxl_afu_irq_alloc(struct ocxl_context *ctx, u64 *irq_offset)
> > +int ocxl_afu_irq_alloc(struct ocxl_context *ctx, int *irq_id)
> >  {
> >  	struct afu_irq *irq;
> >  	int rc;
> > @@ -101,10 +101,7 @@ int ocxl_afu_irq_alloc(struct ocxl_context
> > *ctx, u64 *irq_offset)
> >  	if (rc)
> >  		goto err_alloc;
> >  
> > -	*irq_offset = irq_id_to_offset(ctx, irq->id);
> 
> This should be replaced by:
> 
> 	*irq_id = irq->id;
> 

Whoops, good catch, thanks :)

-- 
Alastair D'Silva
Open Source Developer
Linux Technology Centre, IBM Australia
mob: 0423 762 819



More information about the Linuxppc-dev mailing list