Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1322032 > unrolled thread

[PATCH] gma500: clean up an excessive and confusing helper

Started byAlan <gnomes@lxorguk.ukuu.org.uk>
First post2016-01-29 20:40 +0100
Last post2016-02-08 10:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] gma500: clean up an excessive and confusing helper Alan <gnomes@lxorguk.ukuu.org.uk> - 2016-01-29 20:40 +0100
    Re: [PATCH] gma500: clean up an excessive and confusing helper Patrik Jakobsson <patrik.r.jakobsson@gmail.com> - 2016-02-01 09:20 +0100
      Re: [PATCH] gma500: clean up an excessive and confusing helper Daniel Vetter <daniel@ffwll.ch> - 2016-02-08 10:10 +0100

#1322032 — [PATCH] gma500: clean up an excessive and confusing helper

FromAlan <gnomes@lxorguk.ukuu.org.uk>
Date2016-01-29 20:40 +0100
Subject[PATCH] gma500: clean up an excessive and confusing helper
Message-ID<qWn3H-7Wl-1@gated-at.bofh.it>
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,

[toc] | [next] | [standalone]


#1322877

FromPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Date2016-02-01 09:20 +0100
Message-ID<qXhSi-8gh-1@gated-at.bofh.it>
In reply to#1322032
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,
>

[toc] | [prev] | [next] | [standalone]


#1328835

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-02-08 10:10 +0100
Message-ID<qZPZx-3ac-23@gated-at.bofh.it>
In reply to#1322877
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web