From nobody Mon Apr 13 20:05:42 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA2BDC43219 for ; Wed, 16 Nov 2022 14:53:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233574AbiKPOxR (ORCPT ); Wed, 16 Nov 2022 09:53:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233325AbiKPOwz (ORCPT ); Wed, 16 Nov 2022 09:52:55 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4072C3E08C for ; Wed, 16 Nov 2022 06:51:22 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id h9so30334223wrt.0 for ; Wed, 16 Nov 2022 06:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=1o2x75QMXnEx7W9bo3sYlpr0oxVXvlHN3ieGl1S2FPc=; b=3h5rMDTfwHaUo8Tfz7KdfwB3vd9otM7RLbRVqDPrK0mXHyv1qWktN8luJxAvG9UMDw ptRhtrRFo7AHRmoASbdCIto3/QR/kPAn1dnpKfTo1BRm8jVKf1CdVWNI6B/dqCN2oEiV OQvW3fKZCdmfNj/4rsIIsoMV6oaZOUbPkHwuXZcGNlbhlCi/T+LLMiqZhI6FGB6bTij6 esYVmyzfEhXNEu7ZOtZEXtIOOgwyJ4Mu3zesB5R5tgz5FoYz5Ak5K073v1ASb1ru+wyL KNZVjlPwssDLKvMipJXLy7/XSmkETaGDMqq+2+KGtuOW/1TAIaxVwKjGlYh/2fHeP+gK tpkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=1o2x75QMXnEx7W9bo3sYlpr0oxVXvlHN3ieGl1S2FPc=; b=p0T40NdZ5lIhNJVxoTXTl6fCoxvFOFVc0eWvI66KnI/Qfw+wfdaD1garQq8jg0EfMc H0EcPdV5rPZn3etx4kd7glG9o6Lkv38T+hWCxxJZfvCKfd4KqghS1G0dd4/XQ8SdiB4K kc0qD9hdnn38BZdD2dPxuLQJJ5sOavHcvRbJ5/dtWXU8iFO+n6wcsPNGjTRVea1M2YJU czspvNXZXH5yHXVPAtROPJS2h8p6e3tAON8Jdude7CR2NeWhdn3XBvO+X3tnG3PH813A K/3FXuVuYLSkO4eTJ71s+8A/E4+kk0tQssoCcgMWlA4J7coCpeWKA08dPljQg5yq3Ha+ KU5A== X-Gm-Message-State: ANoB5plG9okd/eB3FN/zqUJv2pG7SC8kBV9ZzWfZi7P3joTrdEzlwOw2 DzEnA9JWbvky7qWSgjJuFk5WcA== X-Google-Smtp-Source: AA0mqf6ejUMBaMrkNuhXR4zlkR72Ojcc5WTamVCqnJ1JVDZn9Z20s7tmePtDouHInnYDJrrMipsf2w== X-Received: by 2002:adf:cd06:0:b0:236:5e6a:7c4 with SMTP id w6-20020adfcd06000000b002365e6a07c4mr13998768wrm.150.1668610280721; Wed, 16 Nov 2022 06:51:20 -0800 (PST) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:3f99:5293:49fd:9c5b]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c1c9500b003cfa3a12660sm8641789wms.1.2022.11.16.06.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:51:20 -0800 (PST) From: Nicolas Frayer To: nm@ti.com, ssantosh@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: khilman@baylibre.com, glaroque@baylibre.com, nfrayer@baylibre.com Subject: [PATCH v5 1/2] soc: ti: Convert allocations to devm Date: Wed, 16 Nov 2022 15:51:02 +0100 Message-Id: <20221116145103.26744-2-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221116145103.26744-1-nfrayer@baylibre.com> References: <20221116145103.26744-1-nfrayer@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Changed the memory and resource allocations in the probe function to devm. Also added a remove callback. Signed-off-by: Nicolas Frayer --- drivers/soc/ti/k3-socinfo.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/soc/ti/k3-socinfo.c b/drivers/soc/ti/k3-socinfo.c index 91f441ee6175..19f3e74f5376 100644 --- a/drivers/soc/ti/k3-socinfo.c +++ b/drivers/soc/ti/k3-socinfo.c @@ -96,21 +96,18 @@ static int k3_chipinfo_probe(struct platform_device *pd= ev) partno_id =3D (jtag_id & CTRLMMR_WKUP_JTAGID_PARTNO_MASK) >> CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT; =20 - soc_dev_attr =3D kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); + soc_dev_attr =3D devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), GFP_KERN= EL); if (!soc_dev_attr) return -ENOMEM; =20 - soc_dev_attr->revision =3D kasprintf(GFP_KERNEL, "SR%x.0", variant); - if (!soc_dev_attr->revision) { - ret =3D -ENOMEM; - goto err; - } + soc_dev_attr->revision =3D devm_kasprintf(&pdev->dev, GFP_KERNEL, "SR%x.0= ", variant); + if (!soc_dev_attr->revision) + return -ENOMEM; =20 ret =3D k3_chipinfo_partno_to_names(partno_id, soc_dev_attr); if (ret) { dev_err(dev, "Unknown SoC JTAGID[0x%08X]\n", jtag_id); - ret =3D -ENODEV; - goto err_free_rev; + return -ENODEV; } =20 node =3D of_find_node_by_path("/"); @@ -118,22 +115,26 @@ static int k3_chipinfo_probe(struct platform_device *= pdev) of_node_put(node); =20 soc_dev =3D soc_device_register(soc_dev_attr); - if (IS_ERR(soc_dev)) { - ret =3D PTR_ERR(soc_dev); - goto err_free_rev; - } + if (IS_ERR(soc_dev)) + return PTR_ERR(soc_dev); + + platform_set_drvdata(pdev, soc_dev); =20 dev_info(dev, "Family:%s rev:%s JTAGID[0x%08x] Detected\n", soc_dev_attr->family, soc_dev_attr->revision, jtag_id); =20 return 0; +} + +static int k3_chipinfo_remove(struct platform_device *pdev) +{ + struct soc_device *soc_dev =3D platform_get_drvdata(pdev); =20 -err_free_rev: - kfree(soc_dev_attr->revision); -err: - kfree(soc_dev_attr); - return ret; + if (soc_dev) + soc_device_unregister(soc_dev); + + return 0; } =20 static const struct of_device_id k3_chipinfo_of_match[] =3D { @@ -147,6 +148,7 @@ static struct platform_driver k3_chipinfo_driver =3D { .of_match_table =3D k3_chipinfo_of_match, }, .probe =3D k3_chipinfo_probe, + .remove =3D k3_chipinfo_remove, }; =20 static int __init k3_chipinfo_init(void) --=20 2.25.1 From nobody Mon Apr 13 20:05:42 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE9AFC43217 for ; Wed, 16 Nov 2022 14:53:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233704AbiKPOxV (ORCPT ); Wed, 16 Nov 2022 09:53:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233406AbiKPOwz (ORCPT ); Wed, 16 Nov 2022 09:52:55 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D673E0A0 for ; Wed, 16 Nov 2022 06:51:22 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id c3-20020a1c3503000000b003bd21e3dd7aso1806204wma.1 for ; Wed, 16 Nov 2022 06:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=MIxl+dyuDxJf/KHK5mOk1YlQ1ePtA/R5q7N29MhOEr8=; b=hsyTLKcjJMtC2XIlo46Q4n/wHg0xvqCJltw/e9GWAGSXeqYTbN+AeeOyqDOILQDPRJ VlZPOxei0RyrtZSYQA3/nUxXlLpcmc102QNJPY1zMruofp6isA8A+OthiNqB7h+WTL61 eaYz2Wwmkn0jPyo0z8kloe6eMbP62hjiMFuogEyTt7hQoVPBs+aZaRYnIfuEl8UnrfpH cwpERayw3L2AS8oaa1ZoU+nfs08uXf4umcLLsBRfDM4R4LqY5gkEAlmEpQRknVyGwIxE fdc4YkvXRrGn8kGkQ0sl6ZLDt7qQHJqRMoSMwdl+T1DGuG7RRtnyY/Vg71PItFDfNWVV LAZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=MIxl+dyuDxJf/KHK5mOk1YlQ1ePtA/R5q7N29MhOEr8=; b=DXMgYVIiSQWuAQDA+yPUBrGnHI1YDoByrBiGN6Xrf+D1x7MInef96L/jtAc/MIvbnQ 4VjbpeFZj1OeugQ7yVCKEQxUWtkfS0GO9wSwy3eAc6szWsWNnAJT7RrdSkSQrZ0UxfI4 1CwoJ0tWqvPsKuAUauKyYRqdLtgPeysnK2Rfl90KxagoLYPmzbbnAM49x/DHr34gukQD 84BPTYl3aiFoMu0Cft5gdGf9rOiqP/SmkVOMLqmpF5JoqpJr/xMMs9OM9aQzcTljYgWI Uceb8AeRPLCVMIUN0CUDbDd6NXp3AVw1AJy4jHoUvHx7ZeWz+v9h6b9O/mk5dj/U8A4C ++fw== X-Gm-Message-State: ANoB5pnW1t7mDCsopM+j9gUrczDVxCZ421WeB3rD/ESb+wzlN1FUFQbb ezz4s16+w8xAjqPYuAWsQ5XBtg== X-Google-Smtp-Source: AA0mqf6knMjrYErEYhVRUW3wV7V1cB4HPC7OVJP7YkKtfqykl2aqt1oHvkMg0/AJ124bPHwgFb3NWw== X-Received: by 2002:a1c:541c:0:b0:3cf:774b:ce5a with SMTP id i28-20020a1c541c000000b003cf774bce5amr2520965wmb.0.1668610281465; Wed, 16 Nov 2022 06:51:21 -0800 (PST) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:3f99:5293:49fd:9c5b]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c1c9500b003cfa3a12660sm8641789wms.1.2022.11.16.06.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:51:21 -0800 (PST) From: Nicolas Frayer To: nm@ti.com, ssantosh@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: khilman@baylibre.com, glaroque@baylibre.com, nfrayer@baylibre.com Subject: [PATCH v5 2/2] soc: ti: Add module build support Date: Wed, 16 Nov 2022 15:51:03 +0100 Message-Id: <20221116145103.26744-3-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221116145103.26744-1-nfrayer@baylibre.com> References: <20221116145103.26744-1-nfrayer@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Added module build support for the TI K3 SoC info driver. Signed-off-by: Nicolas Frayer --- arch/arm64/Kconfig.platforms | 1 - drivers/soc/ti/Kconfig | 3 ++- drivers/soc/ti/k3-socinfo.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index d1970adf80ab..912529ac58b3 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -130,7 +130,6 @@ config ARCH_K3 select TI_SCI_PROTOCOL select TI_SCI_INTR_IRQCHIP select TI_SCI_INTA_IRQCHIP - select TI_K3_SOCINFO help This enables support for Texas Instruments' K3 multicore SoC architecture. diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig index e009d9589af4..b944e8bd3a8b 100644 --- a/drivers/soc/ti/Kconfig +++ b/drivers/soc/ti/Kconfig @@ -74,7 +74,8 @@ config TI_K3_RINGACC If unsure, say N. =20 config TI_K3_SOCINFO - bool + tristate "TI K3 SoC info driver" + default ARCH_K3 depends on ARCH_K3 || COMPILE_TEST select SOC_BUS select MFD_SYSCON diff --git a/drivers/soc/ti/k3-socinfo.c b/drivers/soc/ti/k3-socinfo.c index 19f3e74f5376..98348f998e0f 100644 --- a/drivers/soc/ti/k3-socinfo.c +++ b/drivers/soc/ti/k3-socinfo.c @@ -13,6 +13,7 @@ #include #include #include +#include =20 #define CTRLMMR_WKUP_JTAGID_REG 0 /* @@ -141,6 +142,7 @@ static const struct of_device_id k3_chipinfo_of_match[]= =3D { { .compatible =3D "ti,am654-chipid", }, { /* sentinel */ }, }; +MODULE_DEVICE_TABLE(of, k3_chipinfo_of_match); =20 static struct platform_driver k3_chipinfo_driver =3D { .driver =3D { @@ -156,3 +158,12 @@ static int __init k3_chipinfo_init(void) return platform_driver_register(&k3_chipinfo_driver); } subsys_initcall(k3_chipinfo_init); + +static void __exit k3_chipinfo_exit(void) +{ + platform_driver_unregister(&k3_chipinfo_driver); +} +module_exit(k3_chipinfo_exit); + +MODULE_DESCRIPTION("TI K3 SoC info driver"); +MODULE_LICENSE("GPL"); --=20 2.25.1