aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-12-10 19:12:57 -0500
committerDave Airlie <airlied@redhat.com>2014-12-10 19:12:57 -0500
commitda9df2f41057d71102668f5ac6b3fc998118a59b (patch)
tree8061b865d05043cf25263040ef86d4f54549ce25
parentd1b8792b636f83804add26ec1ac90a686be19e49 (diff)
parenta18c0af171bfb875012da26f23df051004726973 (diff)
Merge tag 'topic/core-stuff-2014-12-10' of git://anongit.freedesktop.org/drm-intel into drm-next
Merge drm core fixes from Daniel. * tag 'topic/core-stuff-2014-12-10' of git://anongit.freedesktop.org/drm-intel: drm: Zero out DRM object memory upon cleanup drm: fix a typo in a comment drm: fix a word repetition in a comment drm: Fix memory leak at error path of drm_read() drm/Documentation: Fix rowspan value in drm-kms-properties drm/edid: Restore kerneldoc consistency drm/edid: new drm_edid_block_checksum helper function V3 drm/edid: shorten log output in case of all zeroes edid block drm/edid: move drm_edid_is_zero to top, make edid argument const
-rw-r--r--Documentation/DocBook/drm.tmpl2
-rw-r--r--drivers/gpu/drm/drm_crtc.c13
-rw-r--r--drivers/gpu/drm/drm_edid.c43
-rw-r--r--drivers/gpu/drm/drm_fops.c1
-rw-r--r--drivers/gpu/drm/drm_irq.c2
5 files changed, 42 insertions, 19 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 60c1063d4178..7a44d9d43c49 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -2550,7 +2550,7 @@ void intel_crt_init(struct drm_device *dev)
2550 <td valign="top" >Description/Restrictions</td> 2550 <td valign="top" >Description/Restrictions</td>
2551 </tr> 2551 </tr>
2552 <tr> 2552 <tr>
2553 <td rowspan="23" valign="top" >DRM</td> 2553 <td rowspan="25" valign="top" >DRM</td>
2554 <td rowspan="4" valign="top" >Generic</td> 2554 <td rowspan="4" valign="top" >Generic</td>
2555 <td valign="top" >“EDID”</td> 2555 <td valign="top" >“EDID”</td>
2556 <td valign="top" >BLOB | IMMUTABLE</td> 2556 <td valign="top" >BLOB | IMMUTABLE</td>
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 4a44f894f631..5213da499d39 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -725,6 +725,8 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
725 WARN_ON(crtc->state && !crtc->funcs->atomic_destroy_state); 725 WARN_ON(crtc->state && !crtc->funcs->atomic_destroy_state);
726 if (crtc->state && crtc->funcs->atomic_destroy_state) 726 if (crtc->state && crtc->funcs->atomic_destroy_state)
727 crtc->funcs->atomic_destroy_state(crtc, crtc->state); 727 crtc->funcs->atomic_destroy_state(crtc, crtc->state);
728
729 memset(crtc, 0, sizeof(*crtc));
728} 730}
729EXPORT_SYMBOL(drm_crtc_cleanup); 731EXPORT_SYMBOL(drm_crtc_cleanup);
730 732
@@ -932,6 +934,8 @@ void drm_connector_cleanup(struct drm_connector *connector)
932 if (connector->state && connector->funcs->atomic_destroy_state) 934 if (connector->state && connector->funcs->atomic_destroy_state)
933 connector->funcs->atomic_destroy_state(connector, 935 connector->funcs->atomic_destroy_state(connector,
934 connector->state); 936 connector->state);
937
938 memset(connector, 0, sizeof(*connector));
935} 939}
936EXPORT_SYMBOL(drm_connector_cleanup); 940EXPORT_SYMBOL(drm_connector_cleanup);
937 941
@@ -1073,6 +1077,8 @@ void drm_bridge_cleanup(struct drm_bridge *bridge)
1073 list_del(&bridge->head); 1077 list_del(&bridge->head);
1074 dev->mode_config.num_bridge--; 1078 dev->mode_config.num_bridge--;
1075 drm_modeset_unlock_all(dev); 1079 drm_modeset_unlock_all(dev);
1080
1081 memset(bridge, 0, sizeof(*bridge));
1076} 1082}
1077EXPORT_SYMBOL(drm_bridge_cleanup); 1083EXPORT_SYMBOL(drm_bridge_cleanup);
1078 1084
@@ -1139,10 +1145,11 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
1139 drm_modeset_lock_all(dev); 1145 drm_modeset_lock_all(dev);
1140 drm_mode_object_put(dev, &encoder->base); 1146 drm_mode_object_put(dev, &encoder->base);
1141 kfree(encoder->name); 1147 kfree(encoder->name);
1142 encoder->name = NULL;
1143 list_del(&encoder->head); 1148 list_del(&encoder->head);
1144 dev->mode_config.num_encoder--; 1149 dev->mode_config.num_encoder--;
1145 drm_modeset_unlock_all(dev); 1150 drm_modeset_unlock_all(dev);
1151
1152 memset(encoder, 0, sizeof(*encoder));
1146} 1153}
1147EXPORT_SYMBOL(drm_encoder_cleanup); 1154EXPORT_SYMBOL(drm_encoder_cleanup);
1148 1155
@@ -1262,6 +1269,8 @@ void drm_plane_cleanup(struct drm_plane *plane)
1262 WARN_ON(plane->state && !plane->funcs->atomic_destroy_state); 1269 WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
1263 if (plane->state && plane->funcs->atomic_destroy_state) 1270 if (plane->state && plane->funcs->atomic_destroy_state)
1264 plane->funcs->atomic_destroy_state(plane, plane->state); 1271 plane->funcs->atomic_destroy_state(plane, plane->state);
1272
1273 memset(plane, 0, sizeof(*plane));
1265} 1274}
1266EXPORT_SYMBOL(drm_plane_cleanup); 1275EXPORT_SYMBOL(drm_plane_cleanup);
1267 1276
@@ -3454,7 +3463,7 @@ void drm_fb_release(struct drm_file *priv)
3454 3463
3455 /* 3464 /*
3456 * When the file gets released that means no one else can access the fb 3465 * When the file gets released that means no one else can access the fb
3457 * list any more, so no need to grab fpriv->fbs_lock. And we need to to 3466 * list any more, so no need to grab fpriv->fbs_lock. And we need to
3458 * avoid upsetting lockdep since the universal cursor code adds a 3467 * avoid upsetting lockdep since the universal cursor code adds a
3459 * framebuffer while holding mutex locks. 3468 * framebuffer while holding mutex locks.
3460 * 3469 *
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 72fd8820e186..53bc7a628909 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1017,6 +1017,25 @@ MODULE_PARM_DESC(edid_fixup,
1017 1017
1018static void drm_get_displayid(struct drm_connector *connector, 1018static void drm_get_displayid(struct drm_connector *connector,
1019 struct edid *edid); 1019 struct edid *edid);
1020
1021static int drm_edid_block_checksum(const u8 *raw_edid)
1022{
1023 int i;
1024 u8 csum = 0;
1025 for (i = 0; i < EDID_LENGTH; i++)
1026 csum += raw_edid[i];
1027
1028 return csum;
1029}
1030
1031static bool drm_edid_is_zero(const u8 *in_edid, int length)
1032{
1033 if (memchr_inv(in_edid, 0, length))
1034 return false;
1035
1036 return true;
1037}
1038
1020/** 1039/**
1021 * drm_edid_block_valid - Sanity check the EDID block (base or extension) 1040 * drm_edid_block_valid - Sanity check the EDID block (base or extension)
1022 * @raw_edid: pointer to raw EDID block 1041 * @raw_edid: pointer to raw EDID block
@@ -1030,8 +1049,7 @@ static void drm_get_displayid(struct drm_connector *connector,
1030 */ 1049 */
1031bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) 1050bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
1032{ 1051{
1033 int i; 1052 u8 csum;
1034 u8 csum = 0;
1035 struct edid *edid = (struct edid *)raw_edid; 1053 struct edid *edid = (struct edid *)raw_edid;
1036 1054
1037 if (WARN_ON(!raw_edid)) 1055 if (WARN_ON(!raw_edid))
@@ -1051,8 +1069,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
1051 } 1069 }
1052 } 1070 }
1053 1071
1054 for (i = 0; i < EDID_LENGTH; i++) 1072 csum = drm_edid_block_checksum(raw_edid);
1055 csum += raw_edid[i];
1056 if (csum) { 1073 if (csum) {
1057 if (print_bad_edid) { 1074 if (print_bad_edid) {
1058 DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum); 1075 DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum);
@@ -1083,9 +1100,13 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
1083 1100
1084bad: 1101bad:
1085 if (print_bad_edid) { 1102 if (print_bad_edid) {
1086 printk(KERN_ERR "Raw EDID:\n"); 1103 if (drm_edid_is_zero(raw_edid, EDID_LENGTH)) {
1087 print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, 1104 printk(KERN_ERR "EDID block is all zeroes\n");
1105 } else {
1106 printk(KERN_ERR "Raw EDID:\n");
1107 print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1,
1088 raw_edid, EDID_LENGTH, false); 1108 raw_edid, EDID_LENGTH, false);
1109 }
1089 } 1110 }
1090 return false; 1111 return false;
1091} 1112}
@@ -1118,7 +1139,7 @@ EXPORT_SYMBOL(drm_edid_is_valid);
1118#define DDC_SEGMENT_ADDR 0x30 1139#define DDC_SEGMENT_ADDR 0x30
1119/** 1140/**
1120 * drm_do_probe_ddc_edid() - get EDID information via I2C 1141 * drm_do_probe_ddc_edid() - get EDID information via I2C
1121 * @adapter: I2C device adaptor 1142 * @data: I2C device adapter
1122 * @buf: EDID data buffer to be filled 1143 * @buf: EDID data buffer to be filled
1123 * @block: 128 byte EDID block to start fetching from 1144 * @block: 128 byte EDID block to start fetching from
1124 * @len: EDID data buffer length to fetch 1145 * @len: EDID data buffer length to fetch
@@ -1179,14 +1200,6 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
1179 return ret == xfers ? 0 : -1; 1200 return ret == xfers ? 0 : -1;
1180} 1201}
1181 1202
1182static bool drm_edid_is_zero(u8 *in_edid, int length)
1183{
1184 if (memchr_inv(in_edid, 0, length))
1185 return false;
1186
1187 return true;
1188}
1189
1190/** 1203/**
1191 * drm_do_get_edid - get EDID data using a custom EDID block read function 1204 * drm_do_get_edid - get EDID data using a custom EDID block read function
1192 * @connector: connector we're probing 1205 * @connector: connector we're probing
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 91e1105f2800..0b9514b6cd64 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -527,6 +527,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
527 if (copy_to_user(buffer + total, 527 if (copy_to_user(buffer + total,
528 e->event, e->event->length)) { 528 e->event, e->event->length)) {
529 total = -EFAULT; 529 total = -EFAULT;
530 e->destroy(e);
530 break; 531 break;
531 } 532 }
532 533
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 0e47df4ef24e..f5a5f18efa5b 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -166,7 +166,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
166 spin_lock_irqsave(&dev->vblank_time_lock, irqflags); 166 spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
167 167
168 /* 168 /*
169 * If the vblank interrupt was already disbled update the count 169 * If the vblank interrupt was already disabled update the count
170 * and timestamp to maintain the appearance that the counter 170 * and timestamp to maintain the appearance that the counter
171 * has been ticking all along until this time. This makes the 171 * has been ticking all along until this time. This makes the
172 * count account for the entire time between drm_vblank_on() and 172 * count account for the entire time between drm_vblank_on() and