From patchwork Mon Oct 10 13:15: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: 13002580 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 3F904C433F5 for ; Mon, 10 Oct 2022 13:17:11 +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=kXpL8IT597Ke9FzBwKCV7oJ4R5vhwNp0Q5MqauKzsp4=; b=RYRfV1ZM9rHOLS skvga48p8IFYJcjiL0eJVULl5NiYZQtFqC3J14JZXqHEFn9RDrD3rN5v23vwRMRAKIMpeRHpY6UF8 StGD9ZqFU/ZL5Vz/P72lU5Y4UBB+5/WYaT8cIIZcX8ej/G06bFcfUiFC7ddkQJpC5m7Bwa4r+uWkJ IsBtSkRRf540IDHja8kBDhoTs4WzZm9y2Z5yNwS6WNfP+kOp4DT8BYeRd1sEvdLhitGtr9bZ9XNN9 UV2Ev6YvLUjN3znJ3SlM3zNUGG6ik/QN0h6qtR1l2BkcItKbKOgS/MUJHSNCVgxnvpOTXvY4gKPNE to+PIfJMzAIc9e/kaLCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohsdg-000zLM-VK; Mon, 10 Oct 2022 13:16:13 +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 1ohsdP-000zGH-OB for linux-arm-kernel@lists.infradead.org; Mon, 10 Oct 2022 13:15:57 +0000 Received: by mail-wm1-x332.google.com with SMTP id l16-20020a05600c4f1000b003c6c0d2a445so335271wmq.4 for ; Mon, 10 Oct 2022 06:15:55 -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 :message-id:reply-to; bh=qLxER1Bc4Cb8rJkHZ6/zcim8Vi82bUeWN4IV0cotQO4=; b=xHYPcrMNOxzhcqJjflVJH71h6IDjKfO/hImGeC53aP3OTfE1yOfTu6WMB4ifJfM2pn yEjfQJNwNG1pKrd/fxc4z8HET4c+dCCWEMbNofpQCaIhluX6z6whFfgUy/XDu8xtiYhZ IT85WNb6smH9LT6lUHM83EFeVR1ykXEoCCPrTPXERUPAJLcjiSWJq5RhcPJLOjVGjmCO QAElA98f9mS5uNbBsevTAmHkbrrOu6u28wADLkQ+g1HHpc2nGkd6R9ruHc07t6+pnYk2 VcwtUxcVvgCm+PO/Ct3VATHEpSsP6hCDb/r17yYvmzvSo77Zo3lr2gJg+ek+elydF/m/ XHdg== 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=qLxER1Bc4Cb8rJkHZ6/zcim8Vi82bUeWN4IV0cotQO4=; b=U4JE/vC1E/VOfilbiNilKdc5UO10ZNrVayA1r1hAyYnv/+nSeOFTnaJ60vaAvHjIac PvG/39VwFOeX3DfpOdWm2lqjDvOlDw2/Q9fhOtxV9CwPDIuTj9L/ZZHyiMQ1gl9j/t9n uaZPHRoLSEGEHp2zjlpAjo09Bv1noqJGcQVz8+eYL/udg+7f7pKRtu0TWUG+D4AxCYMG 7ZiobaSoRSN5rY3Qb3TOY8qbhwGUPCrePbzZOh5Gc6LLX2VFaY+BaUYbRjOTF/O6dCjU wiDaZx4AFkZBD31N3QxxA7dhNVkTjWhM5eW5vpmfGEzYUhtf5UYXmAHnx2qtAqhNVOmi oGdA== X-Gm-Message-State: ACrzQf1TUJccHId2E/EVYFAzbSSHevXoCsT1vMRHUcTD23O77FgbpNsX eaPeEeNpKKJyau4nwyZ+c88IBg== X-Google-Smtp-Source: AMsMyM7qWrCfoqDWIHvXcTAFcGH8yWUDEQyCCXS00fM5oi2JuREBmmTO6ZTLyc1qJZ2hhrTWlOBluw== X-Received: by 2002:a05:600c:b4e:b0:3c5:c61c:8e20 with SMTP id k14-20020a05600c0b4e00b003c5c61c8e20mr5225361wmr.103.1665407753867; Mon, 10 Oct 2022 06:15:53 -0700 (PDT) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:f62:307f:b07a:ff0e]) by smtp.gmail.com with ESMTPSA id a8-20020a1cf008000000b003a6a3595edasm9930780wmb.27.2022.10.10.06.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 06:15: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 v2 1/2] soc: ti: Convert allocations to devm Date: Mon, 10 Oct 2022 15:15:37 +0200 Message-Id: <20221010131538.7333-2-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010131538.7333-1-nfrayer@baylibre.com> References: <20221010131538.7333-1-nfrayer@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221010_061555_811861_D4503770 X-CRM114-Status: GOOD ( 16.17 ) 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 e6047b23a86f..3311797145ed 100644 --- a/drivers/soc/ti/k3-socinfo.c +++ b/drivers/soc/ti/k3-socinfo.c @@ -97,21 +97,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("/"); @@ -119,22 +116,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[] = { @@ -148,6 +149,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 10 13:15:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Frayer X-Patchwork-Id: 13002581 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 C7A87C433F5 for ; Mon, 10 Oct 2022 13:17: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=2BEtFhmCeFJ0TSr1T//6N/X2itTDdV2PejlvFv3+hH0=; b=lnz4IAVWWLfNzB UVwKwMEIlJBMQlLZOmnuQFP+4pLJixBUHjdeu7Dt9XofP0zaXFA8RUya0Pz1E2WKbTVoI0YbZuW4S XS03Ysj7JDLIxY3IgCllhRrtB7rfQlhU5GbsosBoTWLF+HMHH5oLdcz+ZT3kmcYll68CmM+cbrOkM e5AYo5TTrcirwLQRRYmHaU4ph1Lsm6YLPGQdOyNSGP7kGXEhF1hMytpE7WQNLgSRC2dbO0LM6uGPe rfApQkCSu6By7wEKpPrDeHpYNmCDiFnJq0OkfTsAMXH6QeVilazlc5oMRbDVkkdTWtI4Ju3X2sEVY hENRMPh6eeQ4lJepIm4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohsdp-000zNT-SO; Mon, 10 Oct 2022 13:16:21 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohsdR-000zH3-ED for linux-arm-kernel@lists.infradead.org; Mon, 10 Oct 2022 13:15:59 +0000 Received: by mail-wm1-x333.google.com with SMTP id v130-20020a1cac88000000b003bcde03bd44so8519616wme.5 for ; Mon, 10 Oct 2022 06:15: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 :message-id:reply-to; bh=OuegMI0iJ2gqAWQPv2zipKenKcpnoMmI237TqduaJeg=; b=H6ONJKDvHm9KMMNo0Lmol0k8oI+ptuo759uGUssYfwEo9OtmWPvwrC6oajjDbp00N5 JwNbiYm5K92HXAupUGNnO7RzVikCh+5A+13Boh5jNnvb1BfzBbl6ArwDy0RKStOyI4oU qldBk2kFWdfX0NpP8TfQBOFr0QbldHAEZpwPlgkk048mKX3RVmzlxJ4p1HhX3emsu/xy pmomkhzs5C0SpuaJfMQoUj4QpHcvzsio3E7ppjoSY4A2DsHrIvOeSGLtf/2Ul4xdCJX+ P3ia/8gab/z7aqLFGpJYaleuen8q7vF+bip8oY5FkBIm5vhXdGnajFgjMLRc3Aj64ILz C4TA== 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=OuegMI0iJ2gqAWQPv2zipKenKcpnoMmI237TqduaJeg=; b=j1HXtqEYNwX4FaP90DpcVXl3OEPT5EFuk79xnStt+5NzURpwD0dfvebJTwwT5eLulw JeACtXVnK3C4tRb2ivqh+UInr7R4E97PQUN8JQcD10xnyfG+qtrAmw+JNooiiiWOq/JP L0kDJeoJC4Vv8E7MPgYResN/ngKWR0ACm4xS907SeJkY3IZXtY4JvUMdxpY7+2+s5/2v 0GAvQmbPzZan6TFvPnpJUmqYHfesyhO3+7in4T8v0iXUBEBsMBXPJeUt9h3vac9DxvB0 2jHSpp29+nAPM1LTLEkYRsxXiytm2UoeU7IW7jmrb768Oy2/ld7//eJA1tIry+hvLvxB HA9Q== X-Gm-Message-State: ACrzQf0jYVQCm501gqMVmCJRAhM53tDEjIA3ED9UjiZKj9EJy60E+2h3 J8wiGQu4RXVjKcAemaDDiti1nA== X-Google-Smtp-Source: AMsMyM7WswzFNN2OZ+T8WBTOJm4H/SToWKRRFK+ai2+jAoD00fSXXI3279QYr7gP/QnocY5uI776+Q== X-Received: by 2002:a05:600c:538b:b0:3c6:b66d:4027 with SMTP id hg11-20020a05600c538b00b003c6b66d4027mr3120833wmb.146.1665407755918; Mon, 10 Oct 2022 06:15:55 -0700 (PDT) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:f62:307f:b07a:ff0e]) by smtp.gmail.com with ESMTPSA id a8-20020a1cf008000000b003a6a3595edasm9930780wmb.27.2022.10.10.06.15.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 06:15: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 v2 2/2] soc: ti: Add module build support Date: Mon, 10 Oct 2022 15:15:38 +0200 Message-Id: <20221010131538.7333-3-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010131538.7333-1-nfrayer@baylibre.com> References: <20221010131538.7333-1-nfrayer@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221010_061557_538673_7B7F2E30 X-CRM114-Status: GOOD ( 14.84 ) 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 889e78f40a25..31b628fdd4b1 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -112,7 +112,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 56c41eac33f8..a10bea0cdf90 100644 --- a/drivers/soc/ti/Kconfig +++ b/drivers/soc/ti/Kconfig @@ -85,7 +85,8 @@ config TI_K3_RINGACC If unsure, say N. config TI_K3_SOCINFO - bool + tristate "TI K3 SoC info driver" + default y 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 3311797145ed..dd275f338e06 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 /* @@ -142,6 +143,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 = { @@ -152,8 +154,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");