1
0
Fork 0
alistair23-linux/drivers/gpu/drm
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
..
amd drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
arc drm/arcpgu: Add local 'fb' variables 2016-12-14 22:36:39 +02:00
arm drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
armada drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
ast drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
atmel-hlcdc drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
bochs drm: Nuke fb->depth 2016-12-15 14:55:33 +02:00
bridge drm/bridge: analogix_dp: set the DPCD600 during disabling PSR 2016-12-15 15:07:12 +05:30
cirrus drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
etnaviv drm/etnaviv: Use drm_dev_unref, not drm_put_dev 2016-12-13 18:13:09 +01:00
exynos drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
fsl-dcu drm/fsl: don't use drm_put_dev 2016-12-13 22:25:46 +01:00
gma500 drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
hisilicon drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
i2c drm/i2c: tda998x: fix spelling mistake 2016-11-18 00:00:40 +00:00
i810 drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
i915 drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
imx drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
mediatek drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
meson drm: Add support for Amlogic Meson Graphic Controller 2016-12-01 10:07:20 +01:00
mga
mgag200 drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
msm drm: Nuke fb->depth 2016-12-15 14:55:33 +02:00
mxsfb drm: mxsfb: drm_dev_alloc() returns error pointers 2016-12-13 22:24:20 +01:00
nouveau drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
omapdrm drm: Nuke fb->depth 2016-12-15 14:55:33 +02:00
panel drm/panel: simple: Add support for AUO G185HAN01 2016-12-06 17:06:32 +01:00
qxl drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
r128
radeon drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
rcar-du drm: Make the connector .detect() callback optional 2016-12-01 10:05:53 -05:00
rockchip drm: Nuke fb->depth 2016-12-15 14:55:33 +02:00
savage drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
shmobile drm: Make the connector .detect() callback optional 2016-12-01 10:05:53 -05:00
sis drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
sti drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
sun4i drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
tdfx drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
tegra drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
tilcdc drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
ttm drm/ttm: fix ttm_bo_wait 2016-11-09 00:46:04 +05:30
udl drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
vc4 drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
vgem drm: Take ownership of the dmabuf->obj when exporting 2016-12-08 10:29:22 +01:00
via drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
virtio drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
vmwgfx drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
zte drm: Replace drm_format_plane_cpp() with fb->format->cpp[] 2016-12-15 14:55:31 +02:00
Kconfig Add support for the Amlogic Meson Video Processing Unit 2016-12-08 10:35:52 +10:00
Makefile Add support for the Amlogic Meson Video Processing Unit 2016-12-08 10:35:52 +10:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic.c drm: Replace drm_format_num_planes() with fb->format->num_planes 2016-12-15 14:55:31 +02:00
drm_atomic_helper.c drm/atomic: Use active instead of enable in wait_for_vblanks. 2016-12-08 16:37:06 +01:00
drm_auth.c
drm_blend.c drm: RIP mode_config->rotation_property 2016-10-22 10:42:11 +02:00
drm_bridge.c
drm_bufs.c
drm_cache.c
drm_color_mgmt.c drm/color: document NULL values and default settings better 2016-11-15 22:39:48 +01:00
drm_connector.c drm: document standard connector properties 2016-11-18 09:45:07 +01:00
drm_context.c
drm_crtc.c drm: Use atomic state for FB in legacy ioctls 2016-12-13 22:22:08 +01:00
drm_crtc_helper.c
drm_crtc_helper_internal.h
drm_crtc_internal.h drm/fence: add drm_crtc_create_fence() 2016-12-07 11:16:55 -02:00
drm_debugfs.c drm/atomic: cleanup debugfs entries on un-registering the driver. 2016-11-21 13:22:08 -05:00
drm_debugfs_crc.c drm: fix sparse warnings on undeclared symbols in crc debugfs 2016-10-19 14:10:29 +03:00
drm_dma.c
drm_dp_aux_dev.c
drm_dp_dual_mode_helper.c drm: Print some debug/error info during DP dual mode detect 2016-10-26 15:57:11 -04:00
drm_dp_helper.c Merge tag 'drm-for-v4.9' of git://people.freedesktop.org/~airlied/linux 2016-10-11 18:12:22 -07:00
drm_dp_mst_topology.c drm/dp/mst: Check peer device type before attempting EDID read 2016-10-26 18:53:44 +02:00
drm_drv.c Main pull request for drm for 4.10 kernel 2016-12-13 22:23:18 +01:00
drm_dumb_buffers.c drm: Consolidate dumb buffer docs 2016-11-15 12:51:49 +01:00
drm_edid.c Merge tag 'drm-misc-next-2016-11-29' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2016-11-30 14:28:20 +10:00
drm_edid_load.c
drm_encoder.c drm: Fix locking cargo-cult in encoder/plane init/cleanup 2016-11-29 23:34:36 +01:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm: Nuke fb->depth 2016-12-15 14:55:33 +02:00
drm_fb_helper.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
drm_flip_work.c
drm_fops.c drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
drm_fourcc.c drm: move allocation out of drm_get_format_name() 2016-11-12 14:19:38 +01:00
drm_framebuffer.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
drm_gem.c
drm_gem_cma_helper.c
drm_global.c
drm_hashtab.c
drm_info.c drm: Print device information again in debugfs 2016-10-17 16:20:53 +10:00
drm_internal.h drm: drm_irq.h header cleanup 2016-11-15 23:33:48 +01:00
drm_ioc32.c
drm_ioctl.c drm: Enforce BKL-less ioctls for modern drivers 2016-12-13 09:37:43 +01:00
drm_irq.c drm/irq: Unexport drm_vblank_on/off 2016-11-15 23:33:48 +01:00
drm_kms_helper_common.c
drm_legacy.h
drm_lock.c drm: Avoid NULL dereference for DRM_LEGACY debug message 2016-11-28 08:39:41 +01:00
drm_memory.c
drm_mipi_dsi.c
drm_mm.c drm: Initialise drm_mm.head_node.allocated 2016-12-01 10:35:45 +01:00
drm_mode_config.c drm: Simplify GETRESOURCES ioctl 2016-12-12 10:24:07 +01:00
drm_mode_object.c
drm_modes.c Revert "drm: Add aspect ratio parsing in DRM layer" 2016-11-15 15:01:42 +01:00
drm_modeset_helper.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
drm_modeset_lock.c drm/doc: Fix indenting in drm_modeset_lock.c comment 2016-11-29 23:34:36 +01:00
drm_of.c drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
drm_panel.c
drm_pci.c
drm_plane.c Main pull request for drm for 4.10 kernel 2016-12-13 22:23:18 +01:00
drm_plane_helper.c drm: add helpers to go from plane state to drm_rect 2016-11-08 16:38:03 -05:00
drm_platform.c
drm_prime.c drm: Take ownership of the dmabuf->obj when exporting 2016-12-08 10:29:22 +01:00
drm_print.c drm/print: Move kerneldoc next to definition 2016-11-15 12:55:24 +01:00
drm_probe_helper.c drm: Don't block the kworker waiting for mode_config.mutex in output_poll() 2016-12-06 13:41:15 +01:00
drm_property.c drm: Use u64_to_user_ptr() helper for blob ioctls 2016-11-28 08:12:18 +01:00
drm_rect.c drm: helper macros to print composite types 2016-11-08 16:38:03 -05:00
drm_scatter.c
drm_simple_kms_helper.c drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks 2016-10-05 15:18:02 +02:00
drm_sysfs.c
drm_trace.h
drm_trace_points.c
drm_vm.c
drm_vma_manager.c