Message ID | 20231016101436.7146-6-kkartik@nvidia.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78091CDB465 for <linux-mm@archiver.kernel.org>; Mon, 16 Oct 2023 10:15:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 102228D0059; Mon, 16 Oct 2023 06:15:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 08B2F8D0001; Mon, 16 Oct 2023 06:15:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E46678D0059; Mon, 16 Oct 2023 06:15:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CDC628D0001 for <linux-mm@kvack.org>; Mon, 16 Oct 2023 06:15:36 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AE903160BC4 for <linux-mm@kvack.org>; Mon, 16 Oct 2023 10:15:36 +0000 (UTC) X-FDA: 81350917872.14.2283730 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2055.outbound.protection.outlook.com [40.107.243.55]) by imf14.hostedemail.com (Postfix) with ESMTP id C3425100026 for <linux-mm@kvack.org>; Mon, 16 Oct 2023 10:15:33 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Q0KCnjBj; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf14.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.243.55 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451333; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=W4cZtQZh4u2QpHjpgHfMxErgsbKI6kUdquPwO9/TEVc2G/ML+l7WTbjMDTg60C9bPFAgVz PbKIkaMcVmCPCTB1o1NsAQ2R14HZSV8zX/VqqNL4r7ffGwmUEqlQEQ265Q2cgvq5p2i5C+ yTWiPLc8heOiBemX5ipvsPoyynBk3EE= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451333; a=rsa-sha256; cv=pass; b=21Qstzu167SzkOAF1GEwe2SDrtAlcbLPym5nI2mTBIoI89Guhe83w3X/bWVipOR5c4HDDS sDJoeWUOvQBVCgTxv5UFX5nTM3hG83eOvqcG7sl69dgRZWDDYX+S66kojI2T8XQxfhIEqY UF9amzwOKHwxxbXL3buLYbFg8tMLzdg= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Q0KCnjBj; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf14.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.243.55 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=foYmv0pVzymGenQmeCJ2M7Y9BlLVVhsn04awBQoVViJZlUujE5jVzZc4uiFrilSO5l5V1q49TRnqIy5UAVg04XI5Ysh47ZVOvj+u+vPU4xgcE2Py0bQGpS9OgPOZ2jYofuAlr7BVINdz8AX3zU0r5WfOm8K4BONjVcmCt549kh1OmLDEWoqmOPEimrem8WzJ59wMqY9pH0uJmSe0PLV7AuXDWwfRXP2pHPDw6TzlNBLKbAxWr4cYBYJ+xmq+zjMFH1YXB/j9TMbVazcO0G5PCDVnTmVpy8SG4uM1GG/f5xTsS9Eov8EwDTcnSNv2zpBmyEMLfb8WO9DG3d4Jx4HA2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=Jo6YVWh24Czukgvo1w7wMHq/vCMzi57nfaDIQQlT3Nx3brZLsbQ0zdv2u1ZymJUoNuOCcWx0vbjkanqJhC6vn8yzkLH1N20sKMJBs2cv/U7GR4KyUye28QnCjQtpQY/+P90/bAOwf8qrL7Fx+OQs+xpIIQhqGeZQqCd2eEsotL3B2Y9TmHSc9FMw95ZRbs8X59p21puUE5ccEK8bBRPTcKz07/REDN31AA6fm3YMQosNFgCXm7nZLAg5jDQqTk4XVQi3udCfz9yA4bfo8nVCJeDpdQ//dUbyLKCPS2QhGdnyWl7yD7t24x2dvW5krixmrxhHbpHmvYnKa1PAYbbSng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=Q0KCnjBjaWIYsP3gV6WZik7Xaw2efOFp5lC9IpdTpe+GO9+G32zLS0wkx2EXBpWwYMmmAgO5R2hWlE8xm+OXo0MoNoUwUlOYe/jPvnX9z5jvpHxrqL0fNJnvLVvZyU30oBkahm7Sx/ijYCoLOY+XLFbOKSOygaB4CKXXVAmOADWvj67stOqmiSHGk84I74JKb1uVi4CJzNSJg0Si9guUIml9WD3aS+6dBhBfdxYJ2AFL04Nm1mm9aS8EccnE68S3NPr0czhDh0wePGsx0KF3aCFvcuEeJuWY5laaxO94bJrD1FRT3MJPnLnInXo7BKH5Ae46WOmUHAyydD/+QveVhQ== Received: from DM6PR10CA0003.namprd10.prod.outlook.com (2603:10b6:5:60::16) by BL1PR12MB5078.namprd12.prod.outlook.com (2603:10b6:208:313::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 10:15:31 +0000 Received: from DS3PEPF000099D5.namprd04.prod.outlook.com (2603:10b6:5:60:cafe::38) by DM6PR10CA0003.outlook.office365.com (2603:10b6:5:60::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 10:15:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF000099D5.mail.protection.outlook.com (10.167.17.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:31 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:18 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:17 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:12 -0700 From: Kartik <kkartik@nvidia.com> To: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>, <keescook@chromium.org>, <andy@kernel.org>, <akpm@linux-foundation.org>, <arnd@arndb.de>, <ulf.hansson@linaro.org>, <linus.walleij@linaro.org>, <kkartik@nvidia.com>, <pshete@nvidia.com>, <petlozup@nvidia.com>, <frank.li@vivo.com>, <robh@kernel.org>, <stefank@nvidia.com>, <pdeschrijver@nvidia.com>, <linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-hardening@vger.kernel.org>, <linux-mm@kvack.org> Subject: [PATCH v6 5/8] soc/tegra: fuse: Add function to add lookups Date: Mon, 16 Oct 2023 15:44:33 +0530 Message-ID: <20231016101436.7146-6-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D5:EE_|BL1PR12MB5078:EE_ X-MS-Office365-Filtering-Correlation-Id: b62457a4-14b7-4380-8e55-08dbce30d411 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mk0LP8BUIStzTxQ2wtmF3yyB/C5EOqvazvEOHseQ7JBPFt37IU4PoQo4BWxSHtph2TKHnt/MFE/iWT36/KEVKoqt9J5HDeuSLUybBoMCvAOrLoFuQGkbyqI4MnnHlY/omDCx5/CHqEUUh50v6YY71flzvxji457HK++wMBcHH2RFARpGDvU3EX/Y0mDnos8LfYhATF/FXBuXNVvP4eGfQsHmrMYxiweeFY0ews8BzsKxQVHk+WJy+Yx48wPzxtEvK29qD+RVpHX1S9dyLBSqtZkhzNE4mowiUOHqZINSZh8+Wls8kz+R/ruZf9xq2iXw17tS9BGOh5XY/T0b2/dO+t9rwPs9hFmBrTILKeFqKXcHH2JHNLwUapDI+oTyTUjYl5dOTF9vYlyN3IgxJ7BNE9qmsmEhWwwTgMqgh34NSNdbx/favm80gMtwwnbz/W9BucCqOWzU/IpgJ5Bw2wIzR+hJuLDcAQKqBOrh8mX5E2x8PDZBOJKR9TAfuq98lpdk966W50RKVOE0YI5iQCXknRAy70NVYlqrDSLqThaYNcKBVK1vnysKUzg5NFoZlcYOdQSaC1zFmirtXuBBpWlvYhn8/5fIl2iZFKsBeau7YU7hcLP2+Zi+dHKkxWkMXdlwautHCgwwFGqgDdqaqF7qn7xLGH7QxxO7alJyHyGwfvDIG053CmHgAsFt0VmzIl4a3XwVnuKfCiH4zc7mg0dvsazyCGUnipLJqu5mNWfKL2SvuhMnXr69vE/pQqgS9cxKmdDLbjpOwViHDCvzBYQSbB9+9O1W63Mi7DzF9V9k6uzDi9VrHZagHUzJ/2oE7oDZqyt37ty9+Sgld0kpZae7fg== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(1800799009)(186009)(64100799003)(82310400011)(451199024)(36840700001)(46966006)(40470700004)(47076005)(478600001)(6666004)(70206006)(70586007)(316002)(110136005)(1076003)(26005)(2616005)(336012)(426003)(8676002)(8936002)(7416002)(2906002)(5660300002)(41300700001)(36756003)(7636003)(86362001)(921005)(356005)(36860700001)(83380400001)(82740400003)(40460700003)(40480700001)(334744004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:31.3167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b62457a4-14b7-4380-8e55-08dbce30d411 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D5.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5078 X-Stat-Signature: o9u6jqrbp1uc3aesj7sm6cyp9zprhugm X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C3425100026 X-Rspam-User: X-HE-Tag: 1697451333-754209 X-HE-Meta: U2FsdGVkX19l41XhA6TP7o1FzG5kIctnoZM2U4I4NNtozY+94clX1P+pxPcekq/Ebfp7r2x9Nm0+umUXkbBHTpk9jL/DUEE9zKqWlBdZZr1iavyzAQKoHKiu0YK9Au17rzv05fADlo2enK3es2vCcSY56/jU3PbRRzcY76j+smpi+k68tK+YuewCCpHyMwdkE1MbfS8aUPH5lQF2IHa1rQihuIGc6jW7R1inQPMLgu0NDo10wA/zLlel7uTOYKvgKi6tusKm9tpvttgnMPM07g927TuTsCBMM/PO+89KEyUhnuMshiJTWyVLrthuT+jlXs2+U9MTebnvvOhYXwiKpjGkBLgv4qbOP9B6q8NLOksCkLdDABq9juvMO180zR2ffn3AwBMRfgknpQ61QcrwI1q68yt5D+PE5p0VDaocW1/g+ujkoAtbzHs2O0J/5vRPqK6YDO0uNn5xQCNktC5imBoCTo7MHbT/i4V+zFVdj1k1Lv/N0zwWukWxerOPfaxafBX5Fr8g6d4MuKOFPkx4bG8mEhKG0u014dbCZp3jHg6qNUCLVEPFo5H1r7DsCofREdqEyM7nI5pVQHxqjqKGwC9GU7NJhCvUQrgkhUmlI1GIorptlBwDZuqkJYPdiloDLI4PG0JldNy6DqqHgNH6ysBxSPniIlxQohdlOo8EbrTIU1eXuIFOK54HjU5ZCVZBppSneUF+5VNnRPqNHT5OUGkLWuN/UkWWA9tEok9t5q3EXMObyc7Nmez+wPuAI+ZgPcnTgnugzr6GMJ7EzbhEAsGUOKpOcVBPXS8zK4gjeFTzfGY6Puja++vSagS9+of4T0RaYMPXO8H5IjJfSfQrT3y+R+/g5KtQyKPWGq+y0yNWj4EzICoS8gtMWZA8ooOGTK/Lx0njW1TtW1HhSMnybSwtvKCMrCB2468ho1wkWz+fM2mFly0mAXUVuAVIIkXXpODoF81Z4Mf8tQF0VvD BawCj7Al 9/JER78/uvY1tZDxnDmZ21SQyReokmxjEUE08zd7eIm90bjct9PWetE+vaUIxfhXr4cZ5vH8jJk5dDJGakhedDPj4T4RAHPRKI2ocf4GOFDnMrm3yG6spvNhU3S3O+zNjm5QEN01uj3b1Mgo9AIcXVvVXyN5s+46lPk6YKW+es19ghEu8Ovh3EZaXO/u96PQGW53LMhtiS0liseWrwBKKk4j/10l87gzvj21nHogddICZgZ2woD1NkVaYVTSrkZdILe3dDadYPGFBQcV4xPWcUKk8eF0V99rbf0HVUG03TqM2pka3HW/OPqMzOxpwpIaPLxQSUUf5Zzu2Ckq1W+xaUYBrhg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
soc/tegra: fuse: Add ACPI support
|
expand
|
diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 98805885158e..4ebb5597a77b 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -113,6 +113,18 @@ static void tegra_fuse_restore(void *base) fuse->clk = NULL; } +static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) +{ + fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups), + fuse->soc->num_lookups, GFP_KERNEL); + if (!fuse->lookups) + return -ENOMEM; + + nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); + + return 0; +} + static int tegra_fuse_probe(struct platform_device *pdev) { void __iomem *base = fuse->base; @@ -398,6 +410,7 @@ static int __init tegra_init_fuse(void) const struct of_device_id *match; struct device_node *np; struct resource regs; + int err; tegra_init_apbmisc(); @@ -495,15 +508,11 @@ static int __init tegra_init_fuse(void) pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); - if (fuse->soc->lookups) { - size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups; + err = tegra_fuse_add_lookups(fuse); + if (err) + pr_err("failed to add FUSE lookups\n"); - fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL); - if (fuse->lookups) - nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); - } - - return 0; + return err; } early_initcall(tegra_init_fuse);
Add helper function tegra_fuse_add_lookups() to register Tegra fuse nvmem lookups. So, this can be shared between tegra_fuse_init() and ACPI probe, which is to be introduced later. Use kmemdup_array to duplicate fuse->soc->lookups. Signed-off-by: Kartik <kkartik@nvidia.com> --- v3 -> v4: * Use kmemdup_array to duplicate fuse->soc->lookups. * Return err at the end of tegra_fuse_probe to remove redundant code. v1 -> v2: * Use size_mul to calculate lookups array size. --- drivers/soc/tegra/fuse/fuse-tegra.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)