linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gma500: clean up an excessive and confusing helper
@ 2016-01-29 19:37 Alan
  2016-02-01  8:11 ` Patrik Jakobsson
  0 siblings, 1 reply; 3+ messages in thread
From: Alan @ 2016-01-29 19:37 UTC (permalink / raw)
  To: airlied, wuninsu, dri-devel, patrik.r.jakobsson, linux-kernel

From: Alan Cox <alan@linux.intel.com>

This is a left over from the great clean ups in the past. It's confusing as
it returns an int, yet has one caller that never uses it. The caller already
has all the right private variables local so the entire function can be
replaced by a simple if call.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---
 drivers/gpu/drm/gma500/framebuffer.c |   20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index cb95765..033d894 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -674,29 +674,17 @@ static const struct drm_mode_config_funcs psb_mode_funcs = {
 	.output_poll_changed = psbfb_output_poll_changed,
 };
 
-static int psb_create_backlight_property(struct drm_device *dev)
-{
-	struct drm_psb_private *dev_priv = dev->dev_private;
-	struct drm_property *backlight;
-
-	if (dev_priv->backlight_property)
-		return 0;
-
-	backlight = drm_property_create_range(dev, 0, "backlight", 0, 100);
-
-	dev_priv->backlight_property = backlight;
-
-	return 0;
-}
-
 static void psb_setup_outputs(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	struct drm_connector *connector;
 
 	drm_mode_create_scaling_mode_property(dev);
-	psb_create_backlight_property(dev);
 
+	/* It is ok for this to fail - we just don't get backlight control */
+	if (!dev_priv->backlight_property)
+		dev_priv->backlight_property = drm_property_create_range(dev, 0,
+							"backlight", 0, 100);
 	dev_priv->ops->output_init(dev);
 
 	list_for_each_entry(connector, &dev->mode_config.connector_list,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gma500: clean up an excessive and confusing helper
  2016-01-29 19:37 [PATCH] gma500: clean up an excessive and confusing helper Alan
@ 2016-02-01  8:11 ` Patrik Jakobsson
  2016-02-08  9:07   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Patrik Jakobsson @ 2016-02-01  8:11 UTC (permalink / raw)
  To: Alan; +Cc: David Airlie, wuninsu, dri-devel, linux-kernel

On Fri, Jan 29, 2016 at 8:37 PM, Alan <gnomes@lxorguk.ukuu.org.uk> wrote:
> From: Alan Cox <alan@linux.intel.com>
>
> This is a left over from the great clean ups in the past. It's confusing as
> it returns an int, yet has one caller that never uses it. The caller already
> has all the right private variables local so the entire function can be
> replaced by a simple if call.
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>

> ---
>  drivers/gpu/drm/gma500/framebuffer.c |   20 ++++----------------
>  1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
> index cb95765..033d894 100644
> --- a/drivers/gpu/drm/gma500/framebuffer.c
> +++ b/drivers/gpu/drm/gma500/framebuffer.c
> @@ -674,29 +674,17 @@ static const struct drm_mode_config_funcs psb_mode_funcs = {
>         .output_poll_changed = psbfb_output_poll_changed,
>  };
>
> -static int psb_create_backlight_property(struct drm_device *dev)
> -{
> -       struct drm_psb_private *dev_priv = dev->dev_private;
> -       struct drm_property *backlight;
> -
> -       if (dev_priv->backlight_property)
> -               return 0;
> -
> -       backlight = drm_property_create_range(dev, 0, "backlight", 0, 100);
> -
> -       dev_priv->backlight_property = backlight;
> -
> -       return 0;
> -}
> -
>  static void psb_setup_outputs(struct drm_device *dev)
>  {
>         struct drm_psb_private *dev_priv = dev->dev_private;
>         struct drm_connector *connector;
>
>         drm_mode_create_scaling_mode_property(dev);
> -       psb_create_backlight_property(dev);
>
> +       /* It is ok for this to fail - we just don't get backlight control */
> +       if (!dev_priv->backlight_property)
> +               dev_priv->backlight_property = drm_property_create_range(dev, 0,
> +                                                       "backlight", 0, 100);
>         dev_priv->ops->output_init(dev);
>
>         list_for_each_entry(connector, &dev->mode_config.connector_list,
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gma500: clean up an excessive and confusing helper
  2016-02-01  8:11 ` Patrik Jakobsson
@ 2016-02-08  9:07   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2016-02-08  9:07 UTC (permalink / raw)
  To: Patrik Jakobsson; +Cc: Alan, wuninsu, linux-kernel, dri-devel

On Mon, Feb 01, 2016 at 09:11:51AM +0100, Patrik Jakobsson wrote:
> On Fri, Jan 29, 2016 at 8:37 PM, Alan <gnomes@lxorguk.ukuu.org.uk> wrote:
> > From: Alan Cox <alan@linux.intel.com>
> >
> > This is a left over from the great clean ups in the past. It's confusing as
> > it returns an int, yet has one caller that never uses it. The caller already
> > has all the right private variables local so the entire function can be
> > replaced by a simple if call.
> >
> > Signed-off-by: Alan Cox <alan@linux.intel.com>
> 
> Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>

Applied to drm-misc, thanks.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/gma500/framebuffer.c |   20 ++++----------------
> >  1 file changed, 4 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
> > index cb95765..033d894 100644
> > --- a/drivers/gpu/drm/gma500/framebuffer.c
> > +++ b/drivers/gpu/drm/gma500/framebuffer.c
> > @@ -674,29 +674,17 @@ static const struct drm_mode_config_funcs psb_mode_funcs = {
> >         .output_poll_changed = psbfb_output_poll_changed,
> >  };
> >
> > -static int psb_create_backlight_property(struct drm_device *dev)
> > -{
> > -       struct drm_psb_private *dev_priv = dev->dev_private;
> > -       struct drm_property *backlight;
> > -
> > -       if (dev_priv->backlight_property)
> > -               return 0;
> > -
> > -       backlight = drm_property_create_range(dev, 0, "backlight", 0, 100);
> > -
> > -       dev_priv->backlight_property = backlight;
> > -
> > -       return 0;
> > -}
> > -
> >  static void psb_setup_outputs(struct drm_device *dev)
> >  {
> >         struct drm_psb_private *dev_priv = dev->dev_private;
> >         struct drm_connector *connector;
> >
> >         drm_mode_create_scaling_mode_property(dev);
> > -       psb_create_backlight_property(dev);
> >
> > +       /* It is ok for this to fail - we just don't get backlight control */
> > +       if (!dev_priv->backlight_property)
> > +               dev_priv->backlight_property = drm_property_create_range(dev, 0,
> > +                                                       "backlight", 0, 100);
> >         dev_priv->ops->output_init(dev);
> >
> >         list_for_each_entry(connector, &dev->mode_config.connector_list,
> >
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-08  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29 19:37 [PATCH] gma500: clean up an excessive and confusing helper Alan
2016-02-01  8:11 ` Patrik Jakobsson
2016-02-08  9:07   ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).