Message ID | 53923033-fab9-4389-ab23-1bfcfbee0d86@HUB1.rwth-ad.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, 20 Nov 2014, Stefan Brüns <stefan.bruens@rwth-aachen.de> wrote: > The function will also be used by a later patch, so factor it out. > > Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> > --- > drivers/gpu/drm/drm_edid.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index ec4f91f..b072041 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -1048,8 +1048,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) > } > } > > - for (i = 0; i < EDID_LENGTH; i++) > - csum += raw_edid[i]; > + csum = drm_edid_block_checksum(raw_edid); With this change, it's no longer necessary to initialize csum to 0 in drm_edid_block_valid. > if (csum) { > if (print_bad_edid) { > DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum); > @@ -1188,6 +1187,17 @@ static bool drm_edid_is_zero(u8 *in_edid, int length) > return true; > } > > +static u8 > +drm_edid_block_checksum(u8 *raw_edid) const u8 *raw_edid, please. Those fixed, Reviewed-by: Jani Nikula <jani.nikula@intel.com> > +{ > + int i; > + u8 csum = 0; > + for (i = 0; i < EDID_LENGTH; i++) > + csum += raw_edid[i]; > + > + return csum; > +} > + > static u8 * > drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) > { > -- > 2.1.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index ec4f91f..b072041 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1048,8 +1048,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) } } - for (i = 0; i < EDID_LENGTH; i++) - csum += raw_edid[i]; + csum = drm_edid_block_checksum(raw_edid); if (csum) { if (print_bad_edid) { DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum); @@ -1188,6 +1187,17 @@ static bool drm_edid_is_zero(u8 *in_edid, int length) return true; } +static u8 +drm_edid_block_checksum(u8 *raw_edid) +{ + int i; + u8 csum = 0; + for (i = 0; i < EDID_LENGTH; i++) + csum += raw_edid[i]; + + return csum; +} + static u8 * drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) {
The function will also be used by a later patch, so factor it out. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> --- drivers/gpu/drm/drm_edid.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)