drm: Miscellaneous checkpatch whitespace cleanups
Subsystems (2)
PATCH 1/7 drm: Miscellaneous checkpatch whitespace cleanups
From: Thierry Reding <[email protected]>
A couple of whitespace changes required to silent various errors and warnings flagged by checkpatch.
checkpatch requires that the opening brace be on the same line as a variable declaration. Furthermore an empty line is required after a block of variable declarations. Trailing whitespace as well as using spaces before tabs is considered an error or warning, respectively. Finally, the closing parenthesis of an if condition and the opening brace of the conditional block should be separated by a space.
--- drivers/gpu/drm/drm_crtc.c | 42 ++++++++++++++++++++---------------------- drivers/gpu/drm/drm_irq.c | 3 ++- 2 files changed, 22 insertions(+), 23 deletions(-)
drivers/gpu/drm/drm_crtc.c +20 -22
@@ -61,8 +61,8 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev,/* * Global properties */ -static const struct drm_prop_enum_list drm_dpms_enum_list[] = -{ {DRM_MODE_DPMS_ON ,"On" }, +static const struct drm_prop_enum_list drm_dpms_enum_list[] = { + {DRM_MODE_DPMS_ON ,"On" }, {DRM_MODE_DPMS_STANDBY ,"Standby" }, {DRM_MODE_DPMS_SUSPEND ,"Suspend" }, {DRM_MODE_DPMS_OFF ,"Off" }
@@ -70,8 +70,7 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] = DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list) -static const struct drm_prop_enum_list drm_plane_type_enum_list[] = -{ +static const struct drm_prop_enum_list drm_plane_type_enum_list[] = { {DRM_PLANE_TYPE_OVERLAY ,"Overlay" }, {DRM_PLANE_TYPE_PRIMARY ,"Primary" }, {DRM_PLANE_TYPE_CURSOR ,"Cursor" },
@@ -80,8 +79,7 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] =/* * Optional properties */ -static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = -{ +static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = { {DRM_MODE_SCALE_NONE ,"None" }, {DRM_MODE_SCALE_FULLSCREEN ,"Full" }, {DRM_MODE_SCALE_CENTER ,"Center" },
@@ -97,8 +95,7 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {/* * Non-global properties, but "required" for certain connectors. */ -static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = -{ +static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Automatic,"Automatic" },/* DVI-I and TV-out */ {DRM_MODE_SUBCONNECTOR_DVID ,"DVI-D" },/* DVI-I */ {DRM_MODE_SUBCONNECTOR_DVIA ,"DVI-A" },/* DVI-I */
@@ -106,8 +103,7 @@ static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = DRM_ENUM_NAME_FN(drm_get_dvi_i_select_name, drm_dvi_i_select_enum_list) -static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = -{ +static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Unknown,"Unknown" },/* DVI-I and TV-out */ {DRM_MODE_SUBCONNECTOR_DVID ,"DVI-D" },/* DVI-I */ {DRM_MODE_SUBCONNECTOR_DVIA ,"DVI-A" },/* DVI-I */
@@ -116,8 +112,7 @@ static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] =DRM_ENUM_NAME_FN (drm_get_dvi_i_subconnector_name, drm_dvi_i_subconnector_enum_list) -static const struct drm_prop_enum_list drm_tv_select_enum_list[] = -{ +static const struct drm_prop_enum_list drm_tv_select_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Automatic,"Automatic" },/* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Composite,"Composite" },/* TV-out */ {DRM_MODE_SUBCONNECTOR_SVIDEO ,"SVIDEO" },/* TV-out */
@@ -127,8 +122,7 @@ static const struct drm_prop_enum_list drm_tv_select_enum_list[] = DRM_ENUM_NAME_FN(drm_get_tv_select_name, drm_tv_select_enum_list) -static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = -{ +static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Unknown,"Unknown" },/* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Composite,"Composite" },/* TV-out */ {DRM_MODE_SUBCONNECTOR_SVIDEO ,"SVIDEO" },/* TV-out */
@@ -154,8 +148,8 @@ struct drm_conn_prop_enum_list {/* * Connector and encoder types. */ -static struct drm_conn_prop_enum_list drm_connector_enum_list[] = -{ { DRM_MODE_CONNECTOR_Unknown,"Unknown" }, +static struct drm_conn_prop_enum_list drm_connector_enum_list[] = { + { DRM_MODE_CONNECTOR_Unknown,"Unknown" }, {DRM_MODE_CONNECTOR_VGA ,"VGA" }, {DRM_MODE_CONNECTOR_DVII ,"DVI-I" }, {DRM_MODE_CONNECTOR_DVID ,"DVI-D" },
@@ -174,8 +168,8 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = { DRM_MODE_CONNECTOR_DSI, "DSI" }, }; -static const struct drm_prop_enum_list drm_encoder_enum_list[] = -{ {DRM_MODE_ENCODER_NONE ,"None" }, +static const struct drm_prop_enum_list drm_encoder_enum_list[] = { + {DRM_MODE_ENCODER_NONE ,"None" }, {DRM_MODE_ENCODER_DAC ,"DAC" }, {DRM_MODE_ENCODER_TMDS ,"TMDS" }, { DRM_MODE_ENCODER_LVDS, "LVDS" },
@@ -185,8 +179,7 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = { DRM_MODE_ENCODER_DPMST, "DP MST" }, }; -static const struct drm_prop_enum_list drm_subpixel_enum_list[] = -{ +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = { { SubPixelUnknown,"Unknown" }, { SubPixelHorizontalRGB,"Horizontal RGB" }, { SubPixelHorizontalBGR, "Horizontal BGR" },
@@ -1137,6 +1130,7 @@ EXPORT_SYMBOL(drm_encoder_init);void drm_encoder_cleanup (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev; +drm_modeset_lock_all (dev);drm_mode_object_put (dev, &encoder->base);kfree (encoder->name);
@@ -2519,7 +2513,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,* * This is a little helper to wrap internal calls to the ->set_config driver * interface. The only thing it adds is correct refcounting dance. -* +* * Returns: * Zero on success, negative errno on failure. */
@@ -2958,6 +2952,7 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_cursor2 *req = data; +return drm_mode_cursor_common (dev, req, file_priv); }
@@ -4047,7 +4042,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,if (out_resp->length == blob->length) { blob_ptr = (void __user *)(unsigned long )out_resp->data; -if (copy_to_user (blob_ptr, blob->data, blob->length)){ +if (copy_to_user (blob_ptr, blob->data, blob->length)) { ret = -EFAULT ; goto done; }
@@ -4149,6 +4144,7 @@ static bool drm_property_change_is_valid(struct drm_property *property,return true; }else if (drm_property_type_is (property,DRM_MODE_PROP_SIGNED_RANGE )) {int64_t svalue =U642I64 (value); +if (svalue <U642I64 (property->values[0 ]) || svalue >U642I64 (property->values[1 ]))return false;
@@ -4156,6 +4152,7 @@ static bool drm_property_change_is_valid(struct drm_property *property, }else if (drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) {int i;uint64_t valid_mask =0 ; +for (i =0 ; i < property->num_values; i++) valid_mask |= (1ULL << property->values[i]);return !(value & ~valid_mask);
@@ -4164,6 +4161,7 @@ static bool drm_property_change_is_valid(struct drm_property *property,return true; }else if (drm_property_type_is (property,DRM_MODE_PROP_OBJECT )) {struct drm_mode_object *obj; +/* a zero value for an object property translates to null: */ if (value ==0 )return true;
drivers/gpu/drm/drm_irq.c +2 -1
@@ -778,7 +778,7 @@ static struct timeval get_drm_timestamp(void)/** * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent -* vblank interval +* vblank interval * @dev: DRM device * @crtc: which CRTC's vblank timestamp to retrieve * @tvblank: Pointer to target struct timeval which should receive the timestamp
@@ -910,6 +910,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc, {struct timeval now;unsigned int seq; +if (crtc >=0 ) { seq =drm_vblank_count_and_time (dev, crtc, &now); }else {
Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/7 drm: Prefer kcalloc() over kzalloc() with multiply
From: Thierry Reding <[email protected]>
Fixes a couple of checkpatch warnings regarding the use of kzalloc() with a multiplication. kcalloc() is the preferred API.
--- drivers/gpu/drm/drm_crtc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_crtc.c +6 -4
@@ -1583,7 +1583,7 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr total_objects += dev->mode_config.num_encoder; total_objects += dev->mode_config.num_bridge; - group->id_list =kzalloc (total_objects *sizeof (uint32_t ),GFP_KERNEL ); + group->id_list =kcalloc (total_objects,sizeof (uint32_t ),GFP_KERNEL );if (!group->id_list)return -ENOMEM ;
@@ -3400,7 +3400,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, ret = -EINVAL ; goto out_err1; } - clips =kzalloc (num_clips *sizeof (*clips),GFP_KERNEL ); + clips =kcalloc (num_clips,sizeof (*clips),GFP_KERNEL );if (!clips) { ret = -ENOMEM ; goto out_err1;
@@ -3501,7 +3501,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, property->dev = dev;if (num_values) { - property->values =kzalloc (sizeof (uint64_t )*num_values,GFP_KERNEL ); + property->values =kcalloc (num_values,sizeof (uint64_t ), +GFP_KERNEL );if (!property->values) goto fail; }
@@ -4468,7 +4469,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, { crtc->gamma_size = gamma_size; - crtc->gamma_store =kzalloc (gamma_size *sizeof (uint16_t ) *3 ,GFP_KERNEL ); + crtc->gamma_store =kcalloc (gamma_size,sizeof (uint16_t ) *3 , +GFP_KERNEL );if (!crtc->gamma_store) { crtc->gamma_size =0 ;return -ENOMEM ;
Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/7 drm: Prefer kmalloc_array() over kmalloc() with multiply
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Fixes a couple of checkpatch warnings regarding the use of kmalloc() with a multiplication. kmalloc_array() is the preferred API.
--- drivers/gpu/drm/drm_crtc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_crtc.c +5 -5
@@ -1174,8 +1174,8 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, plane->base.properties = &plane->properties; plane->dev = dev; plane->funcs = funcs; - plane->format_types =kmalloc (sizeof (uint32_t ) * format_count, -GFP_KERNEL ); + plane->format_types =kmalloc_array (format_count,sizeof (uint32_t ), +GFP_KERNEL );if (!plane->format_types) {DRM_DEBUG_KMS ("out of memory when allocating plane\n" );drm_mode_object_put (dev, &plane->base);
@@ -2705,9 +2705,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, goto out; } - connector_set =kmalloc (crtc_req->count_connectors * -sizeof (struct drm_connector *), -GFP_KERNEL ); + connector_set =kmalloc_array (crtc_req->count_connectors, +sizeof (struct drm_connector *), +GFP_KERNEL );if (!connector_set) { ret = -ENOMEM ; goto out;
Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/7 drm: Do not assign in if condition
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
checkpatch requires the assignment and the check to be separate statements.
--- drivers/gpu/drm/drm_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_crtc.c +2 -1
@@ -1613,7 +1613,8 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev,struct drm_bridge *bridge;int ret; -if ((ret =drm_mode_group_init (dev, group))) + ret =drm_mode_group_init (dev, group); +if (ret)return ret;list_for_each_entry (crtc, &dev->mode_config.crtc_list, head)
Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/7 drm: Remove unneeded braces for single statement blocks
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Single statement blocks don't need to be enclosed in a pair of braces.
--- drivers/gpu/drm/drm_crtc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_crtc.c +2 -4
@@ -2030,11 +2030,9 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, props_count = connector->properties.count; -for (i =0 ; i <DRM_CONNECTOR_MAX_ENCODER ; i++) { -if (connector->encoder_ids[i] !=0 ) { +for (i =0 ; i <DRM_CONNECTOR_MAX_ENCODER ; i++) +if (connector->encoder_ids[i] !=0 ) encoders_count++; - } - }if (out_resp->count_modes ==0 ) { connector->funcs->fill_modes(connector,
Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/7 drm: Remove useless else block
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
All prior conditional blocks return from the function, so the else block can be at the top level of the function.
--- drivers/gpu/drm/drm_crtc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_crtc.c +7 -7
@@ -4135,6 +4135,8 @@ EXPORT_SYMBOL(drm_mode_connector_update_edid_property);static bool drm_property_change_is_valid (struct drm_property *property,uint64_t value) { +int i; +if (property->flags &DRM_MODE_PROP_IMMUTABLE )return false;
@@ -4150,7 +4152,6 @@ static bool drm_property_change_is_valid(struct drm_property *property,return false;return true; }else if (drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) { -int i;uint64_t valid_mask =0 ;for (i =0 ; i < property->num_values; i++)
@@ -4174,13 +4175,12 @@ static bool drm_property_change_is_valid(struct drm_property *property,*/ obj =_object_find (property->dev, value, property->values[0 ]);return obj !=NULL ; - }else { -int i; -for (i =0 ; i < property->num_values; i++) -if (property->values[i] == value) -return true; -return false; } + +for (i =0 ; i < property->num_values; i++) +if (property->values[i] == value) +return true; +return false; }/**
Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/7 drm: Prefer sizeof(type) over sizeof type
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
sizeof(type) is the variant used most commonly and required by checkpatch.
--- drivers/gpu/drm/drm_crtc.c | 12 ++++++------ drivers/gpu/drm/drm_irq.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_crtc.c +6 -6
@@ -4684,23 +4684,23 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,if (page_flip->flags &DRM_MODE_PAGE_FLIP_EVENT ) { ret = -ENOMEM ;spin_lock_irqsave (&dev->event_lock, flags); -if (file_priv->event_space <sizeof e->event) { +if (file_priv->event_space <sizeof (e->event)) {spin_unlock_irqrestore (&dev->event_lock, flags); goto out; } - file_priv->event_space -=sizeof e->event; + file_priv->event_space -=sizeof (e->event);spin_unlock_irqrestore (&dev->event_lock, flags); - e =kzalloc (sizeof *e,GFP_KERNEL ); + e =kzalloc (sizeof (*e),GFP_KERNEL );if (e ==NULL ) {spin_lock_irqsave (&dev->event_lock, flags); - file_priv->event_space +=sizeof e->event; + file_priv->event_space +=sizeof (e->event);spin_unlock_irqrestore (&dev->event_lock, flags); goto out; } e->event.base.type =DRM_EVENT_FLIP_COMPLETE ; - e->event.base.length =sizeof e->event; + e->event.base.length =sizeof (e->event); e->event.user_data = page_flip->user_data; e->base.event = &e->event.base; e->base.file_priv = file_priv;
@@ -4713,7 +4713,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,if (ret) {if (page_flip->flags &DRM_MODE_PAGE_FLIP_EVENT ) {spin_lock_irqsave (&dev->event_lock, flags); - file_priv->event_space +=sizeof e->event; + file_priv->event_space +=sizeof (e->event);spin_unlock_irqrestore (&dev->event_lock, flags);kfree (e); }
drivers/gpu/drm/drm_irq.c +4 -4
@@ -1383,7 +1383,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,unsigned int seq;int ret; - e =kzalloc (sizeof *e,GFP_KERNEL ); + e =kzalloc (sizeof (*e),GFP_KERNEL );if (e ==NULL ) { ret = -ENOMEM ; goto err_put;
@@ -1392,7 +1392,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, e->pipe = pipe; e->base.pid = current->pid; e->event.base.type =DRM_EVENT_VBLANK ; - e->event.base.length =sizeof e->event; + e->event.base.length =sizeof (e->event); e->event.user_data = vblwait->request.signal; e->base.event = &e->event.base; e->base.file_priv = file_priv;
@@ -1412,12 +1412,12 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, goto err_unlock; } -if (file_priv->event_space <sizeof e->event) { +if (file_priv->event_space <sizeof (e->event)) { ret = -EBUSY ; goto err_unlock; } - file_priv->event_space -=sizeof e->event; + file_priv->event_space -=sizeof (e->event); seq =drm_vblank_count_and_time (dev, pipe, &now); if ((vblwait->request.type & _DRM_VBLANK_NEXTONMISS) &&
Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 5 lines · Thierry Reding
From: Thierry Reding <[email protected]>
A couple of whitespace changes required to silent various errors and warnings flagged by checkpatch.
Quoted 8 lines
checkpatch requires that the opening brace be on the same line as a variable declaration. Furthermore an empty line is required after a block of variable declarations. Trailing whitespace as well as using spaces before tabs is considered an error or warning, respectively. Finally, the closing parenthesis of an if condition and the opening brace of the conditional block should be separated by a space.
Signed-off-by Thierry Reding <[email protected]>
Also merged to drm misc. Imo patches 5&6 are a bit too close to a pure bikeshed so might drop them again if anyone else objects too. -Daniel
Quoted 198 lines
--- drivers/gpu/drm/drm_crtc.c | 42 ++++++++++++++++++++---------------------- drivers/gpu/drm/drm_irq.c | 3 ++- 2 files changed, 22 insertions(+), 23 deletions(-)drivers/gpu/drm/drm_crtc.c +20
-22@@ -61,8 +61,8 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev,/* * Global properties */ -static const struct drm_prop_enum_list drm_dpms_enum_list[] = -{ {DRM_MODE_DPMS_ON ,"On" }, +static const struct drm_prop_enum_list drm_dpms_enum_list[] = { + {DRM_MODE_DPMS_ON ,"On" }, {DRM_MODE_DPMS_STANDBY ,"Standby" }, {DRM_MODE_DPMS_SUSPEND ,"Suspend" }, {DRM_MODE_DPMS_OFF ,"Off" }@@ -70,8 +70,7 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] = DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list) -static const struct drm_prop_enum_list drm_plane_type_enum_list[] = -{ +static const struct drm_prop_enum_list drm_plane_type_enum_list[] = { {DRM_PLANE_TYPE_OVERLAY ,"Overlay" }, {DRM_PLANE_TYPE_PRIMARY ,"Primary" }, {DRM_PLANE_TYPE_CURSOR ,"Cursor" },@@ -80,8 +79,7 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] =/* * Optional properties */ -static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = -{ +static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = { {DRM_MODE_SCALE_NONE ,"None" }, {DRM_MODE_SCALE_FULLSCREEN ,"Full" }, {DRM_MODE_SCALE_CENTER ,"Center" },@@ -97,8 +95,7 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {/* * Non-global properties, but "required" for certain connectors. */ -static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = -{ +static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Automatic,"Automatic" },/* DVI-I and TV-out */ {DRM_MODE_SUBCONNECTOR_DVID ,"DVI-D" },/* DVI-I */ {DRM_MODE_SUBCONNECTOR_DVIA ,"DVI-A" },/* DVI-I */ @@ -106,8 +103,7 @@ static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = DRM_ENUM_NAME_FN(drm_get_dvi_i_select_name, drm_dvi_i_select_enum_list) -static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = -{ +static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Unknown,"Unknown" },/* DVI-I and TV-out */ {DRM_MODE_SUBCONNECTOR_DVID ,"DVI-D" },/* DVI-I */ {DRM_MODE_SUBCONNECTOR_DVIA ,"DVI-A" },/* DVI-I */ @@ -116,8 +112,7 @@ static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] =DRM_ENUM_NAME_FN (drm_get_dvi_i_subconnector_name, drm_dvi_i_subconnector_enum_list) -static const struct drm_prop_enum_list drm_tv_select_enum_list[] = -{ +static const struct drm_prop_enum_list drm_tv_select_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Automatic,"Automatic" },/* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Composite,"Composite" },/* TV-out */ {DRM_MODE_SUBCONNECTOR_SVIDEO ,"SVIDEO" },/* TV-out */ @@ -127,8 +122,7 @@ static const struct drm_prop_enum_list drm_tv_select_enum_list[] = DRM_ENUM_NAME_FN(drm_get_tv_select_name, drm_tv_select_enum_list) -static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = -{ +static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Unknown,"Unknown" },/* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Composite,"Composite" },/* TV-out */ {DRM_MODE_SUBCONNECTOR_SVIDEO ,"SVIDEO" },/* TV-out */ @@ -154,8 +148,8 @@ struct drm_conn_prop_enum_list {/* * Connector and encoder types. */ -static struct drm_conn_prop_enum_list drm_connector_enum_list[] = -{ { DRM_MODE_CONNECTOR_Unknown,"Unknown" }, +static struct drm_conn_prop_enum_list drm_connector_enum_list[] = { + { DRM_MODE_CONNECTOR_Unknown,"Unknown" }, {DRM_MODE_CONNECTOR_VGA ,"VGA" }, {DRM_MODE_CONNECTOR_DVII ,"DVI-I" }, {DRM_MODE_CONNECTOR_DVID ,"DVI-D" },@@ -174,8 +168,8 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = { DRM_MODE_CONNECTOR_DSI, "DSI" }, }; -static const struct drm_prop_enum_list drm_encoder_enum_list[] = -{ {DRM_MODE_ENCODER_NONE ,"None" }, +static const struct drm_prop_enum_list drm_encoder_enum_list[] = { + {DRM_MODE_ENCODER_NONE ,"None" }, {DRM_MODE_ENCODER_DAC ,"DAC" }, {DRM_MODE_ENCODER_TMDS ,"TMDS" }, { DRM_MODE_ENCODER_LVDS, "LVDS" },@@ -185,8 +179,7 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = { DRM_MODE_ENCODER_DPMST, "DP MST" }, }; -static const struct drm_prop_enum_list drm_subpixel_enum_list[] = -{ +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = { { SubPixelUnknown,"Unknown" }, { SubPixelHorizontalRGB,"Horizontal RGB" }, { SubPixelHorizontalBGR, "Horizontal BGR" },@@ -1137,6 +1130,7 @@ EXPORT_SYMBOL(drm_encoder_init);void drm_encoder_cleanup (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev; +drm_modeset_lock_all (dev);drm_mode_object_put (dev, &encoder->base);kfree (encoder->name);@@ -2519,7 +2513,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,* * This is a little helper to wrap internal calls to the ->set_config driver * interface. The only thing it adds is correct refcounting dance. -* +* * Returns: * Zero on success, negative errno on failure. */ @@ -2958,6 +2952,7 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_cursor2 *req = data; +return drm_mode_cursor_common (dev, req, file_priv); }@@ -4047,7 +4042,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,if (out_resp->length == blob->length) { blob_ptr = (void __user *)(unsigned long )out_resp->data; -if (copy_to_user (blob_ptr, blob->data, blob->length)){ +if (copy_to_user (blob_ptr, blob->data, blob->length)) { ret = -EFAULT ; goto done; }@@ -4149,6 +4144,7 @@ static bool drm_property_change_is_valid(struct drm_property *property,return true; }else if (drm_property_type_is (property,DRM_MODE_PROP_SIGNED_RANGE )) {int64_t svalue =U642I64 (value); +if (svalue <U642I64 (property->values[0 ]) || svalue >U642I64 (property->values[1 ]))return false;@@ -4156,6 +4152,7 @@ static bool drm_property_change_is_valid(struct drm_property *property, }else if (drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) {int i;uint64_t valid_mask =0 ; +for (i =0 ; i < property->num_values; i++) valid_mask |= (1ULL << property->values[i]);return !(value & ~valid_mask);@@ -4164,6 +4161,7 @@ static bool drm_property_change_is_valid(struct drm_property *property,return true; }else if (drm_property_type_is (property,DRM_MODE_PROP_OBJECT )) {struct drm_mode_object *obj; +/* a zero value for an object property translates to null: */ if (value ==0 )return true;drivers/gpu/drm/drm_irq.c +2
-1@@ -778,7 +778,7 @@ static struct timeval get_drm_timestamp(void)/** * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent -* vblank interval +* vblank interval * @dev: DRM device * @crtc: which CRTC's vblank timestamp to retrieve * @tvblank: Pointer to target struct timeval which should receive the timestamp @@ -910,6 +910,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc, {struct timeval now;unsigned int seq; +if (crtc >=0 ) { seq =drm_vblank_count_and_time (dev, crtc, &now); }else {Signature · 6 lines
2.1.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel