Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp735726rdg; Wed, 11 Oct 2023 04:16:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG29AKev36gvx+7aQCElCyU3vUbgl7jQ7mWI0geAlGa6rwcVLh869jhb4Egm9k7iQdFH9OP X-Received: by 2002:a05:6358:a1a:b0:164:a5c0:46a5 with SMTP id 26-20020a0563580a1a00b00164a5c046a5mr5926798rwa.12.1697022977255; Wed, 11 Oct 2023 04:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697022977; cv=none; d=google.com; s=arc-20160816; b=uropRWmksD9FhwDcNJzodME+kVRQN8zFENey7FExu0TnfuxN1pJrpI86RFpIGgKV4J dAHseW57J04qJBJ/X93FnrAGhA0Uwz5brG1qlUe21WiR/PJJVEEtBtE0457NbpXbHhBb TDwTMPj+DlXUxI7ygtvrCNZ1aQ4Tkc9mMmPplF43dagiyJjW1V5sTc/dGwvYo97ykfC2 2EjuD6bKATL1m6dCbUM34BYESleevwMQyslggd+9IU7U0X0dBtYMh9o2BW3j8hdqTrsN c/kyaanpsfKJ5tBmzqKmuQrO8klJO5g8zc02gALjucMsohzRg+BMBcaItqAenvqBg6hn yvSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ABL44vf3YRZd8ThfS0o/cypOR6A9WAryG1kFlUlNHwg=; fh=XQzgxiPMj/Cqsom9sWl23DkvcXkGD6r/vx0NuuBn5R0=; b=yYE/KZIOH2hfBFBrFRPc1Tw/mDpE43FSVJk4kOGm/d3kIAmdQsSzSHwu93XG/6sNWn R394vdeL+k7jE8mxV/4COzSnevskACpTH/1KBZ84JSGMYbL0oUhoQGfWKXQNymZVf8Wy qFkPY7SAvuyvIHuVIo1+1GE3obCFeTl0pW9PEAU8X2eolk/mQzW6VY/sDciMkOi9MmH6 eYIVdx7kUfry+FP32R4eaYhV+1xVO3E7L7+ZrSzf5OqWlwdBi8COGMd+6wYAFWHwIKBs yXKKvVUJLFh78Wj0MQs8rHQGU8AauZh6Ij0uLIO4ypwGjBC7l5dn5a0BiAVZblCNnJxj pInw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=kyhGNm1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id cw4-20020a056a00450400b0068a140568b4si2089541pfb.348.2023.10.11.04.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:16:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=kyhGNm1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 283F880EFC6D; Wed, 11 Oct 2023 04:16:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234767AbjJKLPx (ORCPT + 99 others); Wed, 11 Oct 2023 07:15:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346001AbjJKLPl (ORCPT ); Wed, 11 Oct 2023 07:15:41 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 448D3B0; Wed, 11 Oct 2023 04:15:39 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 504501C0009; Wed, 11 Oct 2023 11:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697022937; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ABL44vf3YRZd8ThfS0o/cypOR6A9WAryG1kFlUlNHwg=; b=kyhGNm1F8nuxS7Zr8Q77a5h9yC/7l65P1c6oc0e/bT5h/8Bm3dURuRda+2jAJtNPmj7HfQ 1PB9R7OmOy+Cgd8ypNLIbUoE5EkQgxgt1nseMAXqyoeFMnbJFFrEyrZrdL10yrLxxvbs1A wfwk7qdU7cq85YATvheGmPkx58nrAY7NUPMTusf/PkmesslmUSdF5DnfHg0er/wN4ljbQV 1FAwoPJAIBtmDraMuGADamr6CqzXkpZOixcWtClN0BrYvJuifYn6wAx1i2Dw5FJJgQiqJF kO/7quAn4Z0EmjJi1ilBTLE8wuebW3qiChRIqkPKu6XAqK7IZUoq6hA2VTVkSw== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Michael Walle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, , Robert Marko , Thomas Petazzoni , Luka Perkov , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , Miquel Raynal Subject: [PATCH v13 3/6] nvmem: Create a header for internal sharing Date: Wed, 11 Oct 2023 13:15:26 +0200 Message-Id: <20231011111529.86440-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011111529.86440-1-miquel.raynal@bootlin.com> References: <20231011111529.86440-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:16:13 -0700 (PDT) X-Spam-Level: ** 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 --- 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 93b867b3cdf9..eefb5d0a0c91 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 */ -- 2.34.1