On Wed, Apr 18, 2018 at 02:51:21PM +0200, Maarten Lankhorst wrote: > This reduces the amount of spam when you debug a CRC reading > program. > > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/drm_debugfs_crc.c | 9 ++++++++- > include/drm/drm_debugfs_crc.h | 3 ++- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c > index 9f8312137cad..5a052c511e62 100644 > --- a/drivers/gpu/drm/drm_debugfs_crc.c > +++ b/drivers/gpu/drm/drm_debugfs_crc.c > @@ -139,6 +139,7 @@ static int crtc_crc_data_count(struct drm_crtc_crc *crc) > static void crtc_crc_cleanup(struct drm_crtc_crc *crc) > { > kfree(crc->entries); > + crc->overflow = false; > crc->entries = NULL; > crc->head = 0; > crc->tail = 0; > @@ -391,8 +392,14 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame, > tail = crc->tail; > > if (CIRC_SPACE(head, tail, DRM_CRC_ENTRIES_NR) < 1) { > + bool overflow = crc->overflow; 'was_overflow' or something to indicate this is the old value? > + > + crc->overflow = true; > spin_unlock(&crc->lock); > - DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n"); > + > + if (!overflow) > + DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n"); would make this a bit less confusing perhaps. Now it reads as "if (no overflow) DRM_ERROR("we have an overflow");" which makes no sense on the first glance. Apart from that Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > + > return -ENOBUFS; > } > > diff --git a/include/drm/drm_debugfs_crc.h b/include/drm/drm_debugfs_crc.h > index 7d63b1d4adb9..b225eeb30d05 100644 > --- a/include/drm/drm_debugfs_crc.h > +++ b/include/drm/drm_debugfs_crc.h > @@ -43,6 +43,7 @@ struct drm_crtc_crc_entry { > * @lock: protects the fields in this struct > * @source: name of the currently configured source of CRCs > * @opened: whether userspace has opened the data file for reading > + * @overflow: whether an overflow occured. > * @entries: array of entries, with size of %DRM_CRC_ENTRIES_NR > * @head: head of circular queue > * @tail: tail of circular queue > @@ -52,7 +53,7 @@ struct drm_crtc_crc_entry { > struct drm_crtc_crc { > spinlock_t lock; > const char *source; > - bool opened; > + bool opened, overflow; > struct drm_crtc_crc_entry *entries; > int head, tail; > size_t values_cnt; > -- > 2.17.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx