projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e9a744f
)
drm/i915/panel: Split range scaling calculation for readiblity
author
Chris Wilson
<chris@chris-wilson.co.uk>
Wed, 14 Feb 2018 09:17:47 +0000
(09:17 +0000)
committer
Chris Wilson
<chris@chris-wilson.co.uk>
Wed, 14 Feb 2018 12:02:44 +0000
(12:02 +0000)
Split the 64b multiplication from the division so that it doesn't sprawl
across a couple of lines and use mul_u32_u32() instead of open-coding
the 64b conversion.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link:
https://patchwork.freedesktop.org/patch/msgid/20180214091747.12753-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_panel.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/i915/intel_panel.c
b/drivers/gpu/drm/i915/intel_panel.c
index 41296935ef117e81267826f682a01f3f4ba008e1..41d00b1603e304ff5694cc2bd8ec8daee80bc80c 100644
(file)
--- a/
drivers/gpu/drm/i915/intel_panel.c
+++ b/
drivers/gpu/drm/i915/intel_panel.c
@@
-419,8
+419,9
@@
static uint32_t scale(uint32_t source_val,
source_val = clamp(source_val, source_min, source_max);
/* avoid overflows */
- target_val = DIV_ROUND_CLOSEST_ULL((uint64_t)(source_val - source_min) *
- (target_max - target_min), source_max - source_min);
+ target_val = mul_u32_u32(source_val - source_min,
+ target_max - target_min);
+ target_val = DIV_ROUND_CLOSEST_ULL(target_val, source_max - source_min);
target_val += target_min;
return target_val;