From patchwork Mon Oct 3 16:22:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Frayer X-Patchwork-Id: 12997669 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 A972DC433F5 for ; Mon, 3 Oct 2022 16:24:15 +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=Y3sKAdONOzdPqyPhHHaphOp7WRXEtZtfPPnE268jcCw=; b=rGDdx8A4S/MrQH a8IvbDZHM4E7q4OuIfgM0TctnMhFG3y4p25FFUn158QLq4x/W96ELUZc/rvB4Pna1Zh4SfcgViSuA zCluxSAdkKH5UmmUx+b2fGJkBcHMKyVb0M49gnlq7HgYS9XVnXmtgNNYw0XOEFO3dfXahMhiPn9Rx WeuJf11joB/MHbUcVQTyGu+XE5aAFgAFfQDJTogz7N/1HHuK4hvvStBA34nxxdWgOeZZ/wd61+rHG xeQEjt1iwDA3YH+AZU2UknWctP7q4q0BvmJALsbd02ktgl+tS2BmUcifcdJUzpa+qiVflxt51dG5s Pee7baQKyZUHadKw8PoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofODn-006jtv-GJ; Mon, 03 Oct 2022 16:23:11 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofODZ-006jkv-VA for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 16:23:03 +0000 Received: by mail-wm1-x332.google.com with SMTP id d12-20020a05600c3acc00b003b4c12e47f3so6114727wms.4 for ; Mon, 03 Oct 2022 09:22:54 -0700 (PDT) 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; bh=Vm4TpO3JY+1vWDls351l9UZb/Y7basVTL7Grm/yg+jM=; b=yYR6LKSmAZpSxokSxEbfYCHsJt0L9EhXrQz2BCR+OUUdNKgKcUYJXkJt3gQRYFBbUh 1EKFWtd2fZrgvpTKVE75r0Fw1GVXqB9HiC/3e+KebkzKnBghZcXI2vDP/ND83wu9Tc+2 BLKI7+VyEcUARtZHMuNGTDpq3WVsZhtPapZNl5fKyEGhdwa2W+xbkb9aMunbwWOVzoEa H7AFJXXywsYdp46zvP8hr0w3nSW3pcgfzkGFlh6vDRFeuoAxqAeAGb3qLebsEsRWwZZG KHCzZSSjwPpX9q0YItHtdfbof/wI9PbqKEKHz6LDjpJR3XA+kxIeZd3w1KrwRhcPfCkx Xgsg== 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; bh=Vm4TpO3JY+1vWDls351l9UZb/Y7basVTL7Grm/yg+jM=; b=aNTFYXS97tASVo8iNsvCuq1zQ6ZWdDe2Cd49tD/0vHsjFbv+hLY97v5bsdwl7On6c3 WLDqr9g8z/RkgsEH4es9eFOHTaDBekD2ENeCGQf5+8fL56TeCvOPdexQLg7iQoMbeT12 fPSh5fc0yZOcdhPd06fepYSgxUq1t3hPqZ7rdpXsyCc0hNZEo4tUFTiLk3h7obwj+Ezx ByEMERv5wycqhmazbIhlC4m7HtrbK3KNFD0Ksi/InbEyqQnDSZ3YEZUF61pp9MnjByBl 4DRIcTzsaS/UbmmMinPMd3gW4cq5KI88DjJlBTpSuEUV06HTCYT5SANv5p5PZ/GDP5Zi PD4g== X-Gm-Message-State: ACrzQf3YFscp1Rc52m46o7znOYdcPPORqI2tOda8IGr6zOYdfMgmidwv dcOU0smM7Uz3DXo+8HdYk5FJAw== X-Google-Smtp-Source: AMsMyM7iBQpmrvrPhRSQHqhIdExMihROfbTYBdhq2fnqtHZmsod8yYUp/QGRWTVKnv7pDHy/ZOOmHA== X-Received: by 2002:a05:600c:2043:b0:3b3:c84c:ca33 with SMTP id p3-20020a05600c204300b003b3c84cca33mr7388136wmg.15.1664814173612; Mon, 03 Oct 2022 09:22:53 -0700 (PDT) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:2304:5860:1e75:709c]) by smtp.gmail.com with ESMTPSA id w10-20020a05600c474a00b003b4ac05a8a4sm21926967wmo.27.2022.10.03.09.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 09:22:53 -0700 (PDT) From: Nicolas Frayer To: nm@ti.com, ssantosh@kernel.org Cc: linux-arm-kernel@lists.infradead.org, khilman@baylibre.com, glaroque@baylibre.com, granquet@baylibre.com, Nicolas Frayer Subject: [PATCH RESEND 1/2] soc: ti: Convert allocations to devm Date: Mon, 3 Oct 2022 18:22:36 +0200 Message-Id: <20221003162237.30451-2-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221003162237.30451-1-nfrayer@baylibre.com> References: <20221003162237.30451-1-nfrayer@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221003_092258_030401_A4EE4803 X-CRM114-Status: GOOD ( 15.62 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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..a29f5a23395f 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 *pdev) partno_id = (jtag_id & CTRLMMR_WKUP_JTAGID_PARTNO_MASK) >> CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT; - soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); + soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), GFP_KERNEL); if (!soc_dev_attr) return -ENOMEM; - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%x.0", variant); - if (!soc_dev_attr->revision) { - ret = -ENOMEM; - goto err; - } + soc_dev_attr->revision = devm_kasprintf(&pdev->dev, GFP_KERNEL, "SR%x.0", variant); + if (!soc_dev_attr->revision) + return -ENOMEM; ret = k3_chipinfo_partno_to_names(partno_id, soc_dev_attr); if (ret) { dev_err(dev, "Unknown SoC JTAGID[0x%08X]\n", jtag_id); - ret = -ENODEV; - goto err_free_rev; + return -ENODEV; } node = of_find_node_by_path("/"); @@ -118,22 +115,26 @@ static int k3_chipinfo_probe(struct platform_device *pdev) of_node_put(node); soc_dev = soc_device_register(soc_dev_attr); - if (IS_ERR(soc_dev)) { - ret = PTR_ERR(soc_dev); - goto err_free_rev; - } + if (IS_ERR(soc_dev)) + return PTR_ERR(soc_dev); + + platform_set_drvdata(pdev, soc_dev); dev_info(dev, "Family:%s rev:%s JTAGID[0x%08x] Detected\n", soc_dev_attr->family, soc_dev_attr->revision, jtag_id); return 0; +} + +static int k3_chipinfo_remove(struct platform_device *pdev) +{ + struct soc_device *soc_dev = platform_get_drvdata(pdev); -err_free_rev: - kfree(soc_dev_attr->revision); -err: - kfree(soc_dev_attr); - return ret; + if (soc_dev != NULL) + soc_device_unregister(soc_dev); + + return 0; } static const struct of_device_id k3_chipinfo_of_match[] = { @@ -147,6 +148,7 @@ static struct platform_driver k3_chipinfo_driver = { .of_match_table = k3_chipinfo_of_match, }, .probe = k3_chipinfo_probe, + .remove = k3_chipinfo_remove, }; static int __init k3_chipinfo_init(void) From patchwork Mon Oct 3 16:22:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Frayer X-Patchwork-Id: 12997670 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 4EF3DC43217 for ; Mon, 3 Oct 2022 16:24:21 +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=noI2VP6nZYxqc3PRa+OQHq7/kOVSEhd0rMBHlwD7Z7s=; b=TxYX2oKDnauSQ7 ox/kJ1CfmKy64lhIyG5LU34TBi0KMW7f9NUkLpNo4uW4Vrw2Isu2fy0Pg4f6DW6iZRxrRQhP4yv88 FOqaEpMINwp1/9LUs0/vPpw4W8j8vmJ0wcCjYgUag5fHHQE4njs+bUcd9UFmmoHhiupd3CgEprhKF PtsuWO9bAR9qBJvulp00L6KVPX3WkFvIN8h9jOc3ublE/Hf8uGLGTtSHJr+t4xqt3ogmMTPgz1d7M mcttIN3ivJvxdvOO7f70gVovtv1NAWO7teyquG5XnEj/CVKR3wj/YBZGdx+b/z1EG+heb2pLBEI2S xvHTrgWCEHa3MQwWp4fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofODz-006jzt-PG; Mon, 03 Oct 2022 16:23:23 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofODi-006jm3-WF for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 16:23:12 +0000 Received: by mail-wr1-x429.google.com with SMTP id b7so9900485wrq.9 for ; Mon, 03 Oct 2022 09:22:57 -0700 (PDT) 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; bh=udUbQ+1obdJHz0cNtfdA+qf3/bqQhChlbdPQ4dYxXqw=; b=LqF4RGXfu3sY4+wLkmmyDuLkUyoRA9bDO0plJrhBSPKP41u9otSCh04Zhp4dnKRL3c b797ULhAHLJZQcXV6kizxO8a5RwBzwI9ZrLpO896rhkNIUMO5Zwv7a0qNL64+itMDaxs K8+bNws+cWKOxqDfZT09cpLUFeDZltDdWB/LkcChCvAKDKeXSZ+I2yEOxolMfgRzfqdb BeLA8tmlGiyALf8hI437RPxJqJAlV1M555brtCdLXF4zSXLUhzE3RKDzgxs0gX3FWBQQ vRxdWGMAQ3UthwRJpehKJflB9w5t2sdhLWcf8f32nN6XJzoy5mrAFcYaKYm5i9vry2sD TRaQ== 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; bh=udUbQ+1obdJHz0cNtfdA+qf3/bqQhChlbdPQ4dYxXqw=; b=Dxzu0TN3/jvcT6kcTxVZZ3t+nLVc63R4e8wtQM7nMrKiU+mWpVz+f59ONAPRuKPJj/ YW/W5DGvdsx2mBgfFPaHtHHN5CqDAwi6ZYSqJeH97qF2/ySx16LiXnTwCkSJd/2xrmYL D0EllFvbJ7F/pHfSXc9Dfv7X3lqCUwE0OUtfO2jRbTY92hu1KZxzLzb4j0358udwT089 x19oIuItEjvtIbckvz0BROd77+jTUiLzDgO3BHHUJ/P6MS21Y+7mZeBdBRQhfhJAUuQM iEk87Na/+FO+tACHja9JfFkltCX3ClwugYN8pPx2eQyZ3v8Uip8pcfg1RP6QWBgUCPQR bJ0A== X-Gm-Message-State: ACrzQf3NwrcPoHBpzZfTzQAeDByt04dC74tgyP+3zQWvzVt2Iq2BfbH9 mwMEa8pW4ccHWU/+9nxyN+M6eg== X-Google-Smtp-Source: AMsMyM5BKO75auRTG2pK14RIosYhokrImrQUcMiG+8fjBuvmsogahZJuMnJ3ch+GfT6TuHSxY94amw== X-Received: by 2002:a5d:6c6b:0:b0:225:dde:ab40 with SMTP id r11-20020a5d6c6b000000b002250ddeab40mr13660838wrz.690.1664814175993; Mon, 03 Oct 2022 09:22:55 -0700 (PDT) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:2304:5860:1e75:709c]) by smtp.gmail.com with ESMTPSA id w10-20020a05600c474a00b003b4ac05a8a4sm21926967wmo.27.2022.10.03.09.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 09:22:55 -0700 (PDT) From: Nicolas Frayer To: nm@ti.com, ssantosh@kernel.org Cc: linux-arm-kernel@lists.infradead.org, khilman@baylibre.com, glaroque@baylibre.com, granquet@baylibre.com, Nicolas Frayer Subject: [PATCH RESEND 2/2] soc: ti: Add module build support Date: Mon, 3 Oct 2022 18:22:37 +0200 Message-Id: <20221003162237.30451-3-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221003162237.30451-1-nfrayer@baylibre.com> References: <20221003162237.30451-1-nfrayer@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221003_092307_064062_3F0BFB3F X-CRM114-Status: GOOD ( 14.03 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 74e9e9de3759..85e645c6ab40 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -131,7 +131,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..bc55f977f032 100644 --- a/drivers/soc/ti/Kconfig +++ b/drivers/soc/ti/Kconfig @@ -74,7 +74,8 @@ config TI_K3_RINGACC If unsure, say N. config TI_K3_SOCINFO - bool + tristate "TI K3 SoC info driver" + default m 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 a29f5a23395f..ee22bb886b8f 100644 --- a/drivers/soc/ti/k3-socinfo.c +++ b/drivers/soc/ti/k3-socinfo.c @@ -13,6 +13,7 @@ #include #include #include +#include #define CTRLMMR_WKUP_JTAGID_REG 0 /* @@ -141,6 +142,7 @@ static const struct of_device_id k3_chipinfo_of_match[] = { { .compatible = "ti,am654-chipid", }, { /* sentinel */ }, }; +MODULE_DEVICE_TABLE(of, k3_chipinfo_of_match); static struct platform_driver k3_chipinfo_driver = { .driver = { @@ -151,8 +153,7 @@ static struct platform_driver k3_chipinfo_driver = { .remove = k3_chipinfo_remove, }; -static int __init k3_chipinfo_init(void) -{ - return platform_driver_register(&k3_chipinfo_driver); -} -subsys_initcall(k3_chipinfo_init); +module_platform_driver(k3_chipinfo_driver); + +MODULE_DESCRIPTION("TI K3 SoC info driver"); +MODULE_LICENSE("GPL v2");