Re: [PATCH RFC 13/19] drm/bridge: Add the drm_bridge_chain_get_prev_bridge() helper

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

 



On Thu, 22 Aug 2019 03:17:32 +0300
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:

> Hi Boris,
> 
> Thank you for the patch.
> 
> On Thu, Aug 08, 2019 at 05:11:44PM +0200, Boris Brezillon wrote:
> > Will be useful for bridge drivers that want to do bus format
> > negotiation with their neighbours.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/drm_bridge.c | 19 +++++++++++++++++++
> >  include/drm/drm_bridge.h     |  2 ++
> >  2 files changed, 21 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> > index dcad661daa74..9efb27087e70 100644
> > --- a/drivers/gpu/drm/drm_bridge.c
> > +++ b/drivers/gpu/drm/drm_bridge.c
> > @@ -271,6 +271,25 @@ drm_bridge_chain_get_next_bridge(struct drm_bridge *bridge)
> >  }
> >  EXPORT_SYMBOL(drm_bridge_chain_get_next_bridge);
> >  
> > +/**
> > + * drm_bridge_chain_get_prev_bridge() - Get the previous bridge in the chain
> > + * @bridge: bridge object
> > + *
> > + * RETURNS:
> > + * the previous bridge in the chain, or NULL if there's @bridge is the
> > + * last.  
> 
> Did you mean "if the @bridge is the first" ?

Yes, sorry about that, I meant "if @bridge is the first", indeed.

> 
> > + */
> > +struct drm_bridge *
> > +drm_bridge_chain_get_prev_bridge(struct drm_bridge *bridge)
> > +{
> > +	if (!bridge || !bridge->encoder ||  
> 
> Do we really need to protect against !bridge and !bridge->encoder, can
> that happen ?

Maybe not.

> Especially !bridge, are there use cases for potentially
> calling this function (and the other list traversal helpers in your
> previous patches) with a NULL bridge ?

I think this checks was done when bridge iteration was based on
recursivity, which is no longer the case.

> 
> > +	    list_is_first(&bridge->encoder->bridge_chain, &bridge->chain_node))
> > +                return NULL;
> > +
> > +	return list_prev_entry(bridge, chain_node);
> > +}
> > +EXPORT_SYMBOL(drm_bridge_chain_get_prev_bridge);
> > +
> >  /**
> >   * DOC: bridge callbacks
> >   *
> > diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> > index 5d8fe3709bde..2f69adb7b0f3 100644
> > --- a/include/drm/drm_bridge.h
> > +++ b/include/drm/drm_bridge.h
> > @@ -485,6 +485,8 @@ struct drm_bridge *
> >  drm_bridge_chain_get_last_bridge(struct drm_encoder *encoder);
> >  struct drm_bridge *
> >  drm_bridge_chain_get_next_bridge(struct drm_bridge *bridge);
> > +struct drm_bridge *
> > +drm_bridge_chain_get_prev_bridge(struct drm_bridge *bridge);
> >  bool drm_bridge_chain_mode_fixup(struct drm_encoder *encoder,
> >  				 const struct drm_display_mode *mode,
> >  				 struct drm_display_mode *adjusted_mode);  
> 

_______________________________________________
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