From patchwork Tue Feb 11 17:28:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13970432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6017C0219E for ; Tue, 11 Feb 2025 17:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3uCUrJt7VGFXarxg9pu00kDCtrwtbeikWaJZ/NE5HnE=; b=piA6lzS1lwfCp7 XzQXF+5mJWzdfPlqs5zXAlJ4mGILnAWV1Vm1+TQFzkcZl0ZfVLqPbyODwRteIcZNo+Y/XL0mYgBAb Yd24ozwFovHae8+AWqXO1GtIIOny+XXdpBF47LjGgCDkpwKicSqhWWy7fohwQlwaawBYaSXVA1eWb Qy14VVojEarMiFE0xaM8QjsIIpAInLYZGMKsAw2soZGMKsq5BWsVmc+MCqCKdZyw/77utomPoexTx Vkp2sVvCFY2VN2ebsDG/IiOrWXWJvmTfzTR/73YQjl53FoGVkv7/gz9DFBhU/bMvrRE1zNTP8Khin +lkjUZyRk+OiCPp5X68w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1thuHi-00000004iQV-3FGq; Tue, 11 Feb 2025 17:42:58 +0000 Received: from mail-wr1-f43.google.com ([209.85.221.43]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1thu3s-00000004g5w-47to for linux-riscv@lists.infradead.org; Tue, 11 Feb 2025 17:28:42 +0000 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-38dd011ff8bso3384192f8f.0 for ; Tue, 11 Feb 2025 09:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1739294919; x=1739899719; darn=lists.infradead.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=YiUH4lqEkZUY+Ysux6Yiqp87vOhypZIO5pd5GZP5Rxo=; b=DwFiIFthXd166YWDwsiSvS2hdx3/ha3YjZ/ZP4U+YhYypNcTa0gi1vgYJATMBdenUj aOeM06hBEZ9fuDzH2HsoVbyZjzsCOoynGW7q1UVa36OQ3bbcd1mz8pEIet2rw0t2wd6C fLNI2Q3MzvTp6PmCAdvt3jgXGOjX/eh5FFpfvWdMyv/FTfoW6QI8qhzY8HjIsnjwt6tv a+DiZrqJ7ru3w9S5Dwh7ROZ+YRjOeFoLoK4bNidu2JFDcqVVhspdIEjxa6om9glW7d2Q OHlcobFD6UaMjd0C5F30MrSHk1zZK6P+nsGL9j8+xQnCGYSWZA/cLd1zVG7+1fPHPFFW Qk9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739294919; x=1739899719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YiUH4lqEkZUY+Ysux6Yiqp87vOhypZIO5pd5GZP5Rxo=; b=FZ7kJVJHD9eMBwGNAyk2CbgIq4jhXdoFIR6IBoLX1hdgbJ8YZKekiOjnbS0E9bRWM7 d1MfHgyA6b3KtsgF2ajlZ7wnKIreEEklYrH+dhRWXl2FFR9ddp+5C9q4zA7biics4A7T 3kYFosN2upPVIMVStEEUbEVyzMvDClGOdreUudRfZcgisW8FiYqtAZV6tZ7MFfCdn9Dx 8COX/a2YHyt0BXOVr77JLz0KQZD0O8dXew2wBqdZsI6U+wBwgGkQwM2aRYYrNI/P24a9 4yqwQTySWGegN6PA4ZK4PZ+cWMZnKvaF0LM1RL9z5pNMjvFiAUmU67pGMG7IA2fjzYG2 BIvQ== X-Forwarded-Encrypted: i=1; AJvYcCW49dDWqWFGC4qruS1npmjQCi3GtmaIcGpLJTCO2a1V4VfQ1Du2R+0us/yp84K+0aRm3U31RhpcHnRifA==@lists.infradead.org X-Gm-Message-State: AOJu0Yy039dXHLZ6JILVa+zr4x41kVrVWFj327cEKtq7EmUNQGvPiOhY CuNDPSV97TU4p3D/DTf0knh6PcgwtdBYOYj4rH9fS6GLl1SR6wIo/ujM2CUcqE4= X-Gm-Gg: ASbGncts9w8mmNk5LucIu7ETGjiSrrE8nfMubqDutIndAcBK5CF6O/NqtARc7KHGg5B 8gUubQ5Vsx9/lhYtCdLMgcYllv0dAX3qNXWav+NVJ+aSsjB4EOEr8y4vc2STQhjfC7gJYSBtcnD qNEyI1snD47rXHG4qU12I12VbNyWRMjAlfl9nM79I3LFQDpdnBbT8ZLu3pvjbgawzc6CTHl8XcR 4+T0fFSf6nKuAbmB2VasUnFdzr0e1vd1hPK8Tl7KEntU+mYZcNeh5P/e/HANKMDEsa5B5Dc8Y5d USToTOupuWCi5ixCwg== X-Google-Smtp-Source: AGHT+IGWxF7f1yWAujS2u+KdxRxs6BCZ2vWSSXW9ul24NRbBrNVcf/bzFVrq/LcbH1iHWIudtU2p/Q== X-Received: by 2002:a5d:5f42:0:b0:38d:e250:d962 with SMTP id ffacd0b85a97d-38de937cef8mr592405f8f.30.1739294919069; Tue, 11 Feb 2025 09:28:39 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:fc0c:6c04:7ae0:c5c2]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38dc6c80df2sm13691082f8f.18.2025.02.11.09.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2025 09:28:38 -0800 (PST) From: Jerome Brunet To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , "Rafael J. Wysocki" , Stephen Boyd , Arnd Bergmann , Danilo Krummrich , Conor Dooley , Daire McNamara , Philipp Zabel , Douglas Anderson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Bryan O'Donoghue , Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?q?Th=C3=A9o_Lebrun?= , Michael Turquette , Abel Vesa , Peng Fan , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Kevin Hilman , Martin Blumenstingl Cc: Jerome Brunet , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: [PATCH v3 6/7] clk: clk-imx8mp-audiomix: use the auxiliary device creation helper Date: Tue, 11 Feb 2025 18:28:03 +0100 Message-ID: <20250211-aux-device-create-helper-v3-6-7edb50524909@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com> References: <20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2845; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=yh1X3NdDCdUsA9BLxtXchkn9/M7vIhxyVwRqzsjlThI=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBnq4g60PKNni6dfU5BjvUnV/GlJm8Z/Gp+nsWrU 9ZnwgOS2NiJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZ6uIOgAKCRDm/A8cN/La hbC0EACdDyfv4ruNFNCmp9zrJN9GhUKhduy0uDZfmX9xFwkj19yNB791PVovwlCxBtsVN+6iC4q rwLI3P4vdZ1EwlqCmVrmNdGoLnghwRNHwHALo5QxefOPT4NljAxW1vZtixroQfv2C49vYyO6W4P kJzYPrSQ5gCAhV9vK40Lrk3hKz6idlpK6fP6E452DnIlVkMEuBRhoWIYcW3UYiHeM8GZVGnhBCD gSJilnljJ5OTQH+GOh4JJ+ljp3eDNfLB8W4KHF0CAyQTUEMe8AcjK03WlL/wYkVKOkgcGkEcQp9 BIY3F82Fe2CRnNyNNI0avHJK4Dow3qn7iDNJJpC3ovn48iYglF/d0jXmcEMhXhQpSbeKMeTqa7J fP6G9puoFGrvGncXPPVDyslRM/0C+t+9jrKuXcFKpUC6JEFDzD6J5ZEVwY4UiSURMnLq30q2O/b Ji2uLCAtXuMOhYX2lnsQA5d17uDRDdwUJp8XCH4Oz6Dnb2S55Fsz9tvBGlSUODkUiKV8l+xyrVc 1dbrvgTF+WDlDaLoybOYZRNVsuxR6nnuPg843dEMXQ4KBAAvubECmtqd3Rp4YaM5ppqsxBeoFzV cuZaX5kv0Po8QUX3SAVM7K3Fpx7ZYg1fo5142KlYv+iDGalSNmwxlsLmgMTIAr8JL2LCqw+Y9jn uIY7Dp1qPMaPorQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250211_092841_033735_D1F22CA7 X-CRM114-Status: GOOD ( 14.67 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The auxiliary device creation of this driver is simple enough to use the available auxiliary device creation helper. Use it and remove some boilerplate code. Signed-off-by: Jerome Brunet --- drivers/clk/imx/clk-imx8mp-audiomix.c | 56 ++++------------------------------- 1 file changed, 6 insertions(+), 50 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c b/drivers/clk/imx/clk-imx8mp-audiomix.c index c409fc7e061869988f83c7df3ef7860500426323..988a5fffeb4e0e481ec57038d9d1f1b43432fc98 100644 --- a/drivers/clk/imx/clk-imx8mp-audiomix.c +++ b/drivers/clk/imx/clk-imx8mp-audiomix.c @@ -228,64 +228,20 @@ struct clk_imx8mp_audiomix_priv { struct clk_hw_onecell_data clk_data; }; -#if IS_ENABLED(CONFIG_RESET_CONTROLLER) - -static void clk_imx8mp_audiomix_reset_unregister_adev(void *_adev) -{ - struct auxiliary_device *adev = _adev; - - auxiliary_device_delete(adev); - auxiliary_device_uninit(adev); -} - -static void clk_imx8mp_audiomix_reset_adev_release(struct device *dev) +static int clk_imx8mp_audiomix_reset_controller_register(struct device *dev) { - struct auxiliary_device *adev = to_auxiliary_dev(dev); - - kfree(adev); -} - -static int clk_imx8mp_audiomix_reset_controller_register(struct device *dev, - struct clk_imx8mp_audiomix_priv *priv) -{ - struct auxiliary_device *adev __free(kfree) = NULL; - int ret; + struct auxiliary_device *adev; if (!of_property_present(dev->of_node, "#reset-cells")) return 0; - adev = kzalloc(sizeof(*adev), GFP_KERNEL); - if (!adev) - return -ENOMEM; - - adev->name = "reset"; - adev->dev.parent = dev; - adev->dev.release = clk_imx8mp_audiomix_reset_adev_release; - - ret = auxiliary_device_init(adev); - if (ret) - return ret; - - ret = auxiliary_device_add(adev); - if (ret) { - auxiliary_device_uninit(adev); - return ret; - } - - return devm_add_action_or_reset(dev, clk_imx8mp_audiomix_reset_unregister_adev, - no_free_ptr(adev)); -} - -#else /* !CONFIG_RESET_CONTROLLER */ + adev = devm_auxiliary_device_create(dev, "reset", NULL, 0); + if (IS_ERR_OR_NULL(adev)) + return PTR_ERR(adev); -static int clk_imx8mp_audiomix_reset_controller_register(struct device *dev, - struct clk_imx8mp_audiomix_priv *priv) -{ return 0; } -#endif /* !CONFIG_RESET_CONTROLLER */ - static void clk_imx8mp_audiomix_save_restore(struct device *dev, bool save) { struct clk_imx8mp_audiomix_priv *priv = dev_get_drvdata(dev); @@ -408,7 +364,7 @@ static int clk_imx8mp_audiomix_probe(struct platform_device *pdev) if (ret) goto err_clk_register; - ret = clk_imx8mp_audiomix_reset_controller_register(dev, priv); + ret = clk_imx8mp_audiomix_reset_controller_register(dev); if (ret) goto err_clk_register;