From patchwork Fri Dec 15 11:15:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 179179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9195172dys; Fri, 15 Dec 2023 03:16:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwialeUm40lmljivp47xn1Ui8rBvAQQdkiJaGmXP53eN/8+nz8uqRDfsQD7+l+05D06SMc X-Received: by 2002:a67:ef44:0:b0:464:77f2:557 with SMTP id k4-20020a67ef44000000b0046477f20557mr8775690vsr.41.1702639017551; Fri, 15 Dec 2023 03:16:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702639017; cv=none; d=google.com; s=arc-20160816; b=0ykf3W6PTZW2haCty2qtBWqcEEr6OjcoiqV6udH/OoLATP5uU76saIQwat+nskeCPD 9StcPZdh6IZd9xeoa7ktcNxX12+tolmN9I9SbvngbkJswdf9wb3+7lFIp2qZuyCp93hj NEscTAx1gv56JZjIyoneiu7JG/YKLzHlFSL5rJkFK6M0kWTTvY7olo1l9ZJQhJoroXem j26GelYv4QNB2iGHRJy9quFyzA1oHV1GMDG09Ppwwg1co6lhJ8RiCk69evpcXN4Uu6C0 WX3nHnCZiyrwHDxRlJfjaGmFhS1iXd+vPfu3C6+AIfCHkmYWB71m8Vv0wP508XLFo7Qk HZ5w== ARC-Message-Signature: i=1; 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=dS63jOQC9GkVvD/V3gnNGxfqDZcjIOnsJFZBb/UDQUo=; fh=ALEjuxmQYbWgig+wIxLy2TTD1IH/EIEdEUBXAEoBMwU=; b=Nlg8JTNLSlLZEPd8c7AUMFQRg/umloQ0hl6H5TjtGEyJwRn9ieQB9PtiiCtWMfFz/w 418gIitOa+cQnz0tW8sUFhGPcOIW+g5+aUI/rD6UpzMSSCjq9DfP1W3SLXW9/2yqsJ7Y qXP6mq5Z2GiZOXlFCr1Djeqr6djMo0jSYA6rZyjvrj88ORg4wMl0utmJ5PoX4izoslf9 /1Dilo48oViOtq+JIU5p9Uv8OkXmzDA13lzlkZI+D8Zo/esc/PDDnZ5ZaFcIyo296PaB 26hSM85l5MRf1E4CeJ4oI1bCeUSekQMdWukNkshhEzuyVBrlcO0ud8VzFn9wvz0a908s iR8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P1t1c6rg; spf=pass (google.com: domain of linux-kernel+bounces-812-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-812-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ff24-20020a05622a4d9800b004236fc110a4si17916384qtb.152.2023.12.15.03.16.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:16:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-812-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P1t1c6rg; spf=pass (google.com: domain of linux-kernel+bounces-812-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-812-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 47FD81C22E4D for ; Fri, 15 Dec 2023 11:16:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23B952D021; Fri, 15 Dec 2023 11:15:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P1t1c6rg" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 C1CD324B39 for ; Fri, 15 Dec 2023 11:15:50 +0000 (UTC) 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-wr1-f42.google.com with SMTP id ffacd0b85a97d-33644eeb305so365369f8f.1 for ; Fri, 15 Dec 2023 03:15:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702638949; x=1703243749; 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=dS63jOQC9GkVvD/V3gnNGxfqDZcjIOnsJFZBb/UDQUo=; b=P1t1c6rgB8ALJs3XZXs6iwW0BTMBRA9CMnUPbYHVsZf5e6djiH91MnvXk0vL5rSRjn a4oyTWWn0dJhy6uoyoQwkjcLCX8fwYJN1zb2HPtasdc1SPBoJ9nLV8K8q28VSfwlSZtL lNApQZ/JrfGDmRSmNYI7KdS72K2sp73U7TWty1/KbMdwY7ZyclA6hqg+m0zQqyHQyb5o 8Y35Hxom/S+sBPbMD60aKzGWgYu7wynEcOaVaPKtrnevG8qxpA8+hGOGJg2f4alJW7W6 N+6krhlLr42wQX3xKYqZgIGNu+LlnYHk4uhtzkbcCVFb1ojSPnpPkk5J8AJMO0/rKLZN Bmtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702638949; x=1703243749; 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=dS63jOQC9GkVvD/V3gnNGxfqDZcjIOnsJFZBb/UDQUo=; b=hiCWE8Ci+BN3hbjHAXCvkjh4VyEhd3DDs9jJ9SnEpswMagZsP/Bls5J7HMsk5UQgu6 WtTvr9bXOVcPfs5sYGWal3lgZ1BLVFC5rJy6UR3n0DrUym7Lxwa94sRy4ZqPKVj43Ve8 w9FLifWMB1IZssHhxlk2AmHSgxAvBa1XL/jOcxTc4U8J0IvCDPc99ayIwUN7JXSnrBUc r3H7RuSOeH3ItBF0rf95AkXFbeY/IyZYf71ZLjJeUrltjbUzEniSBsMZAqKsETWcF/L3 gEr9n1iRWgyumfgCQNTFKEWEQey7be4RhqEciIrxWTRTOxgCA5uWz+ogNpgii18ZlmhU MtSQ== X-Gm-Message-State: AOJu0YyzpxXPOi/X14HlsVAG0Hp3yyp8RyZqXXvfQqc/HTicRshN66M0 sShIYenky7QA+ZywOED4vuf1pKvJJ4la4HEFqRc= X-Received: by 2002:adf:f70b:0:b0:336:4bfe:5ab2 with SMTP id r11-20020adff70b000000b003364bfe5ab2mr985429wrp.8.1702638949128; Fri, 15 Dec 2023 03:15:49 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id g13-20020a056000118d00b003333d46a9e8sm18511497wrx.56.2023.12.15.03.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:15:48 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 03/10] nvmem: Create a header for internal sharing Date: Fri, 15 Dec 2023 11:15:29 +0000 Message-Id: <20231215111536.316972-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215111536.316972-1-srinivas.kandagatla@linaro.org> References: <20231215111536.316972-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=2565; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=d1EHrgw6/UsDnp63wQlkSGInigR3iNX9QLiyg3bQooY=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBlfDVXpdB0V9fnBQLtQID2BdPAhCafnEKO73j8W jQhMlQ0uRyJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZXw1VwAKCRB6of1ZxzRV N4tQB/0Qpo/abKZeansCugSOlN79NtCIjjJQ9Rv26Kiaty+3AwNSasbjC5KbCMgeLtU6EOC8/Yr 1gVO7ChnZ3lVT9UeCxMaQ4igZsEHNZX2tkhwCyzazIvVe3kj9bdjkr/tXVqE8rIAbl2eV0H02Ai h3ZkZVSqX9v6RXmfdE2USB9NdKHa1ZlQoerUjg9knQu6VdkHa0OK62/uFcl4Nhd+fFlJ++eWGek vxFkkBTKouVfk8UP757RMA9y6xh1I7p6d2I+cDz26Eej2HrgER61e5lFBXiTvNc8E6QzQ1t6a55 /rHTjmD2R4GT2vGWcZtWlhyKvHT+2qe/VTZ3vZT8Ioi4seg4 X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785346410629841046 X-GMAIL-MSGID: 1785346410629841046 From: Miquel Raynal Before adding all the NVMEM layout bus infrastructure to the core, let's move the main nvmem_device structure in an internal header, only available to the core. This way all the additional code can be added in a dedicated file in order to keep the current core file tidy. Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 24 +----------------------- drivers/nvmem/internals.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 drivers/nvmem/internals.h diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b5b6ec8e04bb..b5e5ce67398f 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -19,29 +19,7 @@ #include #include -struct nvmem_device { - struct module *owner; - struct device dev; - int stride; - int word_size; - int id; - struct kref refcnt; - size_t size; - bool read_only; - bool root_only; - int flags; - enum nvmem_type type; - struct bin_attribute eeprom; - struct device *base_dev; - struct list_head cells; - const struct nvmem_keepout *keepout; - unsigned int nkeepout; - nvmem_reg_read_t reg_read; - nvmem_reg_write_t reg_write; - struct gpio_desc *wp_gpio; - struct nvmem_layout *layout; - void *priv; -}; +#include "internals.h" #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev) diff --git a/drivers/nvmem/internals.h b/drivers/nvmem/internals.h new file mode 100644 index 000000000000..ce353831cd65 --- /dev/null +++ b/drivers/nvmem/internals.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_NVMEM_INTERNALS_H +#define _LINUX_NVMEM_INTERNALS_H + +#include +#include +#include + +struct nvmem_device { + struct module *owner; + struct device dev; + struct list_head node; + int stride; + int word_size; + int id; + struct kref refcnt; + size_t size; + bool read_only; + bool root_only; + int flags; + enum nvmem_type type; + struct bin_attribute eeprom; + struct device *base_dev; + struct list_head cells; + const struct nvmem_keepout *keepout; + unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; + struct gpio_desc *wp_gpio; + struct nvmem_layout *layout; + void *priv; +}; + +#endif /* ifndef _LINUX_NVMEM_INTERNALS_H */