[PATCH v2 44/60] drm/omap: dss: Add for_each_dss_output() macro

Sebastian Reichel sre at kernel.org
Mon Jun 11 21:06:34 UTC 2018


Hi,

On Mon, Jun 11, 2018 at 08:11:09PM +0300, Laurent Pinchart wrote:
> Hi Sebastian,
> 
> On Monday, 11 June 2018 02:52:44 EEST Sebastian Reichel wrote:
> > On Sat, May 26, 2018 at 08:25:02PM +0300, Laurent Pinchart wrote:
> > > Similarly to for_each_dss_display(), the for_each_dss_output() macro
> > > iterates over all the DSS connected outputs.
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > > ---
> > > 
> > >  drivers/gpu/drm/omapdrm/dss/base.c    | 20 ++++++++++++++------
> > >  drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 ++++++---
> > >  2 files changed, 20 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/omapdrm/dss/base.c
> > > b/drivers/gpu/drm/omapdrm/dss/base.c index 96be800a0f25..519682f18d36
> > > 100644
> > > --- a/drivers/gpu/drm/omapdrm/dss/base.c
> > > +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> > > @@ -127,11 +127,13 @@ struct omap_dss_device
> > > *omapdss_find_device_by_port(struct device_node *src,> 
> > >  /*
> > >  
> > >   * Search for the next device starting at @from. If display_only is true,
> > >   skip> 
> > > - * non-display devices. Release the reference to the @from device, and
> > > acquire - * a reference to the returned device if found.
> > > + * non-display devices. If output_only is true, skip non-output devices
> > > and + * non-connected output devices. Release the reference to the @from
> > > device, and + * acquire a reference to the returned device if found.
> > > 
> > >   */
> > >  
> > >  struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device
> > >  *from,> 
> > > -						bool display_only)
> > > +						bool display_only,
> > > +						bool output_only)
> > 
> > display_only and output_only are mutually exclusive, so I think it
> > would be better to use this as parameter. It would also improve
> > code readability a bit:
> > 
> > enum omapdss_device_type {
> >     OMAPDSS_DEVICE_TYPE_ALL,
> >     OMAPDSS_DEVICE_TYPE_OUTPUT_ONLY,
> >     OMAPDSS_DEVICE_TYPE_DISPLAY_ONLY,
> > };
> 
> That's a good point, even if all this code is meant to disappear.
> What would you think of
> 
> enum omap_dss_device_type {
> 	OMAP_DSS_DEVICE_TYPE_OUTPUT = (1 << 0),
> 	OMAP_DSS_DEVICE_TYPE_DISPLAY = (1 << 1),
> };
> 
> and combining the flags when passed to omapdss_device_get_next() ?

Sounds good to me.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180611/96b49438/attachment.sig>


More information about the dri-devel mailing list