From patchwork Sat Feb 24 11:45:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 205825 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1105330dyb; Sat, 24 Feb 2024 03:47:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXuVgGfqTN+EIGOjYKFtaMhKo6hhh/sXjZW1/DKNHRuJenIT9wU1msq9XKMfI3oe7bfA8Imx+FLL9u6aKgONRdviInFYw== X-Google-Smtp-Source: AGHT+IEjDgJFGD5bZrSZuKtgUwP11S7tnCc/D5DRkGqxMxJJujqmGt9ttwQBEj0HCutLyRjp71uo X-Received: by 2002:a05:6a21:2d8c:b0:1a0:f1dd:eb5c with SMTP id ty12-20020a056a212d8c00b001a0f1ddeb5cmr460430pzb.0.1708775256201; Sat, 24 Feb 2024 03:47:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708775256; cv=pass; d=google.com; s=arc-20160816; b=GMFrWvldp8vYKqt6ZY/d7ni8TAjAnM9G6oWi/BAKQve7Z3iwEpiBmZ0+bfMRW2ITev xTThzyHa+ShTX6ulv57xQXsx841FBIAqLQEPn0ELFufZRYpqkeyw+o7fuHKXPEjrAw7b O4ox1YmpkChS8i52iVmon3BbGoP577W7XpMbw/WC0ndsu3MQcnzjReE8Z0Rg7efRtcDb qP43wEOLzqHV+5QWGjXL6Pa668vPiKT4y/gIHqmL2GZEfL84HariHpO1wRPKEnL/0ywO Rs+we7J1GRJcKrS+8LGkuGKYhksKVxNIe5cXZ1rzeaUWoWH0oUiXjgaFWf3+fjMtrsZ0 SacA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1mR91Nlk8bU7hN1mKQvT/jofMFqB5jMPs1+IzmpRfSw=; fh=fOoBdycKl22DA+Q4ONYo9zOShRZP9uJfcKe6T9LiXEc=; b=eX3r/N4vIvJDEeSVuy92p1VzTMElaS0umCnYvjNPOGs4r8NrE13VmsQo2EMtOykGU3 8Y2b2tPTJPHiteFCPrNabBuN13+QJr0PfaGj5ImVg5KV2zfP2L3xFFNSXyB+J5rdYbkI z9fkSxOS7uipXA/CIhVyBmyr4PZYavrXTLnFktpsjNt9P17k/kDlprN3AZT3kDUEZeIX LI0pxdSq/5OrnbQb8HJrg103yFJz47N+2EAGiaEeytT+sB+1BjzoSPQwiKqRWV6uGTKj 0CnrZzWlaRWFEIqwSQMoTPSiIbe6Yefy38ArINV56SsH1sK2I54w8GHss30brR+h6M4w IZ5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GuVkbI/f"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-79609-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79609-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k16-20020aa788d0000000b006e0733b3439si790623pff.296.2024.02.24.03.47.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 03:47:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79609-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GuVkbI/f"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-79609-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79609-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0B97A283C6F for ; Sat, 24 Feb 2024 11:47:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 006B447A5D; Sat, 24 Feb 2024 11:45:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GuVkbI/f" Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FC2D3F9D4 for ; Sat, 24 Feb 2024 11:45:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708775152; cv=none; b=mYZ7ndDyFABaZZOzfi5d8sA4FGdAAtgpkTV3aKYCooYXF6MbTLtjIpiDZW82xStmVPgYcY1GK/mSERD1O5b/RnrayA/NOwj9KtX2lYJ9ymVqMhTq81IEdj+S3zYTefSB82W8bfAelQiilAfnmQtbUKcfUoh0L69DfVh32u/RKew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708775152; c=relaxed/simple; bh=LBYbJJcKNkovxCNxqMFmQnZVJ0MhhcOaMIIez5oaN/0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KUokQgrWDc7nk5gKa6pp6vm3C8lh0VURq7Q6MvX3T2+n77k36Rp2PxyItxe38LyQAqa27JE/FdQzZ4DIFMy865VFwjdf0F6dp6VoGiLo2+/MOYqWnHO710+ORvbJz0MFf9o0kSsUvqDidWnME9T5BmY8QrtSpC0nXLhNl5YJFHg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=GuVkbI/f; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a3e75e30d36so319555566b.1 for ; Sat, 24 Feb 2024 03:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708775148; x=1709379948; darn=vger.kernel.org; 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=1mR91Nlk8bU7hN1mKQvT/jofMFqB5jMPs1+IzmpRfSw=; b=GuVkbI/fjSAXY/O+/Wkp5ShwKRPx8j2PanpK8m/lK8FLdfR93EAlF5oC75ss2vKKyL Atx5DiHRPqS5MGcqgVgchZbAzDpvEy7a7RfO3CcfMhXUiVrtSjwkWzu4Z28KnPOYLN+h xlKnuNxkC7dsfrSJ1PDjO6X+96mO3PzZOPgzSgJJkTpecIVDWpVHZVabYIEwPjxwMV7U /XM2DTIjaez9ynCn34LB6mErhRkJpxGLrv45/P4auRcYaFhHDSK5f5A0qzfbQWA8o0mR 6bs7q04auqpN8/LYSFQhRd6RK+R12OJ7uhDT0O/70yR9+WxCVVOIBb8kw275Ew3JJn2p Xydg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708775148; x=1709379948; 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=1mR91Nlk8bU7hN1mKQvT/jofMFqB5jMPs1+IzmpRfSw=; b=UKDLN0g2Z9gFxA/tBZHZR7uQj0Gc22GWV5KXZzacumKJ15VA0gnNbKjAN7cNBPHl1z Isj5oPRYvJGlIuZVoDVgR4rfQw98ejlRm+uO4h8dd9vOabjYmPA1ZYBZfGNtW+0BdSE2 h0kJsUlVHEKuOJsGmkfDSEFPkqYLlbfg/5Q31HwqiTTfAHLfcrlPWA0IyIP4ZoZ658gR 5kTaqwC4JQbIAzteuq/hQLpygGTAJdN7J0sLGzY2nrURglV4KG3lrGp0NFnQ2lchUZv4 WoqIN8CRxGI7CDwSjpbUTQRXZQwdtUwoqIhg3Dy1W+UHRnjx7+0qY+PDHYpCyH/Les+4 470A== X-Gm-Message-State: AOJu0YwufAth07UWmM3NIWYZ2k/xEk+6fkLefgDVjxj8D7JEP+azwiGL Cr6y8gdHEFCyuuDdpLdJz5ADZPYs057ZwujzhHhS8b0IMcqZxeVGdxcBDNr4uyo= X-Received: by 2002:a17:906:718d:b0:a3f:8dea:85f7 with SMTP id h13-20020a170906718d00b00a3f8dea85f7mr1958294ejk.15.1708775148504; Sat, 24 Feb 2024 03:45:48 -0800 (PST) Received: from localhost.localdomain (82-132-212-111.dab.02.net. [82.132.212.111]) by smtp.gmail.com with ESMTPSA id jp10-20020a170906f74a00b00a3e209b225asm517826ejb.43.2024.02.24.03.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 03:45:48 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Praveen Teja Kundanala , Kalyani Akula , Srinivas Kandagatla Subject: [PATCH 06/11] nvmem: zynqmp_nvmem: zynqmp_nvmem_probe cleanup Date: Sat, 24 Feb 2024 11:45:11 +0000 Message-Id: <20240224114516.86365-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240224114516.86365-1-srinivas.kandagatla@linaro.org> References: <20240224114516.86365-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2643; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=P2cGF0VtfcCt36gLWA03f5z+B2HP6m3MQtEOR09ei5k=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBl2dbLtUXHVO3V0pwG/elzGVXwkjhsvd+/Oq7tJ sXVBhpvAyeJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZdnWywAKCRB6of1ZxzRV N9SQB/4v0TpoIJ/h4H9frZHRj07Cv7m/Xs4KHhUbSNlOiTTOqlDYYFwliOI5GYjjEbFAiPZI8ce k/wToFqt2g88Ezdg1SB9soMp+tQEvJ3vqSkCFTm7vqUFZcBL52mVbh42O+HK0JTrLkUsDqTuYN8 3F+ljhIIXWfx6pim4kXdR1rXv9HBrIUkajLy/4tToHCgmz9HpmcvEOp6U8gA96duF8M54LTxEly klKtR5hqwaZCX21dy8owqvYwfcK6pzBAQBBn+xuwcu/XZA7hNc2PoX6OrBPtspaBFHH9Gbg/0Sr 0L0/CVx2v7Y9wDaDTTgmHCWXGW7YzSKS1uTQiCSNYPAikHOS X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791780722927307956 X-GMAIL-MSGID: 1791780722927307956 From: Praveen Teja Kundanala - Remove static nvmem_config declaration - Remove zynqmp_nvmem_data Signed-off-by: Praveen Teja Kundanala Acked-by: Kalyani Akula Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/zynqmp_nvmem.c | 37 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/nvmem/zynqmp_nvmem.c b/drivers/nvmem/zynqmp_nvmem.c index 7f15aa89a9d0..391d8e88b270 100644 --- a/drivers/nvmem/zynqmp_nvmem.c +++ b/drivers/nvmem/zynqmp_nvmem.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2019 Xilinx, Inc. + * Copyright (C) 2022 - 2023, Advanced Micro Devices, Inc. */ #include @@ -11,36 +12,25 @@ #define SILICON_REVISION_MASK 0xF -struct zynqmp_nvmem_data { - struct device *dev; - struct nvmem_device *nvmem; -}; static int zynqmp_nvmem_read(void *context, unsigned int offset, void *val, size_t bytes) { + struct device *dev = context; int ret; - int idcode, version; - struct zynqmp_nvmem_data *priv = context; + int idcode; + int version; ret = zynqmp_pm_get_chipid(&idcode, &version); if (ret < 0) return ret; - dev_dbg(priv->dev, "Read chipid val %x %x\n", idcode, version); + dev_dbg(dev, "Read chipid val %x %x\n", idcode, version); *(int *)val = version & SILICON_REVISION_MASK; return 0; } -static struct nvmem_config econfig = { - .name = "zynqmp-nvmem", - .owner = THIS_MODULE, - .word_size = 1, - .size = 1, - .read_only = true, -}; - static const struct of_device_id zynqmp_nvmem_match[] = { { .compatible = "xlnx,zynqmp-nvmem-fw", }, { /* sentinel */ }, @@ -50,21 +40,18 @@ MODULE_DEVICE_TABLE(of, zynqmp_nvmem_match); static int zynqmp_nvmem_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct zynqmp_nvmem_data *priv; + struct nvmem_config econfig = {}; - priv = devm_kzalloc(dev, sizeof(struct zynqmp_nvmem_data), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - priv->dev = dev; + econfig.name = "zynqmp-nvmem"; + econfig.owner = THIS_MODULE; + econfig.word_size = 1; + econfig.size = 1; econfig.dev = dev; econfig.add_legacy_fixed_of_cells = true; + econfig.read_only = true; econfig.reg_read = zynqmp_nvmem_read; - econfig.priv = priv; - - priv->nvmem = devm_nvmem_register(dev, &econfig); - return PTR_ERR_OR_ZERO(priv->nvmem); + return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &econfig)); } static struct platform_driver zynqmp_nvmem_driver = {