[PATCH] checkpatch fixes

2016-05-17 Thread Daniel Vetter
On Tue, May 17, 2016 at 07:45:25AM +1000, Tobin C Harding wrote:
> Fix a couple of checkpatch errors and a bunch of warnings.
> 
> Signed-off-by: Tobin C Harding 

Patch needs a drm/gma500: prefix in the summary. Also please list in the
commit message itself what kinds of warnings exactly you've fixed. Most
maintainers also want that you split the patch up into one addressing each
issue separately (e.g. one for whitespace, one for printk, one for != NULL
removal).
-Daniel

> ---
> 
> Two occurences of (foo != NULL) changed to (!foo) even though not picked up 
> by checkpatch.pl
> 
>  drivers/gpu/drm/gma500/cdv_intel_lvds.c | 39 
> +++--
>  1 file changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c 
> b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> index 813ef23..34f695c 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> @@ -229,6 +229,7 @@ static void cdv_intel_lvds_set_power(struct drm_device 
> *dev,
>  static void cdv_intel_lvds_encoder_dpms(struct drm_encoder *encoder, int 
> mode)
>  {
>   struct drm_device *dev = encoder->dev;
> +
>   if (mode == DRM_MODE_DPMS_ON)
>   cdv_intel_lvds_set_power(dev, encoder, true);
>   else
> @@ -284,7 +285,7 @@ static bool cdv_intel_lvds_mode_fixup(struct drm_encoder 
> *encoder,
>   head) {
>   if (tmp_encoder != encoder
>   && tmp_encoder->crtc == encoder->crtc) {
> - printk(KERN_ERR "Can't enable LVDS and another "
> + pr_err("Can't enable LVDS and another "
>  "encoder on the same pipe\n");
>   return false;
>   }
> @@ -296,7 +297,7 @@ static bool cdv_intel_lvds_mode_fixup(struct drm_encoder 
> *encoder,
>* with the panel scaling set up to source from the H/VDisplay
>* of the original mode.
>*/
> - if (panel_fixed_mode != NULL) {
> + if (panel_fixed_mode) {
>   adjusted_mode->hdisplay = panel_fixed_mode->hdisplay;
>   adjusted_mode->hsync_start = panel_fixed_mode->hsync_start;
>   adjusted_mode->hsync_end = panel_fixed_mode->hsync_end;
> @@ -410,7 +411,8 @@ static int cdv_intel_lvds_get_modes(struct drm_connector 
> *connector)
>   struct psb_intel_mode_device *mode_dev = _priv->mode_dev;
>   int ret;
>  
> - ret = psb_intel_ddc_get_modes(connector, 
> _encoder->i2c_bus->adapter);
> + ret = psb_intel_ddc_get_modes(connector,
> +   _encoder->i2c_bus->adapter);
>  
>   if (ret)
>   return ret;
> @@ -423,7 +425,7 @@ static int cdv_intel_lvds_get_modes(struct drm_connector 
> *connector)
>   connector->display_info.max_vfreq = 200;
>   connector->display_info.min_hfreq = 0;
>   connector->display_info.max_hfreq = 200;
> - if (mode_dev->panel_fixed_mode != NULL) {
> + if (mode_dev->panel_fixed_mode) {
>   struct drm_display_mode *mode =
>   drm_mode_duplicate(dev, mode_dev->panel_fixed_mode);
>   drm_mode_probed_add(connector, mode);
> @@ -503,7 +505,7 @@ static int cdv_intel_lvds_set_property(struct 
> drm_connector *connector,
>   value))
>   return -1;
>   else
> -gma_backlight_set(encoder->dev, value);
> + gma_backlight_set(encoder->dev, value);
>   } else if (!strcmp(property->name, "DPMS") && encoder) {
>   const struct drm_encoder_helper_funcs *helpers =
>   encoder->helper_private;
> @@ -574,7 +576,7 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
>   continue;
>  
>   if (child->i2c_pin)
> - *i2c_pin = child->i2c_pin;
> + *i2c_pin = child->i2c_pin;
>  
>   /* However, we cannot trust the BIOS writers to populate
>* the VBT correctly.  Since LVDS requires additional
> @@ -624,13 +626,11 @@ void cdv_intel_lvds_init(struct drm_device *dev,
>   return;
>   }
>  
> - gma_encoder = kzalloc(sizeof(struct gma_encoder),
> - GFP_KERNEL);
> + gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
>   if (!gma_encoder)
>   return;
>  
> - gma_connector = kzalloc(sizeof(struct gma_connector),
> -   GFP_KERNEL);
> + gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
>   if (!gma_connector)
>   goto failed_connector;
>  
> @@ -665,7 +665,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
>   connector->interlace_allowed = false;
>   connector->doublescan_allowed = false;
>  
> - /*Attach connector properties*/
> + /* Attach connector 

[PATCH] checkpatch fixes

2016-05-17 Thread Tobin C Harding
Fix a couple of checkpatch errors and a bunch of warnings.

Signed-off-by: Tobin C Harding 
---

Two occurences of (foo != NULL) changed to (!foo) even though not picked up by 
checkpatch.pl

 drivers/gpu/drm/gma500/cdv_intel_lvds.c | 39 +++--
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c 
b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index 813ef23..34f695c 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -229,6 +229,7 @@ static void cdv_intel_lvds_set_power(struct drm_device *dev,
 static void cdv_intel_lvds_encoder_dpms(struct drm_encoder *encoder, int mode)
 {
struct drm_device *dev = encoder->dev;
+
if (mode == DRM_MODE_DPMS_ON)
cdv_intel_lvds_set_power(dev, encoder, true);
else
@@ -284,7 +285,7 @@ static bool cdv_intel_lvds_mode_fixup(struct drm_encoder 
*encoder,
head) {
if (tmp_encoder != encoder
&& tmp_encoder->crtc == encoder->crtc) {
-   printk(KERN_ERR "Can't enable LVDS and another "
+   pr_err("Can't enable LVDS and another "
   "encoder on the same pipe\n");
return false;
}
@@ -296,7 +297,7 @@ static bool cdv_intel_lvds_mode_fixup(struct drm_encoder 
*encoder,
 * with the panel scaling set up to source from the H/VDisplay
 * of the original mode.
 */
-   if (panel_fixed_mode != NULL) {
+   if (panel_fixed_mode) {
adjusted_mode->hdisplay = panel_fixed_mode->hdisplay;
adjusted_mode->hsync_start = panel_fixed_mode->hsync_start;
adjusted_mode->hsync_end = panel_fixed_mode->hsync_end;
@@ -410,7 +411,8 @@ static int cdv_intel_lvds_get_modes(struct drm_connector 
*connector)
struct psb_intel_mode_device *mode_dev = _priv->mode_dev;
int ret;

-   ret = psb_intel_ddc_get_modes(connector, 
_encoder->i2c_bus->adapter);
+   ret = psb_intel_ddc_get_modes(connector,
+ _encoder->i2c_bus->adapter);

if (ret)
return ret;
@@ -423,7 +425,7 @@ static int cdv_intel_lvds_get_modes(struct drm_connector 
*connector)
connector->display_info.max_vfreq = 200;
connector->display_info.min_hfreq = 0;
connector->display_info.max_hfreq = 200;
-   if (mode_dev->panel_fixed_mode != NULL) {
+   if (mode_dev->panel_fixed_mode) {
struct drm_display_mode *mode =
drm_mode_duplicate(dev, mode_dev->panel_fixed_mode);
drm_mode_probed_add(connector, mode);
@@ -503,7 +505,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector 
*connector,
value))
return -1;
else
-gma_backlight_set(encoder->dev, value);
+   gma_backlight_set(encoder->dev, value);
} else if (!strcmp(property->name, "DPMS") && encoder) {
const struct drm_encoder_helper_funcs *helpers =
encoder->helper_private;
@@ -574,7 +576,7 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
continue;

if (child->i2c_pin)
-   *i2c_pin = child->i2c_pin;
+   *i2c_pin = child->i2c_pin;

/* However, we cannot trust the BIOS writers to populate
 * the VBT correctly.  Since LVDS requires additional
@@ -624,13 +626,11 @@ void cdv_intel_lvds_init(struct drm_device *dev,
return;
}

-   gma_encoder = kzalloc(sizeof(struct gma_encoder),
-   GFP_KERNEL);
+   gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
if (!gma_encoder)
return;

-   gma_connector = kzalloc(sizeof(struct gma_connector),
- GFP_KERNEL);
+   gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
if (!gma_connector)
goto failed_connector;

@@ -665,7 +665,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
connector->interlace_allowed = false;
connector->doublescan_allowed = false;

-   /*Attach connector properties*/
+   /* Attach connector properties */
drm_object_attach_property(>base,
  dev->mode_config.scaling_mode_property,
  DRM_MODE_SCALE_FULLSCREEN);
@@ -677,12 +677,10 @@ void cdv_intel_lvds_init(struct drm_device *dev,
 * Set up I2C bus
 * FIXME: distroy i2c_bus when exit
 */
-   gma_encoder->i2c_bus = psb_intel_i2c_create(dev,
-GPIOB,
-