[PATCH 1/2] drm/xe: Use guard(spinlock_irqsave) in pagefault handler
Michal Wajdeczko <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
It is safer and easier to use guard() instead of explicit lock unlock calls. Signed-off-by: Michal Wajdeczko <[email protected]> Cc: Matthew Brost <[email protected]> --- drivers/gpu/drm/xe/xe_pagefault.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c index b2d7bca9e407..cfb65621baec 100644 --- a/drivers/gpu/drm/xe/xe_pagefault.c +++ b/drivers/gpu/drm/xe/xe_pagefault.c @@ -864,10 +864,9 @@ static int xe_pagefault_work_index(struct xe_device *xe) int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf) { struct xe_pagefault_queue *pf_queue = &xe->usm.pf_queue; - unsigned long flags; bool full; - spin_lock_irqsave(&pf_queue->lock, flags); + guard(spinlock_irqsave)(&pf_queue->lock); full = xe_pagefault_queue_full(pf_queue); if (!full) { struct xe_pagefault *lpf; @@ -898,7 +897,6 @@ int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf) drm_warn(&xe->drm, "PageFault Queue full, shouldn't be possible\n"); } - spin_unlock_irqrestore(&pf_queue->lock, flags); return full ? -ENOSPC : 0; } -- 2.47.1