gma500: fix compile warnings when CONFIG_BACKLIGHT_CLASS_DEVICE is not defined

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
[Fixed up for other changes, and tidied some existing variable names]
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Octavian Purdila 2011-07-15 17:33:57 +01:00 committed by Greg Kroah-Hartman
parent 3de78a9dbf
commit 173b3de9a5
4 changed files with 24 additions and 30 deletions

View File

@ -31,6 +31,8 @@ int gma_backlight_init(struct drm_device *dev)
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
struct drm_psb_private *dev_priv = dev->dev_private;
return dev_priv->ops->backlight_init(dev);
#else
return 0;
#endif
}

View File

@ -467,8 +467,6 @@ static int mdfld_dsi_connector_set_property(struct drm_connector * connector,
uint64_t value)
{
struct drm_encoder * encoder = connector->encoder;
struct backlight_device * psb_bd;
struct drm_psb_private * dev_priv = encoder->dev->dev_private;
if (!strcmp(property->name, "scaling mode") && encoder) {
struct psb_intel_crtc * psb_crtc = to_psb_intel_crtc(encoder->crtc);
@ -515,13 +513,14 @@ static int mdfld_dsi_connector_set_property(struct drm_connector * connector,
}
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
} else if (!strcmp(property->name, "backlight") && encoder) {
struct drm_psb_private *dev_priv = encoder->dev->dev_private;
struct backlight_device *psb_bd = dev_priv->backlight_device;
dev_dbg(encoder->dev->dev, "backlight level = %d\n", (int)value);
if (drm_connector_property_set_value(connector, property, value))
goto set_prop_error;
else {
dev_dbg(encoder->dev->dev,
"set brightness to %d", (int)value);
psb_bd = dev_priv->backlight_device;
if (psb_bd) {
psb_bd->props.brightness = value;
backlight_update_status(psb_bd);

View File

@ -536,20 +536,24 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
return -EINVAL;
}
static int psb_dpst_bl_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
static inline void get_brightness(struct backlight_device *bd)
{
struct drm_psb_private *dev_priv = psb_priv(dev);
uint32_t *arg = data;
struct backlight_device *bd = dev_priv->backlight_device;
dev_priv->blc_adj2 = *arg;
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
if (bd) {
bd->props.brightness = bd->ops->get_brightness(bd);
backlight_update_status(bd);
}
#endif
}
static int psb_dpst_bl_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_psb_private *dev_priv = psb_priv(dev);
uint32_t *arg = data;
dev_priv->blc_adj2 = *arg;
get_brightness(dev_priv->backlight_device);
return 0;
}
@ -558,15 +562,9 @@ static int psb_adb_ioctl(struct drm_device *dev, void *data,
{
struct drm_psb_private *dev_priv = psb_priv(dev);
uint32_t *arg = data;
struct backlight_device *bd = dev_priv->backlight_device;
dev_priv->blc_adj1 = *arg;
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
if (bd) {
bd->props.brightness = bd->ops->get_brightness(bd);
backlight_update_status(bd);
}
#endif
dev_priv->blc_adj1 = *arg;
get_brightness(dev_priv->backlight_device);
return 0;
}

View File

@ -467,8 +467,6 @@ static void psb_intel_lvds_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
struct psb_intel_mode_device *mode_dev =
enc_to_psb_intel_output(encoder)->mode_dev;
struct drm_device *dev = encoder->dev;
struct drm_psb_private *dev_priv = dev->dev_private;
u32 pfit_control;
@ -571,17 +569,14 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
uint64_t value)
{
struct drm_encoder *encoder = connector->encoder;
struct drm_psb_private *dev_priv;
if (!encoder)
return -1;
dev_priv = encoder->dev->dev_private;
if (!strcmp(property->name, "scaling mode")) {
struct psb_intel_crtc *crtc =
to_psb_intel_crtc(encoder->crtc);
uint64_t curValue;
uint64_t curval;
if (!crtc)
goto set_prop_error;
@ -599,10 +594,10 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
if (drm_connector_property_get_value(connector,
property,
&curValue))
&curval))
goto set_prop_error;
if (curValue == value)
if (curval == value)
goto set_prop_done;
if (drm_connector_property_set_value(connector,
@ -626,8 +621,8 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
goto set_prop_error;
else {
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
struct backlight_device *bd =
dev_priv->backlight_device;
struct drm_psb_private *devp = encoder->dev->dev_private;
struct backlight_device *bd = devp->backlight_device;
if (bd) {
bd->props.brightness = value;
backlight_update_status(bd);
@ -635,9 +630,9 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
#endif
}
} else if (!strcmp(property->name, "DPMS")) {
struct drm_encoder_helper_funcs *pEncHFuncs
struct drm_encoder_helper_funcs *hfuncs
= encoder->helper_private;
pEncHFuncs->dpms(encoder, value);
hfuncs->dpms(encoder, value);
}
set_prop_done: