alistair23-linux/drivers/gpu/drm/gma500
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
..
accel_2d.c drm: Nuke fb->depth 2016-12-15 14:55:33 +02:00
backlight.c drivers/gpu/drm/gma500/backlight.c: fix a defined-but-not-used warning for do_gma_backlight_set() 2014-01-23 16:36:55 -08:00
blitter.c drm/gma500: Add first piece of blitter code 2014-03-17 20:11:51 +01:00
blitter.h drm/gma500: Add first piece of blitter code 2014-03-17 20:11:51 +01:00
cdv_device.c drm/gma500: Move to private save/restore hooks 2015-12-08 16:13:30 +01:00
cdv_device.h drm/gma500/cdv: Add and hook up chip op for disabling sr 2013-08-15 00:54:44 +02:00
cdv_intel_crt.c drm/gma500: removed optional dummy encoder mode_fixup function. 2016-02-16 15:32:43 +01:00
cdv_intel_display.c drm/gma: removed optional dummy crtc mode_fixup function. 2016-03-04 17:58:34 +01:00
cdv_intel_dp.c gma500: remove annoying deprecation warning 2016-04-04 12:38:46 -07:00
cdv_intel_hdmi.c GPU-DRM-GMA500: Delete unnecessary checks before two function calls 2016-07-22 11:31:42 +02:00
cdv_intel_lvds.c drm: Make the connector .detect() callback optional 2016-12-01 10:05:53 -05:00
framebuffer.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
framebuffer.h drm/gma500: Rename psb_intel_connector to gma_connector 2013-07-24 01:47:34 +02:00
gem.c drm: Remove unused drm_device from drm_gem_object_lookup() 2016-05-17 08:47:30 +02:00
gem.h drm/gma500: Add backing type and base align to psb_gem_create() 2014-03-17 20:11:59 +01:00
gma_device.c drm/gma500: Unify _get_core_freq for cdv and psb 2014-03-17 20:13:24 +01:00
gma_device.h drm/gma500: Unify _get_core_freq for cdv and psb 2014-03-17 20:13:24 +01:00
gma_display.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
gma_display.h drm/core: Change declaration for gamma_set. 2016-06-07 15:30:09 +02:00
gtt.c drm/gma500: make function static to eliminate compiling warning 2016-11-08 10:44:35 +01:00
gtt.h drm: Extract <drm/drm_gem.h> 2014-09-24 11:43:41 +10:00
intel_bios.c drm/gma500: Renaming DP training vswing pre emph defines 2014-09-03 11:05:38 +02:00
intel_bios.h drm/gma500: Clean up various defines 2013-03-17 18:32:56 +01:00
intel_gmbus.c drm/gma500: fix error path in gma_intel_setup_gmbus() 2016-02-10 08:25:42 +01:00
intel_i2c.c gma500: fixup build versus latest header changes. 2011-11-16 12:14:04 +00:00
Kconfig drm/gma500: make fbdev support really optional 2016-07-18 09:11:37 +02:00
Makefile drm/gma500: add support for atom e6xx lpc lvds i2c 2014-12-02 13:42:49 +10:00
mdfld_device.c drm/gma500: Move to private save/restore hooks 2015-12-08 16:13:30 +01:00
mdfld_dsi_dpi.c drm/gma500/mdfld_dsi: remove bogus if check 2016-04-08 13:42:31 +02:00
mdfld_dsi_dpi.h drm: Make the .mode_fixup() operations mode argument a const pointer 2012-07-19 21:52:38 -04:00
mdfld_dsi_output.c drm: Remove display_info->min/max_(h|v)max 2016-08-16 18:49:41 +02:00
mdfld_dsi_output.h intel_mid: Renamed *mrst* to *intel_mid* 2013-10-17 16:40:36 -07:00
mdfld_dsi_pkg_sender.c drm/gma500: Fix possible out of bounds read 2016-04-08 13:41:17 +02:00
mdfld_dsi_pkg_sender.h drm/gma500: mdfld: Reuse video/mipi_display.h 2014-11-13 10:44:41 +01:00
mdfld_intel_display.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
mdfld_output.c gma500: mdfld_dsi_output_init() drop unused parameter 2012-03-10 13:05:51 +00:00
mdfld_output.h gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mdfld_tmd_vid.c gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mdfld_tpo_vid.c gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mid_bios.c gma500: remove duplicate FB_REG09 define 2014-06-19 15:12:41 +02:00
mid_bios.h gma500: Add the glue to the various BIOS and firmware interfaces 2011-11-16 11:25:28 +00:00
mmu.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-04-08 09:52:16 -07:00
mmu.h drm/gma500: Give MMU code it's own header file 2014-03-17 20:11:48 +01:00
oaktrail.h gma600: Enable HDMI support 2012-11-07 10:59:32 +10:00
oaktrail_crtc.c drm: Nuke fb->bits_per_pixel 2016-12-15 14:55:34 +02:00
oaktrail_device.c drm/gma500: Move to private save/restore hooks 2015-12-08 16:13:30 +01:00
oaktrail_hdmi.c drm/gma500: removed optional dummy encoder mode_fixup function. 2016-02-16 15:32:43 +01:00
oaktrail_hdmi_i2c.c tree-wide: use reinit_completion instead of INIT_COMPLETION 2013-11-15 09:32:21 +09:00
oaktrail_lvds.c drm: Pass 'name' to drm_encoder_init() 2015-12-11 09:13:20 +01:00
oaktrail_lvds_i2c.c drm/gma500: add support for atom e6xx lpc lvds i2c 2014-12-02 13:42:49 +10:00
opregion.c drm/gma500: remove unnecessary config_enabled() guard 2016-08-24 07:43:42 +02:00
opregion.h gma500: move the ASLE enable 2012-07-16 09:20:33 -07:00
power.c drm/gma500: use to_pci_dev() 2016-01-04 07:57:38 +01:00
power.h drm/gma500: Add hooks for hibernation 2013-04-07 17:09:34 +02:00
psb_device.c drm/gma500: Move to private save/restore hooks 2015-12-08 16:13:30 +01:00
psb_device.h drm/gma500/psb: Make use of generic clock code 2013-07-24 01:47:18 +02:00
psb_drv.c drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
psb_drv.h drm/gma500: remove unused ioctl declarations 2016-11-08 10:45:10 +01:00
psb_intel_display.c drm: Initialize a linear gamma table by default 2016-05-31 16:56:44 +02:00
psb_intel_drv.h drm/gma500: Move to private save/restore hooks 2015-12-08 16:13:30 +01:00
psb_intel_lvds.c drm: Make the connector .detect() callback optional 2016-12-01 10:05:53 -05:00
psb_intel_modes.c drm: Remove superflous linux/fb.h includes 2016-08-12 10:41:39 +02:00
psb_intel_reg.h drm/gma500: Clean up various defines 2013-03-17 18:32:56 +01:00
psb_intel_sdvo.c drm: Pass 'name' to drm_encoder_init() 2015-12-11 09:13:20 +01:00
psb_intel_sdvo_regs.h gma500: Replace SDVO code with slightly modified version from i915 2011-12-20 10:23:14 +00:00
psb_irq.c drm/irq: Use unsigned int pipe in public API 2015-10-06 12:57:47 +02:00
psb_irq.h drm/irq: Use unsigned int pipe in public API 2015-10-06 12:57:47 +02:00
psb_lid.c gma500: Prevent endless loop in panel power up sequence 2012-05-22 10:15:29 +01:00
psb_reg.h gma500: Add the core DRM files and headers 2011-11-16 11:26:35 +00:00
tc35876x-dsi-lvds.c Drivers: gpu: remove __dev* attributes. 2013-01-03 15:57:15 -08:00
tc35876x-dsi-lvds.h gma500: initial medfield merge 2012-03-10 13:05:48 +00:00