From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9B773FCC for ; Mon, 1 Jun 2026 00:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780274178; cv=none; b=OWMhpfgYHEOflsmubhQtKCXxkJbnfMlj/QSZKgyBQqiu3juUp29hf7U9ts2ENxM3hWxlCPmwYL7hM0jJOJqvGFmzgTCf+bdRC5bWMiIFtDBHYsX/XNEvn98lLY+5z7M03eQrbjjyQIgamK7tk2rKgX101P1Co+Qu3/qgUh1xyDY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780274178; c=relaxed/simple; bh=F36T/8vrzMlC5yvZm/9OkGm1W8NNSS1qMIE6aZEPPLk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k/IzVSHqmpuRg9tDKFZu0m/jC173lZNHRw7UiR7reMB0+8X8nTP4edEIJFrjR4r1iI2JdIItdUjX7z863GaeX9mnnUA4cVeV9a0Il5+JzPl3BCMsnvZl8VvtSuL8tAi2XQWJZrQq7xf0nzpb4zlqmQVJIGFzfNIrYHSn/4XcUDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UPOB73fB; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UPOB73fB" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2c0c1e0b0faso4788165ad.0 for ; Sun, 31 May 2026 17:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780274177; x=1780878977; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YLx2I+SI6ZAAbvwA7AP1QE/bdiqJuNwqRo7WWHC7m6E=; b=UPOB73fBDW5AK3GsVl4AJVaq/5dIXPaU/YVYXxIGyDIrwvbbjrAewzZhDr1wpRmbAU FJ46m/MfOWLCSQDKlk26HQNfN6DgBT3mCoJA6HGdo6J7kPKK+03tzHJvYZoCq9CXOFOH QXH+IhTWNrWWUCDpcoqVxmeWCW4vED+5vtc+Z4y0xbPSrXq2rjs3k/jFQSBMjbqnudf3 uXa0N5nH7JjloUbaGeIJZswS0n9BDvmicFF1OrXQpguo8triV+KrnFxRealxwusLzXgz CUCDIadnggrAQlAURC78erCYS8bdfhmGM5FWM1NnBf4laYFuYim1mxVso7z2f09WoZ7+ YG8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780274177; x=1780878977; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YLx2I+SI6ZAAbvwA7AP1QE/bdiqJuNwqRo7WWHC7m6E=; b=Z1Pd15tM0mygbwzBNc91JZ8zzaOSIhZqsYxayTS+pT26wuKMCx1TLXn2L5WyeWK96Z W3MYzWzzO4awYzIi65waTn0MW2BSN6xIZFo+ZqmX2+wyhv+Cx2Se06CxKdPSIj/jvHdL SLt5Ug7mIVMo7kAJ6IRyxWd7eAkbp5QOM0kWbnVud73V7szBiRUDyxGbZvXmYKihuKKA nd0K1dhDNbH84sZlnFnHsCHElGrEQsHpNPGhDoqiPu7t3fDiHB7ayjhPYsUoxZjM12Vz 1Vl5bRbg7UfKxq8Pcluemvxkzcze7l4h170mK7qC6akU2skluDfDAksnlJrSbhbsanDU rR4A== X-Forwarded-Encrypted: i=1; AFNElJ+5iyG5BKdMCxWYXHt2cKdbDKGlix2nueJS/4yDVIAtjMmBS+mZjcVH3F2f5HzkOJFIEbBtItWPeF0c1yY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4TPbKvoUYAGXs6v2Db/pHtYf/Vj4vymTLnbMj2+Y9FG+O60GC CTK4A2oG3dSxvoQ5LRuj/10MKFQUGoRqJPJEhK+3b2UXX+eRO5xo+arX X-Gm-Gg: Acq92OG78Cbp9neb534zBqOg8kMIJm9hSkDAjp/P+MDyHNJY1TtAAGdZB0O+MtY9fLc JqvkATP8Kiwj3bR95CxINDJT5L8h5yjkRNIH/Y0uGML+M8VnCItRaV7woD1nBNydyoP3dxP/amc 6UGZPVyqC3t5kU+1exSP3hOer+j6dQjXxoWdjlz9gbgDe85qvpusoMsQZ0vPSKrraT0QfBJ9oWG /2CmWtf/IQ84cNqelLHbOwwCoCbwQXxtIJdGmAaYxodLS4rvwlm1QvI4oqvjaVyYjtHo7heDftg HeabGq69SmiAulb2N9wz82IKDQ7NvJQ4y6wJj9uuFIsLM4GZdkduMWEl161Q6uj1YY9LfeLWEhc pKayi7zgFvDRyvItUSrJuSjqnUm/8YrlN/YytiozxiwhHxO3xN7Xflp3Gii2XfYqqE0qvV2z0Nt 8J4bhL68JDaiUbVO7gC9uqXzxQF4+58I+7WEs38OAjfX5E3BYBzEXaMExDOffZzF4KUbqj8hZMg tTjN5im9xSFDHeIZ88QADTI8j+wrTi0nW1Z7h5DeY4Txg== X-Received: by 2002:a17:903:1b64:b0:2b7:aa20:3c61 with SMTP id d9443c01a7336-2bf36858f5bmr97140315ad.33.1780274177013; Sun, 31 May 2026 17:36:17 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d:7285:c2ff:fe45:8a32]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bf23b011f7sm111929565ad.41.2026.05.31.17.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2026 17:36:16 -0700 (PDT) From: Rosen Penev To: dmaengine@vger.kernel.org Cc: Peter Ujfalusi , Vinod Koul , Frank Li , Haotian Zhang , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 5/5] dmaengine: ti: omap-dma: use devm for dmaengine registration Date: Sun, 31 May 2026 17:35:53 -0700 Message-ID: <20260601003553.72573-6-rosenp@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260601003553.72573-1-rosenp@gmail.com> References: <20260601003553.72573-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use dmaenginem_async_device_register() instead of dma_async_device_register() so that unregistration is handled automatically by devres on probe failure or driver detach. This lets us drop: - The explicit dma_async_device_unregister() in the of_dma_controller_register error path (devres unwind runs it after omap_dma_free() has emptied the channels list, making the iteration a safe no-op). - The explicit dma_async_device_unregister() and the redundant devm_free_irq() call in the remove path (devres handles both in the correct order after the remove callback returns). Assisted-by: Opencode:Big-Pickle Signed-off-by: Rosen Penev --- drivers/dma/ti/omap-dma.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c index 8c32b7ab50f6..4bf34569d82b 100644 --- a/drivers/dma/ti/omap-dma.c +++ b/drivers/dma/ti/omap-dma.c @@ -1813,7 +1813,7 @@ static int omap_dma_probe(struct platform_device *pdev) } } - rc = dma_async_device_register(&od->ddev); + rc = dmaenginem_async_device_register(&od->ddev); if (rc) { pr_warn("OMAP-DMA: failed to register slave DMA engine device: %d\n", rc); @@ -1838,7 +1838,6 @@ static int omap_dma_probe(struct platform_device *pdev) of_dma_simple_xlate, &omap_dma_info); if (rc) { pr_warn("OMAP-DMA: failed to register DMA controller\n"); - dma_async_device_unregister(&od->ddev); spin_lock_irq(&od->irq_lock); od->irq_enable_mask = 0; omap_dma_glbl_write(od, IRQENABLE_L1, 0); @@ -1870,7 +1869,6 @@ static int omap_dma_probe(struct platform_device *pdev) static void omap_dma_remove(struct platform_device *pdev) { struct omap_dmadev *od = platform_get_drvdata(pdev); - int irq; if (od->cfg->needs_busy_check || od->cfg->may_lose_context) cpu_pm_unregister_notifier(&od->nb); @@ -1878,8 +1876,6 @@ static void omap_dma_remove(struct platform_device *pdev) if (pdev->dev.of_node) of_dma_controller_free(pdev->dev.of_node); - dma_async_device_unregister(&od->ddev); - if (!omap_dma_legacy(od)) { spin_lock_irq(&od->irq_lock); od->irq_enable_mask = 0; @@ -1888,10 +1884,6 @@ static void omap_dma_remove(struct platform_device *pdev) omap_dma_glbl_read(od, IRQENABLE_L1); } - irq = platform_get_irq(pdev, 1); - if (irq > 0) - devm_free_irq(&pdev->dev, irq, od); - omap_dma_free(od); if (od->ll123_supported) -- 2.54.0