diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-12-17 14:24:02 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-12-17 14:24:02 -0500 |
commit | 72a3697097b8dc92f5b8362598f5730a9986eb83 (patch) | |
tree | 221a922470b6eb5c37a01ee2b2e5ae0c2070bbea /drivers/gpu/drm/drm_crtc.c | |
parent | 22b8b13b6f436ffbb6e540f5f8039b1084a72794 (diff) | |
parent | dafffda023b04f87e695dfcf5448e4da964d2e95 (diff) |
Merge branch 'topic/core-stuff' into topic/atomic-core
Backmerge my drm-misc branch because of conflicts. Just simple stuff
but better to clear this out before I merge the other atomic patches.
Conflicts:
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_edid.c
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 90 |
1 files changed, 47 insertions, 43 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 481bb2598b62..303c9918a2d5 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -61,8 +61,8 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev, | |||
61 | /* | 61 | /* |
62 | * Global properties | 62 | * Global properties |
63 | */ | 63 | */ |
64 | static const struct drm_prop_enum_list drm_dpms_enum_list[] = | 64 | static const struct drm_prop_enum_list drm_dpms_enum_list[] = { |
65 | { { DRM_MODE_DPMS_ON, "On" }, | 65 | { DRM_MODE_DPMS_ON, "On" }, |
66 | { DRM_MODE_DPMS_STANDBY, "Standby" }, | 66 | { DRM_MODE_DPMS_STANDBY, "Standby" }, |
67 | { DRM_MODE_DPMS_SUSPEND, "Suspend" }, | 67 | { DRM_MODE_DPMS_SUSPEND, "Suspend" }, |
68 | { DRM_MODE_DPMS_OFF, "Off" } | 68 | { DRM_MODE_DPMS_OFF, "Off" } |
@@ -70,8 +70,7 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] = | |||
70 | 70 | ||
71 | DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list) | 71 | DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list) |
72 | 72 | ||
73 | static const struct drm_prop_enum_list drm_plane_type_enum_list[] = | 73 | static const struct drm_prop_enum_list drm_plane_type_enum_list[] = { |
74 | { | ||
75 | { DRM_PLANE_TYPE_OVERLAY, "Overlay" }, | 74 | { DRM_PLANE_TYPE_OVERLAY, "Overlay" }, |
76 | { DRM_PLANE_TYPE_PRIMARY, "Primary" }, | 75 | { DRM_PLANE_TYPE_PRIMARY, "Primary" }, |
77 | { DRM_PLANE_TYPE_CURSOR, "Cursor" }, | 76 | { DRM_PLANE_TYPE_CURSOR, "Cursor" }, |
@@ -80,8 +79,7 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] = | |||
80 | /* | 79 | /* |
81 | * Optional properties | 80 | * Optional properties |
82 | */ | 81 | */ |
83 | static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = | 82 | static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = { |
84 | { | ||
85 | { DRM_MODE_SCALE_NONE, "None" }, | 83 | { DRM_MODE_SCALE_NONE, "None" }, |
86 | { DRM_MODE_SCALE_FULLSCREEN, "Full" }, | 84 | { DRM_MODE_SCALE_FULLSCREEN, "Full" }, |
87 | { DRM_MODE_SCALE_CENTER, "Center" }, | 85 | { DRM_MODE_SCALE_CENTER, "Center" }, |
@@ -97,8 +95,7 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { | |||
97 | /* | 95 | /* |
98 | * Non-global properties, but "required" for certain connectors. | 96 | * Non-global properties, but "required" for certain connectors. |
99 | */ | 97 | */ |
100 | static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = | 98 | static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = { |
101 | { | ||
102 | { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ | 99 | { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ |
103 | { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */ | 100 | { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */ |
104 | { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */ | 101 | { 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[] = | |||
106 | 103 | ||
107 | DRM_ENUM_NAME_FN(drm_get_dvi_i_select_name, drm_dvi_i_select_enum_list) | 104 | DRM_ENUM_NAME_FN(drm_get_dvi_i_select_name, drm_dvi_i_select_enum_list) |
108 | 105 | ||
109 | static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = | 106 | static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = { |
110 | { | ||
111 | { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */ | 107 | { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */ |
112 | { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */ | 108 | { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */ |
113 | { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */ | 109 | { 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[] = | |||
116 | DRM_ENUM_NAME_FN(drm_get_dvi_i_subconnector_name, | 112 | DRM_ENUM_NAME_FN(drm_get_dvi_i_subconnector_name, |
117 | drm_dvi_i_subconnector_enum_list) | 113 | drm_dvi_i_subconnector_enum_list) |
118 | 114 | ||
119 | static const struct drm_prop_enum_list drm_tv_select_enum_list[] = | 115 | static const struct drm_prop_enum_list drm_tv_select_enum_list[] = { |
120 | { | ||
121 | { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ | 116 | { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ |
122 | { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ | 117 | { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ |
123 | { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */ | 118 | { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */ |
@@ -127,8 +122,7 @@ static const struct drm_prop_enum_list drm_tv_select_enum_list[] = | |||
127 | 122 | ||
128 | DRM_ENUM_NAME_FN(drm_get_tv_select_name, drm_tv_select_enum_list) | 123 | DRM_ENUM_NAME_FN(drm_get_tv_select_name, drm_tv_select_enum_list) |
129 | 124 | ||
130 | static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = | 125 | static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = { |
131 | { | ||
132 | { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */ | 126 | { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */ |
133 | { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ | 127 | { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ |
134 | { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */ | 128 | { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */ |
@@ -154,8 +148,8 @@ struct drm_conn_prop_enum_list { | |||
154 | /* | 148 | /* |
155 | * Connector and encoder types. | 149 | * Connector and encoder types. |
156 | */ | 150 | */ |
157 | static struct drm_conn_prop_enum_list drm_connector_enum_list[] = | 151 | static struct drm_conn_prop_enum_list drm_connector_enum_list[] = { |
158 | { { DRM_MODE_CONNECTOR_Unknown, "Unknown" }, | 152 | { DRM_MODE_CONNECTOR_Unknown, "Unknown" }, |
159 | { DRM_MODE_CONNECTOR_VGA, "VGA" }, | 153 | { DRM_MODE_CONNECTOR_VGA, "VGA" }, |
160 | { DRM_MODE_CONNECTOR_DVII, "DVI-I" }, | 154 | { DRM_MODE_CONNECTOR_DVII, "DVI-I" }, |
161 | { DRM_MODE_CONNECTOR_DVID, "DVI-D" }, | 155 | { DRM_MODE_CONNECTOR_DVID, "DVI-D" }, |
@@ -174,8 +168,8 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = | |||
174 | { DRM_MODE_CONNECTOR_DSI, "DSI" }, | 168 | { DRM_MODE_CONNECTOR_DSI, "DSI" }, |
175 | }; | 169 | }; |
176 | 170 | ||
177 | static const struct drm_prop_enum_list drm_encoder_enum_list[] = | 171 | static const struct drm_prop_enum_list drm_encoder_enum_list[] = { |
178 | { { DRM_MODE_ENCODER_NONE, "None" }, | 172 | { DRM_MODE_ENCODER_NONE, "None" }, |
179 | { DRM_MODE_ENCODER_DAC, "DAC" }, | 173 | { DRM_MODE_ENCODER_DAC, "DAC" }, |
180 | { DRM_MODE_ENCODER_TMDS, "TMDS" }, | 174 | { DRM_MODE_ENCODER_TMDS, "TMDS" }, |
181 | { DRM_MODE_ENCODER_LVDS, "LVDS" }, | 175 | { DRM_MODE_ENCODER_LVDS, "LVDS" }, |
@@ -185,8 +179,7 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = | |||
185 | { DRM_MODE_ENCODER_DPMST, "DP MST" }, | 179 | { DRM_MODE_ENCODER_DPMST, "DP MST" }, |
186 | }; | 180 | }; |
187 | 181 | ||
188 | static const struct drm_prop_enum_list drm_subpixel_enum_list[] = | 182 | static const struct drm_prop_enum_list drm_subpixel_enum_list[] = { |
189 | { | ||
190 | { SubPixelUnknown, "Unknown" }, | 183 | { SubPixelUnknown, "Unknown" }, |
191 | { SubPixelHorizontalRGB, "Horizontal RGB" }, | 184 | { SubPixelHorizontalRGB, "Horizontal RGB" }, |
192 | { SubPixelHorizontalBGR, "Horizontal BGR" }, | 185 | { SubPixelHorizontalBGR, "Horizontal BGR" }, |
@@ -1142,6 +1135,7 @@ EXPORT_SYMBOL(drm_encoder_init); | |||
1142 | void drm_encoder_cleanup(struct drm_encoder *encoder) | 1135 | void drm_encoder_cleanup(struct drm_encoder *encoder) |
1143 | { | 1136 | { |
1144 | struct drm_device *dev = encoder->dev; | 1137 | struct drm_device *dev = encoder->dev; |
1138 | |||
1145 | drm_modeset_lock_all(dev); | 1139 | drm_modeset_lock_all(dev); |
1146 | drm_mode_object_put(dev, &encoder->base); | 1140 | drm_mode_object_put(dev, &encoder->base); |
1147 | kfree(encoder->name); | 1141 | kfree(encoder->name); |
@@ -1185,8 +1179,8 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, | |||
1185 | plane->base.properties = &plane->properties; | 1179 | plane->base.properties = &plane->properties; |
1186 | plane->dev = dev; | 1180 | plane->dev = dev; |
1187 | plane->funcs = funcs; | 1181 | plane->funcs = funcs; |
1188 | plane->format_types = kmalloc(sizeof(uint32_t) * format_count, | 1182 | plane->format_types = kmalloc_array(format_count, sizeof(uint32_t), |
1189 | GFP_KERNEL); | 1183 | GFP_KERNEL); |
1190 | if (!plane->format_types) { | 1184 | if (!plane->format_types) { |
1191 | DRM_DEBUG_KMS("out of memory when allocating plane\n"); | 1185 | DRM_DEBUG_KMS("out of memory when allocating plane\n"); |
1192 | drm_mode_object_put(dev, &plane->base); | 1186 | drm_mode_object_put(dev, &plane->base); |
@@ -1599,7 +1593,7 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr | |||
1599 | total_objects += dev->mode_config.num_encoder; | 1593 | total_objects += dev->mode_config.num_encoder; |
1600 | total_objects += dev->mode_config.num_bridge; | 1594 | total_objects += dev->mode_config.num_bridge; |
1601 | 1595 | ||
1602 | group->id_list = kzalloc(total_objects * sizeof(uint32_t), GFP_KERNEL); | 1596 | group->id_list = kcalloc(total_objects, sizeof(uint32_t), GFP_KERNEL); |
1603 | if (!group->id_list) | 1597 | if (!group->id_list) |
1604 | return -ENOMEM; | 1598 | return -ENOMEM; |
1605 | 1599 | ||
@@ -1629,7 +1623,8 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev, | |||
1629 | struct drm_bridge *bridge; | 1623 | struct drm_bridge *bridge; |
1630 | int ret; | 1624 | int ret; |
1631 | 1625 | ||
1632 | if ((ret = drm_mode_group_init(dev, group))) | 1626 | ret = drm_mode_group_init(dev, group); |
1627 | if (ret) | ||
1633 | return ret; | 1628 | return ret; |
1634 | 1629 | ||
1635 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | 1630 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
@@ -2045,11 +2040,9 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, | |||
2045 | 2040 | ||
2046 | props_count = connector->properties.count; | 2041 | props_count = connector->properties.count; |
2047 | 2042 | ||
2048 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { | 2043 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) |
2049 | if (connector->encoder_ids[i] != 0) { | 2044 | if (connector->encoder_ids[i] != 0) |
2050 | encoders_count++; | 2045 | encoders_count++; |
2051 | } | ||
2052 | } | ||
2053 | 2046 | ||
2054 | if (out_resp->count_modes == 0) { | 2047 | if (out_resp->count_modes == 0) { |
2055 | connector->funcs->fill_modes(connector, | 2048 | connector->funcs->fill_modes(connector, |
@@ -2533,7 +2526,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data, | |||
2533 | * | 2526 | * |
2534 | * This is a little helper to wrap internal calls to the ->set_config driver | 2527 | * This is a little helper to wrap internal calls to the ->set_config driver |
2535 | * interface. The only thing it adds is correct refcounting dance. | 2528 | * interface. The only thing it adds is correct refcounting dance. |
2536 | * | 2529 | * |
2537 | * Returns: | 2530 | * Returns: |
2538 | * Zero on success, negative errno on failure. | 2531 | * Zero on success, negative errno on failure. |
2539 | */ | 2532 | */ |
@@ -2725,9 +2718,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, | |||
2725 | goto out; | 2718 | goto out; |
2726 | } | 2719 | } |
2727 | 2720 | ||
2728 | connector_set = kmalloc(crtc_req->count_connectors * | 2721 | connector_set = kmalloc_array(crtc_req->count_connectors, |
2729 | sizeof(struct drm_connector *), | 2722 | sizeof(struct drm_connector *), |
2730 | GFP_KERNEL); | 2723 | GFP_KERNEL); |
2731 | if (!connector_set) { | 2724 | if (!connector_set) { |
2732 | ret = -ENOMEM; | 2725 | ret = -ENOMEM; |
2733 | goto out; | 2726 | goto out; |
@@ -2972,6 +2965,7 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev, | |||
2972 | void *data, struct drm_file *file_priv) | 2965 | void *data, struct drm_file *file_priv) |
2973 | { | 2966 | { |
2974 | struct drm_mode_cursor2 *req = data; | 2967 | struct drm_mode_cursor2 *req = data; |
2968 | |||
2975 | return drm_mode_cursor_common(dev, req, file_priv); | 2969 | return drm_mode_cursor_common(dev, req, file_priv); |
2976 | } | 2970 | } |
2977 | 2971 | ||
@@ -3419,7 +3413,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, | |||
3419 | ret = -EINVAL; | 3413 | ret = -EINVAL; |
3420 | goto out_err1; | 3414 | goto out_err1; |
3421 | } | 3415 | } |
3422 | clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); | 3416 | clips = kcalloc(num_clips, sizeof(*clips), GFP_KERNEL); |
3423 | if (!clips) { | 3417 | if (!clips) { |
3424 | ret = -ENOMEM; | 3418 | ret = -ENOMEM; |
3425 | goto out_err1; | 3419 | goto out_err1; |
@@ -3520,7 +3514,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, | |||
3520 | property->dev = dev; | 3514 | property->dev = dev; |
3521 | 3515 | ||
3522 | if (num_values) { | 3516 | if (num_values) { |
3523 | property->values = kzalloc(sizeof(uint64_t)*num_values, GFP_KERNEL); | 3517 | property->values = kcalloc(num_values, sizeof(uint64_t), |
3518 | GFP_KERNEL); | ||
3524 | if (!property->values) | 3519 | if (!property->values) |
3525 | goto fail; | 3520 | goto fail; |
3526 | } | 3521 | } |
@@ -4061,7 +4056,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev, | |||
4061 | 4056 | ||
4062 | if (out_resp->length == blob->length) { | 4057 | if (out_resp->length == blob->length) { |
4063 | blob_ptr = (void __user *)(unsigned long)out_resp->data; | 4058 | blob_ptr = (void __user *)(unsigned long)out_resp->data; |
4064 | if (copy_to_user(blob_ptr, blob->data, blob->length)){ | 4059 | if (copy_to_user(blob_ptr, blob->data, blob->length)) { |
4065 | ret = -EFAULT; | 4060 | ret = -EFAULT; |
4066 | goto done; | 4061 | goto done; |
4067 | } | 4062 | } |
@@ -4208,6 +4203,8 @@ EXPORT_SYMBOL(drm_mode_connector_update_edid_property); | |||
4208 | static bool drm_property_change_valid_get(struct drm_property *property, | 4203 | static bool drm_property_change_valid_get(struct drm_property *property, |
4209 | uint64_t value, struct drm_mode_object **ref) | 4204 | uint64_t value, struct drm_mode_object **ref) |
4210 | { | 4205 | { |
4206 | int i; | ||
4207 | |||
4211 | if (property->flags & DRM_MODE_PROP_IMMUTABLE) | 4208 | if (property->flags & DRM_MODE_PROP_IMMUTABLE) |
4212 | return false; | 4209 | return false; |
4213 | 4210 | ||
@@ -4219,13 +4216,14 @@ static bool drm_property_change_valid_get(struct drm_property *property, | |||
4219 | return true; | 4216 | return true; |
4220 | } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) { | 4217 | } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) { |
4221 | int64_t svalue = U642I64(value); | 4218 | int64_t svalue = U642I64(value); |
4219 | |||
4222 | if (svalue < U642I64(property->values[0]) || | 4220 | if (svalue < U642I64(property->values[0]) || |
4223 | svalue > U642I64(property->values[1])) | 4221 | svalue > U642I64(property->values[1])) |
4224 | return false; | 4222 | return false; |
4225 | return true; | 4223 | return true; |
4226 | } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { | 4224 | } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { |
4227 | int i; | ||
4228 | uint64_t valid_mask = 0; | 4225 | uint64_t valid_mask = 0; |
4226 | |||
4229 | for (i = 0; i < property->num_values; i++) | 4227 | for (i = 0; i < property->num_values; i++) |
4230 | valid_mask |= (1ULL << property->values[i]); | 4228 | valid_mask |= (1ULL << property->values[i]); |
4231 | return !(value & ~valid_mask); | 4229 | return !(value & ~valid_mask); |
@@ -4257,6 +4255,11 @@ static bool drm_property_change_valid_get(struct drm_property *property, | |||
4257 | return true; | 4255 | return true; |
4258 | return false; | 4256 | return false; |
4259 | } | 4257 | } |
4258 | |||
4259 | for (i = 0; i < property->num_values; i++) | ||
4260 | if (property->values[i] == value) | ||
4261 | return true; | ||
4262 | return false; | ||
4260 | } | 4263 | } |
4261 | 4264 | ||
4262 | static void drm_property_change_valid_put(struct drm_property *property, | 4265 | static void drm_property_change_valid_put(struct drm_property *property, |
@@ -4564,7 +4567,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, | |||
4564 | { | 4567 | { |
4565 | crtc->gamma_size = gamma_size; | 4568 | crtc->gamma_size = gamma_size; |
4566 | 4569 | ||
4567 | crtc->gamma_store = kzalloc(gamma_size * sizeof(uint16_t) * 3, GFP_KERNEL); | 4570 | crtc->gamma_store = kcalloc(gamma_size, sizeof(uint16_t) * 3, |
4571 | GFP_KERNEL); | ||
4568 | if (!crtc->gamma_store) { | 4572 | if (!crtc->gamma_store) { |
4569 | crtc->gamma_size = 0; | 4573 | crtc->gamma_size = 0; |
4570 | return -ENOMEM; | 4574 | return -ENOMEM; |
@@ -4779,23 +4783,23 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
4779 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { | 4783 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { |
4780 | ret = -ENOMEM; | 4784 | ret = -ENOMEM; |
4781 | spin_lock_irqsave(&dev->event_lock, flags); | 4785 | spin_lock_irqsave(&dev->event_lock, flags); |
4782 | if (file_priv->event_space < sizeof e->event) { | 4786 | if (file_priv->event_space < sizeof(e->event)) { |
4783 | spin_unlock_irqrestore(&dev->event_lock, flags); | 4787 | spin_unlock_irqrestore(&dev->event_lock, flags); |
4784 | goto out; | 4788 | goto out; |
4785 | } | 4789 | } |
4786 | file_priv->event_space -= sizeof e->event; | 4790 | file_priv->event_space -= sizeof(e->event); |
4787 | spin_unlock_irqrestore(&dev->event_lock, flags); | 4791 | spin_unlock_irqrestore(&dev->event_lock, flags); |
4788 | 4792 | ||
4789 | e = kzalloc(sizeof *e, GFP_KERNEL); | 4793 | e = kzalloc(sizeof(*e), GFP_KERNEL); |
4790 | if (e == NULL) { | 4794 | if (e == NULL) { |
4791 | spin_lock_irqsave(&dev->event_lock, flags); | 4795 | spin_lock_irqsave(&dev->event_lock, flags); |
4792 | file_priv->event_space += sizeof e->event; | 4796 | file_priv->event_space += sizeof(e->event); |
4793 | spin_unlock_irqrestore(&dev->event_lock, flags); | 4797 | spin_unlock_irqrestore(&dev->event_lock, flags); |
4794 | goto out; | 4798 | goto out; |
4795 | } | 4799 | } |
4796 | 4800 | ||
4797 | e->event.base.type = DRM_EVENT_FLIP_COMPLETE; | 4801 | e->event.base.type = DRM_EVENT_FLIP_COMPLETE; |
4798 | e->event.base.length = sizeof e->event; | 4802 | e->event.base.length = sizeof(e->event); |
4799 | e->event.user_data = page_flip->user_data; | 4803 | e->event.user_data = page_flip->user_data; |
4800 | e->base.event = &e->event.base; | 4804 | e->base.event = &e->event.base; |
4801 | e->base.file_priv = file_priv; | 4805 | e->base.file_priv = file_priv; |
@@ -4808,7 +4812,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
4808 | if (ret) { | 4812 | if (ret) { |
4809 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { | 4813 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { |
4810 | spin_lock_irqsave(&dev->event_lock, flags); | 4814 | spin_lock_irqsave(&dev->event_lock, flags); |
4811 | file_priv->event_space += sizeof e->event; | 4815 | file_priv->event_space += sizeof(e->event); |
4812 | spin_unlock_irqrestore(&dev->event_lock, flags); | 4816 | spin_unlock_irqrestore(&dev->event_lock, flags); |
4813 | kfree(e); | 4817 | kfree(e); |
4814 | } | 4818 | } |