[PATCH 10/25] vmwgfx: Refactor common display unit functions to shared file

Konrad Rzeszutek Wilk konrad.wilk at oracle.com
Mon Oct 3 10:40:27 PDT 2011


On Mon, Oct 03, 2011 at 03:12:17AM +0200, Jakob Bornecrantz wrote:
> On Thu, Sep 29, 2011 at 11:50 PM, Konrad Rzeszutek Wilk
> <konrad.wilk at oracle.com> wrote:
> > On Wed, Sep 28, 2011 at 04:10:06PM +0200, Thomas Hellstrom wrote:
> >> From: Jakob Bornecrantz <jakob at vmware.com>
> >>
> >> More preparation for Screen Object support.
> >>
> >> Signed-off-by: Jakob Bornecrantz <jakob at vmware.com>
> >> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> >> ---
> >>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |  238 +++++++++++++++++++++++++++++++
> >>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.h |   31 ++++-
> >>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |  268 ++---------------------------------
> >>  3 files changed, 282 insertions(+), 255 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> >> index 68c6351..0c4179b 100644
> >> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> >> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> >> @@ -1152,3 +1152,241 @@ u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc)
> >>  {
> >>       return 0;
> >>  }
> >> +
> >> +
> >> +/*
> >> + * Small shared kms functions.
> >> + */
> >> +
> >> +int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,
> >> +                      struct drm_vmw_rect *rects)
> >> +{
> >> +     struct drm_device *dev = dev_priv->dev;
> >> +     struct vmw_display_unit *du;
> >> +     struct drm_connector *con;
> >> +     int i;
> >> +
> >> +     mutex_lock(&dev->mode_config.mutex);
> >> +
> >> +#if 0
> >> +     DRM_INFO("%s: new layout ", __func__);
> >> +     for (i = 0; i < (int)num; i++)
> >
> > Would it be easier to make 'i' be 'unsigned int' ?
> >
> >> +             DRM_INFO("(%i, %i %ux%u) ", rects[i].x, rects[i].y,
> >> +                      rects[i].w, rects[i].h);
> >> +     DRM_INFO("\n");
> >> +#else
> >> +     (void)i;
> >
> > ?
> > What does that do?
> >
> > [edit: Ah, you are moving the code, so the patch looks fine then.
> > Thought I am still confused by this invocation - perhaps it makes sense
> > to clean this part of the code in another patch?]
> 
> The "i" variable is only used in the commented code, and the (void)i; statement
> hides the "unused variable error".

Why not just #ifdef the 'i' variable then? Or perhaps insert {}:

#if 0
{
	int i;
	DRM_INFO("%s: new layout ", __func__);
	for (i = 0; i < (int)num; i++)
	        DRM_INFO("(%i, %i %ux%u) ", rects[i].x, rects[i].y,
	                 rects[i].w, rects[i].h);
	DRM_INFO("\n");
}
#endif


More information about the dri-devel mailing list