From nobody Wed Apr 15 14:13:24 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 D37AFC433FE for ; Thu, 17 Nov 2022 09:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233320AbiKQJ4K (ORCPT ); Thu, 17 Nov 2022 04:56:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239421AbiKQJzc (ORCPT ); Thu, 17 Nov 2022 04:55:32 -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 77FDB43AFE for ; Thu, 17 Nov 2022 01:54:29 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id z14so2875160wrn.7 for ; Thu, 17 Nov 2022 01:54:29 -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=F2sxDaqNmyRFU3z4S0Onk+bOJP0mQcW/5PONPT8SXUJziEIvIo/1FwHHO266M0witV ZIFDxUV1eikIhGo9ZFkzd20h8+WtXuGnEJy6mulsQkRanw4LYXkuWlIFJVVwbJ7m6job rTy8mAbNoqlqhz0GudToFxJL5w97RH56WUrfTNItIIMzKamn2Qwee972p2Ou1uzWG8F2 eHVUL6mFW7uBV78aAIyZq58qk8rHKMXpRA+sEne3sEs7lHEFLYVWLxePOqy/6ZcMg1ha DfwDX/SWL7qboeqAHfvN7bhyE2lo4pk8iQa5e8nkwvkXDCWJagqjI1f+VY+owbjgyn/0 2JCg== 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=w/xDNNhgJleQdtMjsCmvZpn40hBxkeQIF/C8vTJxQCUqz9GRHoMEiwpXw0MLwT0qzh VwsjCcWr/XvS68OmKEut2CqVxIb+pMt6NZkBm5FsDn806M9xflUU7yQDOhYgMhM4Kfn9 kwMAgtdHygb36ADKCSGNuvyL2sCbE1ZGmFUDsviVCk1Pai60s8bhu1+0ixwvaa1+rX6t zbqcv+7EBBZxsuqLnNqRIPAX8xBKlSoBqe454ogqJ10oCXWqNNpBAwEFO3dqWFvqThFK ksh6wD7klufREJ8+LgGui4fQoP/Cc5BKtuCyHQ2G/KzCQZxUu4XjYPRhjj/DGl0S90Y3 9hhg== X-Gm-Message-State: ANoB5pnpczyDf8hEesXpslD1SBSimL2hGWz8sHrZXhiyZgPFZ7UWgal+ RUkOzh0w0Loeyg/KGKVQTOrVJg== X-Google-Smtp-Source: AA0mqf6DQq9HKMbJVhBHzcujBbtwoXJUJKNe0Bf2Bb0RioItGpEc2WaOe6H3EboIddDlE1YESX6pTQ== X-Received: by 2002:a5d:58c7:0:b0:236:60f3:d28f with SMTP id o7-20020a5d58c7000000b0023660f3d28fmr976253wrf.454.1668678867980; Thu, 17 Nov 2022 01:54:27 -0800 (PST) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:9287:74a3:4740:e7a0]) by smtp.gmail.com with ESMTPSA id v18-20020a5d6112000000b00236e834f050sm497021wrt.35.2022.11.17.01.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 01:54:27 -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 v6 1/2] soc: ti: k3-socinfo: Convert allocations to devm Date: Thu, 17 Nov 2022 10:54:18 +0100 Message-Id: <20221117095419.171906-2-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117095419.171906-1-nfrayer@baylibre.com> References: <20221117095419.171906-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 Reviewed-by: Kevin Hilman --- 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 Wed Apr 15 14:13:24 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 1BC91C4332F for ; Thu, 17 Nov 2022 09:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239504AbiKQJz4 (ORCPT ); Thu, 17 Nov 2022 04:55:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239420AbiKQJzc (ORCPT ); Thu, 17 Nov 2022 04:55:32 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32F6C7721B for ; Thu, 17 Nov 2022 01:54:30 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id cl5so2848151wrb.9 for ; Thu, 17 Nov 2022 01:54:30 -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=Ge4h32WeUIGGUsdbGaeuk/Z15cXvVv3yHykriwBprs8=; b=M841FhfJxObnrtEdbOtKlI0HLA5EgEowM7jaDkLFjHo+tSzLuXoqvpgB1W9CQQRSUc WcPNX/YceioFB0+Ml+eMl+I/hZSIGBE2NhE7Gk4hREUP5LujErdd0HWMLEMnA/ZlevcA +/gvqiuSx+X9b/mjXWZVJshxmkO3rgLb9fQ09CIZBeVsYDEFDmIPICcILs4xjHRMuE4o svl+8lFebrbRSZ0uoFUK4+lXFujmpz9/jeneQJ99kbUzLnxR7XlXoGE5jgdvp6+T7Y/s nVVV5It5qbuK1EB9DXk8kA3zpOGSjwA94caU9eop3kaIwOo7NWlLTw8yvk6uTIkQQcO/ /y6w== 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=Ge4h32WeUIGGUsdbGaeuk/Z15cXvVv3yHykriwBprs8=; b=4p04p4hpXjDe0es4m9SOSwXzjg6AIpYvDDFsVa0ov4604R2lYObehN2QJiKFh3mJV+ HxfQU/lHxmaBKpSg4pDZrKsbw7aMYgTeDAux7rQlUKFbYiE8nxk10XE0nUAhN+BKfvf7 Z5xohp60y9NMW2OGulZd+nnOtH7no2wtR7pMRsXqXVBXBWJlgRsLontV5sqzQEvqBlFA kMmtxdL4yaSjAkxau/3190MXzuvTXRXJD3NQN6rQhkfo3cbfg9NJe7aPFX1CHLFmV6xt 1HLyJ7SEo+GS0uWvzjHeFoXzvgE/cJlYGAaSVRjGRkIjQ9gxyh7SHr4ICOKIcV3tUhmi WfSQ== X-Gm-Message-State: ANoB5plkjMflvzX2mzgQlV9JHPpJ6p463HO1Kl/xK9dJjncAIjo/iSkA bUquEgOf7puWcNKEKbZe5vvhXA== X-Google-Smtp-Source: AA0mqf6l0cQKDF/K1HFMIuXcsrD+LUWBqTwTOQ+o6QUUg5NOe9UpujiBnif5Ji3qGRkiw+9jw/SAWg== X-Received: by 2002:adf:e648:0:b0:236:774e:5b78 with SMTP id b8-20020adfe648000000b00236774e5b78mr980201wrn.351.1668678868797; Thu, 17 Nov 2022 01:54:28 -0800 (PST) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:9287:74a3:4740:e7a0]) by smtp.gmail.com with ESMTPSA id v18-20020a5d6112000000b00236e834f050sm497021wrt.35.2022.11.17.01.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 01:54:28 -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 v6 2/2] soc: ti: k3-socinfo: Add module build support Date: Thu, 17 Nov 2022 10:54:19 +0100 Message-Id: <20221117095419.171906-3-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117095419.171906-1-nfrayer@baylibre.com> References: <20221117095419.171906-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 Reviewed-by: Kevin Hilman --- 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 76580b932e44..4f2f92eb499f 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 7e2fb1c16af1..3244fa8a5b0e 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