alistair23-linux/drivers/gpu/drm/nouveau
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
..
dispnv04 drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
include drm/nouveau/bios/volt: pointers are 32-bit 2016-11-28 15:39:35 +10:00
nvif drm/nouveau: silence sparse warnings about symbols not being marked static 2016-11-07 14:04:40 +10:00
nvkm drm/nouveau/bios/dp: fix handling of LevelEntryTableIndex on DP table 4.2 2016-12-13 11:40:16 +10:00
Kbuild drm/nouveau/drm/nouveau: add a LED driver for the NVIDIA logo 2016-10-12 17:29:29 +10:00
Kconfig drm/nouveau: make fbdev support really optional 2016-07-15 10:28:40 -04:00
nouveau_abi16.c drm/nouveau/core: recognise GP100 chipset 2016-07-14 11:53:25 +10:00
nouveau_abi16.h
nouveau_acpi.c drm/nouveau/acpi: fix check for power resources support 2016-11-01 14:52:03 +10:00
nouveau_acpi.h
nouveau_backlight.c drm/nouveau/bl: Do not register interface if Apple GMUX detected 2016-12-13 11:40:17 +10:00
nouveau_bios.c drm/nouveau/kms: lvds panel strap moved again on maxwell 2016-11-07 14:04:14 +10:00
nouveau_bios.h drm/nouveau/nouveau: bios pointers may be unaligned, use proper accessors 2016-10-12 17:29:02 +10:00
nouveau_bo.c drm/nouveau/ttm: wait for bo fence to signal before unmapping vmas 2016-12-13 11:39:55 +10:00
nouveau_bo.h
nouveau_chan.c drm/nouveau/fifo/gp100: initial support 2016-07-14 11:53:25 +10:00
nouveau_chan.h
nouveau_connector.c drm/nouveau/kms/nv50: initial support for DP 1.2 multi-stream 2016-11-07 14:05:03 +10:00
nouveau_connector.h drm/nouveau/kms/nv50: remove code to support non-atomic connector properties 2016-11-07 14:05:01 +10:00
nouveau_crtc.h drm/nouveau/kms/nv50: remove code to support non-atomic connector properties 2016-11-07 14:05:01 +10:00
nouveau_debugfs.c
nouveau_debugfs.h
nouveau_display.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
nouveau_display.h drm/nouveau/bl: Assign different names to interfaces 2016-12-13 11:40:16 +10:00
nouveau_dma.c
nouveau_dma.h
nouveau_dp.c drm/nouveau/kms/nv50: initial support for DP 1.2 multi-stream 2016-11-07 14:05:03 +10:00
nouveau_drm.c drm/nouveau/bl: Assign different names to interfaces 2016-12-13 11:40:16 +10:00
nouveau_drv.h drm/nouveau/bl: Assign different names to interfaces 2016-12-13 11:40:16 +10:00
nouveau_encoder.h drm/nouveau/kms/nv50: initial support for DP 1.2 multi-stream 2016-11-07 14:05:03 +10:00
nouveau_fbcon.c drm: Nuke fb->depth 2016-12-15 14:55:33 +02:00
nouveau_fbcon.h drm/nouveau/fbcon: refcount the drm_framebuffer 2016-11-07 14:04:44 +10:00
nouveau_fence.c drm/nouveau: fix nv84 fence context leak 2016-11-07 14:04:37 +10:00
nouveau_fence.h drm/nouveau/kms/nv50: remove code to support non-atomic page flips 2016-11-07 14:05:01 +10:00
nouveau_gem.c drm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized 2016-11-07 14:04:36 +10:00
nouveau_gem.h
nouveau_hwmon.c drm/nouveau/hwmon: add in_min and in_max 2016-07-14 11:53:25 +10:00
nouveau_hwmon.h
nouveau_ioc32.c
nouveau_ioctl.h
nouveau_led.c drm/nouveau/drm/nouveau: add a LED driver for the NVIDIA logo 2016-10-12 17:29:29 +10:00
nouveau_led.h drm/nouveau/drm/nouveau: add a LED driver for the NVIDIA logo 2016-10-12 17:29:29 +10:00
nouveau_nvif.c
nouveau_platform.c
nouveau_platform.h
nouveau_prime.c
nouveau_reg.h
nouveau_sgdma.c
nouveau_ttm.c drm/drivers: add support for using the arch wc mapping API. 2016-10-26 16:48:01 +10:00
nouveau_ttm.h
nouveau_usif.c drm/fence: add fence to drm_pending_event 2016-06-03 00:01:59 +02:00
nouveau_usif.h
nouveau_vga.c
nouveau_vga.h
nv04_fbcon.c drm/nouveau/fbcon: make use of drm_fb_helper.dev 2016-11-07 14:04:43 +10:00
nv04_fence.c dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
nv10_fence.c drm/nouveau/kms/nv50: remove code to support non-atomic page flips 2016-11-07 14:05:01 +10:00
nv10_fence.h drm/nouveau/kms/nv50: remove code to support non-atomic page flips 2016-11-07 14:05:01 +10:00
nv17_fence.c dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
nv50_display.c drm/nouveau: Use fb->format rather than drm_format_info() 2016-12-15 14:55:32 +02:00
nv50_display.h drm/nouveau/kms/nv50: remove code to support non-atomic page flips 2016-11-07 14:05:01 +10:00
nv50_fbcon.c drm/nouveau/fbcon: make use of drm_fb_helper.fb 2016-11-07 14:04:44 +10:00
nv50_fence.c drm/nouveau/kms/nv50: remove code to support non-atomic page flips 2016-11-07 14:05:01 +10:00
nv84_fence.c drm/nouveau/kms/nv50: remove code to support non-atomic page flips 2016-11-07 14:05:01 +10:00
nvc0_fbcon.c drm/nouveau/fbcon: make use of drm_fb_helper.fb 2016-11-07 14:04:44 +10:00
nvc0_fence.c