[PATCH 3/3] drm/i915: Don't use memcpy() when assignment will do
Ville Syrjala
ville.syrjala at linux.intel.com
Wed Dec 13 15:44:56 UTC 2023
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Replace pointless memcpy()s of structures. A normal assignment
will do just fine, thank you.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_atomic_plane.c | 3 +--
drivers/gpu/drm/i915/display/intel_display.c | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 605f3b7ef4e0..ab7d5e6105ab 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -355,8 +355,7 @@ void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
{
intel_plane_clear_hw_state(plane_state);
- memcpy(&plane_state->hw, &from_plane_state->hw,
- sizeof(plane_state->hw));
+ plane_state->hw = from_plane_state->hw;
if (plane_state->hw.fb)
drm_framebuffer_get(plane_state->hw.fb);
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 3abae05ab04c..27ef77fb4324 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4480,7 +4480,7 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state,
saved_state->crc_enabled = slave_crtc_state->crc_enabled;
intel_crtc_free_hw_state(slave_crtc_state);
- memcpy(slave_crtc_state, saved_state, sizeof(*slave_crtc_state));
+ *slave_crtc_state = *saved_state;
kfree(saved_state);
/* Re-init hw state */
@@ -4540,7 +4540,7 @@ intel_crtc_prepare_cleared_state(struct intel_atomic_state *state,
IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
saved_state->wm = crtc_state->wm;
- memcpy(crtc_state, saved_state, sizeof(*crtc_state));
+ *crtc_state = *saved_state;
kfree(saved_state);
intel_crtc_copy_uapi_to_hw_state_modeset(state, crtc);
--
2.41.0
More information about the Intel-gfx
mailing list