From patchwork Fri Sep 30 17:28:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Frayer X-Patchwork-Id: 12995816 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 3D438C433FE for ; Fri, 30 Sep 2022 17:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232415AbiI3R3S (ORCPT ); Fri, 30 Sep 2022 13:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbiI3R3A (ORCPT ); Fri, 30 Sep 2022 13:29:00 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 607661C2FB8 for ; Fri, 30 Sep 2022 10:28:39 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id n10so7844187wrw.12 for ; Fri, 30 Sep 2022 10:28:39 -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=AG1ywY7gc8eweWCRMYD9l1xeuVWvjrZWx7+dHX3zI3CH7biq0V/89BLSi7C3ohPn42 SMqTVcktNRBVpC6qkQVA+/cGJD1x/Ptk7VD4q4RyWdqGT7idOX+3TWdXzakQs2hu1rPo lcLrGbleSxVQp4Q8cAnbEC2/AbbAYmAkesLMbn10rEg+JD/OqWQUaGkiEnMsoZ0dl/mJ 0W+O18C4E5oLv52iokVkjg6r+9ocy0SOTZ8xZvs8tCXn5PsMZFojlzChs9o7vdvd104/ KNensBBdH9lMjBgO2Lv7sInwJlZ8Rb9EppzWUtx/CnVaG0j0Z6kdMkxYOsZsBsSkXH8x 4Q0A== 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=ispxDh6qa+xL38a/QpTO0Nzc0bu6D443EZx+8cMdCT795Og3w+49gGhqY3eO5ETHAZ jE/QSyTUoqv4NkDq5bGRfLeLUvNGCu7wcwyO1xgHrg/DccKc3G+9kInkj3hlH0iRAE0M rUq2AkTLSCfw6N2XXGAzG5jnsh+zM6qLL6uOCeMJhku5fXGI/MUGmw/wIkrtDYaHOJRT FE/x4VH7udRIBPPUTPn89BQOj8//PsxX7jyNmFCXyw8ibdEsMiiU7NRI5UYHduslHyLD Na82gMzNdwZR4dQrQpMPFWisWhsRPZ1L7uJxIdIZVi29pxLEeD8Z/zUIKCw85Qup3OAy +sKw== X-Gm-Message-State: ACrzQf14zYiDvuyRdbIwxows12sR6eL3BDyaUPLqAcWJVXtoTn7j7LMF ITgWJJMDBQxWm4OtFiueMgBMbzrHwXUZ9Trw X-Google-Smtp-Source: AMsMyM446LRNJW8x7k8pG0/1PnITT3jj7wcPLz8OsFiS1LUmRhSfNehfesLHnoNyFBZ0Yo+ifaGZjw== X-Received: by 2002:adf:b34a:0:b0:22c:bd74:1f06 with SMTP id k10-20020adfb34a000000b0022cbd741f06mr6794434wrd.77.1664558917678; Fri, 30 Sep 2022 10:28:37 -0700 (PDT) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:1a56:87a1:b5b8:453b]) by smtp.gmail.com with ESMTPSA id bv14-20020a0560001f0e00b0022ae8b862a7sm2525407wrb.35.2022.09.30.10.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 10:28:37 -0700 (PDT) From: Nicolas Frayer To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, khilman@baylibre.com, glaroque@baylibre.com, granquet@baylibre.com, Nicolas Frayer Subject: [PATCH 1/2] soc: ti: Convert allocations to devm Date: Fri, 30 Sep 2022 19:28:09 +0200 Message-Id: <20220930172810.199758-2-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220930172810.199758-1-nfrayer@baylibre.com> References: <20220930172810.199758-1-nfrayer@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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 Fri Sep 30 17:28:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Frayer X-Patchwork-Id: 12995817 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 D62B2C4332F for ; Fri, 30 Sep 2022 17:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232297AbiI3R3S (ORCPT ); Fri, 30 Sep 2022 13:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232418AbiI3R3A (ORCPT ); Fri, 30 Sep 2022 13:29:00 -0400 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 B3F4F1C5C8B for ; Fri, 30 Sep 2022 10:28:39 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id u10so7738584wrq.2 for ; Fri, 30 Sep 2022 10:28:39 -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=vOX431yMJ2kXB0H34KHaSrROuD5cceT8cYtdInWKv7JjDFQmVX+zL40HEbqOH7ad40 LsLJJ/CaYxKbjtb5EhhhZcqHTvJh03EASdD4vvMDUsMsqa+J0FaPUwASk19v1IIckoJo kW3xdkUpLZ8NXwnu0gw3Z1BnSlDvI16jNjvy+T2RUeLbHxUjuyjE4Nj0ujen1SCwvKSe mpSwsLGdAeQTxkTFuEQ95AMiqdW2ren9Gd+efl0f5hyGywH/3TRBh8JTP/aZ5fj0BHj4 fctkXeoB+VDLlxZ5KooxhwKWeMSxpi5ZW1JpePueZpRYpLj+2aqyfbD27UBVolSQbKFm 7M9w== 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=QXnTDZSvgB/5Q5qIZaNsy/eHNO7XMlB8cPT8tlNzI2wHDIk+uiYCtVtvV5wuLKj5+x NurEzE69TfSseaAaE8S9Cwkp72Dh0fSdNppVW1g7yr+dL7bbofVB6VWWD9Xe2vzL6f/i ILjKAKEubnSx82x1/R7mey6Tjw/IuTVbZI2w1JLtC4BcqA/v1DC3HwjVru3KDA9Z6oBC 2UC0xy2OjMC/NvB15+DSk9nEiJeMovEhjvbkI5LE+7aflNWGMPaQSJ9H8i6uu0ohZe6V IH5MShSIBPkL7ndsiAukdvrRZg+cdMGBFbTnBkUTuzOx0MGMalZ0e3VmlNMtCKmv911z VRGg== X-Gm-Message-State: ACrzQf1kxF/vMUThMMlxciezrnm+FcE1ya0DBKvju+Eto14RQBJ8kW7N I/KCyBfsdSCWoQZQpUxu7r2SAsuQcETOiyiR X-Google-Smtp-Source: AMsMyM5z0aIR4tqJnzY+7kYVsz/PbqXsfeoXI2uj0g4xirdZr0rAyy8DDQNjLP2adf2sS4YbCpnh9g== X-Received: by 2002:a05:6000:68c:b0:22a:bde3:f8cc with SMTP id bo12-20020a056000068c00b0022abde3f8ccmr6370777wrb.556.1664558918274; Fri, 30 Sep 2022 10:28:38 -0700 (PDT) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:1a56:87a1:b5b8:453b]) by smtp.gmail.com with ESMTPSA id bv14-20020a0560001f0e00b0022ae8b862a7sm2525407wrb.35.2022.09.30.10.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 10:28:38 -0700 (PDT) From: Nicolas Frayer To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, khilman@baylibre.com, glaroque@baylibre.com, granquet@baylibre.com, Nicolas Frayer Subject: [PATCH 2/2] soc: ti: Add module build support Date: Fri, 30 Sep 2022 19:28:10 +0200 Message-Id: <20220930172810.199758-3-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220930172810.199758-1-nfrayer@baylibre.com> References: <20220930172810.199758-1-nfrayer@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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");