modesetting-101: set_property should return an int, not a bool

main
Maarten Maathuis 2008-07-20 14:51:22 +02:00
parent 65803e53a6
commit 3ef1d05001
4 changed files with 16 additions and 18 deletions

View File

@ -375,7 +375,7 @@ struct drm_connector_funcs {
void (*restore)(struct drm_connector *connector); void (*restore)(struct drm_connector *connector);
enum drm_connector_status (*detect)(struct drm_connector *connector); enum drm_connector_status (*detect)(struct drm_connector *connector);
void (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); void (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
bool (*set_property)(struct drm_connector *connector, struct drm_property *property, int (*set_property)(struct drm_connector *connector, struct drm_property *property,
uint64_t val); uint64_t val);
void (*destroy)(struct drm_connector *connector); void (*destroy)(struct drm_connector *connector);
}; };

View File

@ -210,7 +210,7 @@ static int intel_crt_get_modes(struct drm_connector *connector)
return intel_ddc_get_modes(intel_output); return intel_ddc_get_modes(intel_output);
} }
static bool intel_crt_set_property(struct drm_connector *connector, static int intel_crt_set_property(struct drm_connector *connector,
struct drm_property *property, struct drm_property *property,
uint64_t value) uint64_t value)
{ {
@ -219,7 +219,7 @@ static bool intel_crt_set_property(struct drm_connector *connector,
if (property == dev->mode_config.dpms_property && connector->encoder) if (property == dev->mode_config.dpms_property && connector->encoder)
intel_crt_dpms(connector->encoder, (uint32_t)(value & 0xf)); intel_crt_dpms(connector->encoder, (uint32_t)(value & 0xf));
return true; return 0;
} }
/* /*

View File

@ -1560,7 +1560,7 @@ intel_tv_destroy (struct drm_connector *connector)
} }
static bool static int
intel_tv_set_property(struct drm_connector *connector, struct drm_property *property, intel_tv_set_property(struct drm_connector *connector, struct drm_property *property,
uint64_t val) uint64_t val)
{ {

View File

@ -1079,21 +1079,21 @@ static void nv50_kms_connector_fill_modes(struct drm_connector *drm_connector, u
} }
} }
static bool nv50_kms_connector_set_property(struct drm_connector *drm_connector, static int nv50_kms_connector_set_property(struct drm_connector *drm_connector,
struct drm_property *property, struct drm_property *property,
uint64_t value) uint64_t value)
{ {
struct drm_device *dev = drm_connector->dev; struct drm_device *dev = drm_connector->dev;
struct nv50_connector *connector = to_nv50_connector(drm_connector); struct nv50_connector *connector = to_nv50_connector(drm_connector);
int rval = 0;
/* DPMS */ /* DPMS */
if (property == dev->mode_config.dpms_property && drm_connector->encoder) { if (property == dev->mode_config.dpms_property && drm_connector->encoder) {
struct nv50_output *output = to_nv50_output(drm_connector->encoder); struct nv50_output *output = to_nv50_output(drm_connector->encoder);
if (!output->set_power_mode(output, (int) value)) rval = output->set_power_mode(output, (int) value);
return true;
else return rval;
return false;
} }
/* Scaling mode */ /* Scaling mode */
@ -1101,7 +1101,6 @@ static bool nv50_kms_connector_set_property(struct drm_connector *drm_connector,
struct nv50_crtc *crtc = NULL; struct nv50_crtc *crtc = NULL;
struct nv50_display *display = nv50_get_display(dev); struct nv50_display *display = nv50_get_display(dev);
int internal_value = 0; int internal_value = 0;
int rval = 0;
switch (value) { switch (value) {
case DRM_MODE_SCALE_NON_GPU: case DRM_MODE_SCALE_NON_GPU:
@ -1126,24 +1125,23 @@ static bool nv50_kms_connector_set_property(struct drm_connector *drm_connector,
crtc = to_nv50_crtc(drm_connector->encoder->crtc); crtc = to_nv50_crtc(drm_connector->encoder->crtc);
if (!crtc) if (!crtc)
return true; return 0;
crtc->scaling_mode = connector->scaling_mode; crtc->scaling_mode = connector->scaling_mode;
rval = crtc->set_scale(crtc); rval = crtc->set_scale(crtc);
if (rval) if (rval)
return false; return rval;
/* process command buffer */ /* process command buffer */
display->update(display); display->update(display);
return true; return 0;
} }
/* Dithering */ /* Dithering */
if (property == dev->mode_config.dithering_mode_property) { if (property == dev->mode_config.dithering_mode_property) {
struct nv50_crtc *crtc = NULL; struct nv50_crtc *crtc = NULL;
struct nv50_display *display = nv50_get_display(dev); struct nv50_display *display = nv50_get_display(dev);
int rval = 0;
if (value == DRM_MODE_DITHERING_ON) if (value == DRM_MODE_DITHERING_ON)
connector->use_dithering = true; connector->use_dithering = true;
@ -1154,21 +1152,21 @@ static bool nv50_kms_connector_set_property(struct drm_connector *drm_connector,
crtc = to_nv50_crtc(drm_connector->encoder->crtc); crtc = to_nv50_crtc(drm_connector->encoder->crtc);
if (!crtc) if (!crtc)
return true; return 0;
/* update hw state */ /* update hw state */
crtc->use_dithering = connector->use_dithering; crtc->use_dithering = connector->use_dithering;
rval = crtc->set_dither(crtc); rval = crtc->set_dither(crtc);
if (rval) if (rval)
return false; return rval;
/* process command buffer */ /* process command buffer */
display->update(display); display->update(display);
return true; return 0;
} }
return false; return -EINVAL;
} }
static const struct drm_connector_funcs nv50_kms_connector_funcs = { static const struct drm_connector_funcs nv50_kms_connector_funcs = {