Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4712889rdh; Wed, 29 Nov 2023 08:38:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9Qx0/fNLSZpLY+QsDB4os4w+WseXlRzPWV2bSBDow5gBVWVmBWSsuFw8qChEVSIRCylpv X-Received: by 2002:a17:903:183:b0:1cf:6590:70 with SMTP id z3-20020a170903018300b001cf65900070mr24519436plg.23.1701275885241; Wed, 29 Nov 2023 08:38:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701275885; cv=none; d=google.com; s=arc-20160816; b=KD3KS7P6zEvWdGFfLrgYHS9ow5r5geyRWW1sRVi2IVXz2OwGNPo7cmfm/b1qCNnnsA dAJUmpDmtq/5Z5F+v+yFk6Z69W6Mrp+C7iGj6oepVIJb8k6lEY6l+QQ7CubWM+JFk+Nc 58QOLwiDOMZbQcDKkr0FFLl9shDyYry8SlmEDmaKSHdu57wHlK21Sem3xw8MZShApKxe cpiCyMhXL2EZoEV0AmBRCFsrKCE60h+R5hqu4bNgq7uew3c088Iu9FZlKvZxVb7/7ios A4XZDF57KwUIC8ydbO++vxQa4BDL+vEMk9inx9pJJDqRW/YxQjl82h+PLliSD51AJEwk +5vA== 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=cFyU6O8ilcV7xp4q/of+2+aQkRrhD5AxyRveYuZqHQY=; fh=LHVfHqkxtSfhDK3Auz+HtR9CGNiwZCQHjp1a868hmsY=; b=uU1Moz+rzIpvFOV254z2YhQsUQ2TPeepTypgTSkITnIqc6Rlz/JlQ8337Cv+qcq2Tb /1Mot/xj/Mk4QkKlc/9MUa/amagwQP/ktGx2+TWkI7C2sXrXChvn+fWiMHSTQl3hc9oJ lq+4SSvbkuxCd66TEOU5+EjQK0CNB2QEjB0uK0syDVPL/2cf7Sp+XjtKjDYDQoaQIe+4 kMRXGGA/X+pLrG+omBu+xlAgQgu67ntkIyagWzgd9+9si64mPa3GJrLuhvxuD3UWH0Y0 g2JE1Gc1MDHwhHSEXdDZf66/3Gj5OrIL19WtyqYfW8TcXeZjk2073m5i67bfrIwYrR4N u0rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=aWBx7yX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h11-20020a170902f54b00b001cfe203187bsi5339459plf.296.2023.11.29.08.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 08:38:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=aWBx7yX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id E9F37802F846; Wed, 29 Nov 2023 08:38:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230511AbjK2Qho (ORCPT + 99 others); Wed, 29 Nov 2023 11:37:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjK2Qhh (ORCPT ); Wed, 29 Nov 2023 11:37:37 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE5F10A for ; Wed, 29 Nov 2023 08:37:43 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2507FC0007; Wed, 29 Nov 2023 16:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701275861; 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=cFyU6O8ilcV7xp4q/of+2+aQkRrhD5AxyRveYuZqHQY=; b=aWBx7yX3Ta1jei4cV0eIEV73KUZHp7UHbwBlkWjCofvx+OaOLayuNcLBsvY6BKmRTVAnTo mz6LcYUSyxry5Skh1ZeD8Owq6u0qkwOSfOx6Hz/9IESUN7O2X/hEAq4lbwz9hH/xYem2AY XLtRu9d7Xgb6h/7ReBnF5MjjCD/d1wvn6PwRQrtZX7uYQHSUA15nmgaJ0HOn/8PiQWnoj6 Mwrj4jZkMnZfoBVQdYX1Cw8nZPg+PC4y3p5MlkCQdhBCzcC2weAUGt1O5FPTAfaHcKoFA0 /vA2jEvWlt2hHk/i6Rt/NpJQUutfdfWvKIfOJ9jgjJM2GKtU3oE6dYNq6Hb1MA== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman , Cc: Thomas Petazzoni , Robert Marko , Luca Ceresoli , Michael Walle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Marco Felsch , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , Miquel Raynal Subject: [PATCH v14 3/8] nvmem: Create a header for internal sharing Date: Wed, 29 Nov 2023 17:37:32 +0100 Message-Id: <20231129163737.698317-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129163737.698317-1-miquel.raynal@bootlin.com> References: <20231129163737.698317-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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 08:38:03 -0800 (PST) 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 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 */ -- 2.34.1