Commit 0e909e4f authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Alex Deucher

drm/amd/display: Slightly optimize dm_dmub_outbox1_low_irq()

A kzalloc()+memcpy() can be optimized in a single kmemdup().
This saves a few cycles because some memory doesn't need to be zeroed.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a7676666
...@@ -820,15 +820,14 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params) ...@@ -820,15 +820,14 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
DRM_ERROR("Failed to allocate dmub_hpd_wrk"); DRM_ERROR("Failed to allocate dmub_hpd_wrk");
return; return;
} }
dmub_hpd_wrk->dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_ATOMIC); dmub_hpd_wrk->dmub_notify = kmemdup(&notify, sizeof(struct dmub_notification),
GFP_ATOMIC);
if (!dmub_hpd_wrk->dmub_notify) { if (!dmub_hpd_wrk->dmub_notify) {
kfree(dmub_hpd_wrk); kfree(dmub_hpd_wrk);
DRM_ERROR("Failed to allocate dmub_hpd_wrk->dmub_notify"); DRM_ERROR("Failed to allocate dmub_hpd_wrk->dmub_notify");
return; return;
} }
INIT_WORK(&dmub_hpd_wrk->handle_hpd_work, dm_handle_hpd_work); INIT_WORK(&dmub_hpd_wrk->handle_hpd_work, dm_handle_hpd_work);
if (dmub_hpd_wrk->dmub_notify)
memcpy(dmub_hpd_wrk->dmub_notify, &notify, sizeof(struct dmub_notification));
dmub_hpd_wrk->adev = adev; dmub_hpd_wrk->adev = adev;
if (notify.type == DMUB_NOTIFICATION_HPD) { if (notify.type == DMUB_NOTIFICATION_HPD) {
plink = adev->dm.dc->links[notify.link_index]; plink = adev->dm.dc->links[notify.link_index];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment