alistair23-linux/drivers/gpu/drm/exynos
Ville Syrjälä 272725c7db drm: Nuke fb->bits_per_pixel
Replace uses of fb->bits_per_pixel with fb->format->cpp[0]*8.
Less duplicated information is a good thing.

Note that I didn't put parens around the cpp*8 in the below cocci script,
on account of not wanting spurious parens all over the place. Instead I
did the unsafe way, and tried to look over the entire diff to spot if
any dangerous expressions were produced. I didn't see any.

There are some cases where previously the code did X*bpp/8, so the
division happened after the multiplication. Those are now just X*cpp
so the division effectively happens before the multiplication,
but that is perfectly fine since bpp is always a multiple of 8.

@@
struct drm_framebuffer *FB;
expression E;
@@
 drm_helper_mode_fill_fb_struct(...) {
	...
-	FB->bits_per_pixel = E;
	...
 }

@@
struct drm_framebuffer *FB;
expression E;
@@
 i9xx_get_initial_plane_config(...) {
	...
-	FB->bits_per_pixel = E;
	...
 }

@@
struct drm_framebuffer *FB;
expression E;
@@
 ironlake_get_initial_plane_config(...) {
	...
-	FB->bits_per_pixel = E;
	...
 }

@@
struct drm_framebuffer *FB;
expression E;
@@
 skylake_get_initial_plane_config(...) {
	...
-	FB->bits_per_pixel = E;
	...
 }

@@
struct drm_framebuffer FB;
expression E;
@@
(
- E * FB.bits_per_pixel / 8
+ E * FB.format->cpp[0]
|
- FB.bits_per_pixel / 8
+ FB.format->cpp[0]
|
- E * FB.bits_per_pixel >> 3
+ E * FB.format->cpp[0]
|
- FB.bits_per_pixel >> 3
+ FB.format->cpp[0]
|
- (FB.bits_per_pixel + 7) / 8
+ FB.format->cpp[0]
|
- FB.bits_per_pixel
+ FB.format->cpp[0] * 8
|
- FB.format->cpp[0] * 8 != 8
+ FB.format->cpp[0] != 1
)

@@
struct drm_framebuffer *FB;
expression E;
@@
(
- E * FB->bits_per_pixel / 8
+ E * FB->format->cpp[0]
|
- FB->bits_per_pixel / 8
+ FB->format->cpp[0]
|
- E * FB->bits_per_pixel >> 3
+ E * FB->format->cpp[0]
|
- FB->bits_per_pixel >> 3
+ FB->format->cpp[0]
|
- (FB->bits_per_pixel + 7) / 8
+ FB->format->cpp[0]
|
- FB->bits_per_pixel
+ FB->format->cpp[0] * 8
|
- FB->format->cpp[0] * 8 != 8
+ FB->format->cpp[0] != 1
)

@@
struct drm_plane_state *state;
expression E;
@@
(
- E * state->fb->bits_per_pixel / 8
+ E * state->fb->format->cpp[0]
|
- state->fb->bits_per_pixel / 8
+ state->fb->format->cpp[0]
|
- E * state->fb->bits_per_pixel >> 3
+ E * state->fb->format->cpp[0]
|
- state->fb->bits_per_pixel >> 3
+ state->fb->format->cpp[0]
|
- (state->fb->bits_per_pixel + 7) / 8
+ state->fb->format->cpp[0]
|
- state->fb->bits_per_pixel
+ state->fb->format->cpp[0] * 8
|
- state->fb->format->cpp[0] * 8 != 8
+ state->fb->format->cpp[0] != 1
)

@@
@@
- (8 * 8)
+ 8 * 8

@@
struct drm_framebuffer FB;
@@
- (FB.format->cpp[0])
+ FB.format->cpp[0]

@@
struct drm_framebuffer *FB;
@@
- (FB->format->cpp[0])
+ FB->format->cpp[0]

@@
@@
 struct drm_framebuffer {
	 ...
-	 int bits_per_pixel;
	 ...
 };

v2: Clean up the 'cpp*8 != 8' and '(8 * 8)' cases (Laurent)
v3: Adjusted the semantic patch a bit and regenerated due to code
    changes

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Link: http://patchwork.freedesktop.org/patch/msgid/1481751140-18352-1-git-send-email-ville.syrjala@linux.intel.com
2016-12-15 14:55:34 +02:00
..
exynos7_drm_decon.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
exynos5433_drm_decon.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
exynos_dp.c drm/exynos: mark exynos_dp_crtc_clock_enable() static 2016-10-01 00:39:37 +09:00
exynos_drm_core.c drm/exynos: remove superfluous inclusions of fbdev header 2016-06-19 14:37:28 +09:00
exynos_drm_crtc.c drm/exynos: use drm core to handle page-flip event 2016-10-01 00:39:37 +09:00
exynos_drm_crtc.h drm/exynos: fix kernel panic issue at drm releasing 2016-01-13 00:16:39 +09:00
exynos_drm_dpi.c drm: exynos: Rely on the default ->best_encoder() behavior 2016-06-10 17:22:15 +02:00
exynos_drm_drv.c Merge tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-11-11 09:28:44 +10:00
exynos_drm_drv.h drm: Don't force all planes to be added to the state due to zpos 2016-10-26 18:48:05 +02:00
exynos_drm_dsi.c drm: exynos: Rely on the default ->best_encoder() behavior 2016-06-10 17:22:15 +02:00
exynos_drm_fb.c drm: Pass 'dev' to drm_helper_mode_fill_fb_struct() 2016-12-15 14:03:30 +02:00
exynos_drm_fb.h Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2016-01-17 13:40:25 -08:00
exynos_drm_fbdev.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
exynos_drm_fbdev.h drm/exynos: build fbdev code conditionally 2016-04-30 01:03:45 +09:00
exynos_drm_fimc.c drm/exynos: gsc: fix spelling mistakes 2016-12-05 22:08:58 +09:00
exynos_drm_fimc.h
exynos_drm_fimd.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
exynos_drm_g2d.c mm: replace get_vaddr_frames() write/force parameters with gup_flags 2016-10-19 08:11:24 -07:00
exynos_drm_g2d.h
exynos_drm_gem.c exynos-drm: Fix error messages to print flags and size 2016-12-05 22:08:58 +09:00
exynos_drm_gem.h dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
exynos_drm_gsc.c drm/exynos: gsc: fix spelling mistakes 2016-12-05 22:08:58 +09:00
exynos_drm_gsc.h
exynos_drm_iommu.c drm/exynos: iommu: move ARM specific code to exynos_drm_iommu.h 2016-07-13 23:06:06 +09:00
exynos_drm_iommu.h iommu/dma: Avoid PCI host bridge windows 2016-09-16 09:34:22 +01:00
exynos_drm_ipp.c drm/exynos: ipp: fix incorrect format specifiers in debug messages 2016-03-01 23:37:08 +09:00
exynos_drm_ipp.h drm/exynos/ipp: remove unused field in command node 2014-09-20 00:56:10 +09:00
exynos_drm_mic.c drm/exynos: fix a warning message 2016-04-30 01:03:46 +09:00
exynos_drm_plane.c drm/exynos: use drm core to handle page-flip event 2016-10-01 00:39:37 +09:00
exynos_drm_plane.h drm/exynos: rename zpos to index 2016-01-13 00:16:33 +09:00
exynos_drm_rotator.c drm/exynos: rotator: fix system and runtime pm integration 2016-09-18 22:20:38 +09:00
exynos_drm_rotator.h
exynos_drm_vidi.c drm/exynos: use drm core to handle page-flip event 2016-10-01 00:39:37 +09:00
exynos_drm_vidi.h
exynos_hdmi.c drm/exynos/hdmi: refactor infoframe code 2016-12-05 22:08:58 +09:00
exynos_mixer.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
Kconfig drm/exynos: Use VIDEO_SAMSUNG_EXYNOS_GSC=n as GSC Kconfig dependency 2016-12-05 22:08:59 +09:00
Makefile drm/exynos: build fbdev code conditionally 2016-04-30 01:03:45 +09:00
regs-fimc.h
regs-gsc.h drm/exynos: gsc: add device tree support and remove usage of static mappings 2015-12-13 22:22:53 +09:00
regs-hdmi.h drm/exynos/hdmi: refactor infoframe code 2016-12-05 22:08:58 +09:00
regs-mixer.h drm/exynos: mixer: refactor layer setup 2016-01-13 00:16:36 +09:00
regs-rotator.h
regs-vp.h