Re: [PATCH] dma-buf/reservation: Wrap ww_mutex_trylock

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

 



On Tue, Feb 21, 2017 at 02:38:07PM +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-21 at 09:30 +0000, Chris Wilson wrote:
> > In a similar fashion to reservation_object_lock() and
> > reservation_object_unlock(), ww_mutex_trylock is also useful and so is
> > worth wrapping for consistency.
> > 
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Cc: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
> > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> > Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> 
> <SNIP>
> 
> > @@ -151,6 +151,26 @@ reservation_object_lock(struct reservation_object *obj,
> >  }
> >  
> >  /**
> > + * reservation_object_trylock - trylock the reservation object
> > + * @obj: the reservation object
> > + *
> > + * Tries to lock the reservation object for exclusive access and modification.
> > + * Note, that the lock is only against other writers, readers will run
> > + * concurrently with a writer under RCU. The seqlock is used to notify readers
> > + * if they overlap with a writer.
> > + *
> > + * Also note that since no context is provided, no deadlock protection is
> > + * possible.
> > + *
> > + * Returns true if the lock was acquired, false otherwise.
> > + */
> > +static inline bool
> 
> I'd carry over the __must_check flag, with that;

Done and applied, thanks.
-Daniel

> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> 
> Regards, Joonas
> 
> > +reservation_object_trylock(struct reservation_object *obj)
> > +{
> > +	return ww_mutex_trylock(&obj->lock);
> > +}
> > +
> > +/**
> >   * reservation_object_unlock - unlock the reservation object
> >   * @obj: the reservation object
> >   *
> -- 
> Joonas Lahtinen
> Open Source Technology Center
> Intel Corporation

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux