From patchwork Wed Nov 29 16:37:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 171492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp463747vqn; Wed, 29 Nov 2023 08:38:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEARmNLWRmrHBQVL4wE940eU1NPkHf+L4mlJfbbvhD4+3faoJp7RDnmA+oySGRnulZDpG/F X-Received: by 2002:a05:6a21:3283:b0:18b:246a:d43d with SMTP id yt3-20020a056a21328300b0018b246ad43dmr25088697pzb.15.1701275884039; Wed, 29 Nov 2023 08:38:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701275884; cv=none; d=google.com; s=arc-20160816; b=Stz8t4qXJuS+RD9BxYsiJci8SoaxLZ6VRxlkqnBpnijuux345+f/UvCi6Qyg6WTD6G XqTx5G9/umB0vdPnl9QgScKM7Z4aXtf/fCmN0Hneo1dvGtvYIB9t9fpoUn9yHr9R+nOI rFv3BF4CXkenWuEeq3SQkuOO27m2VIw/sS3zvowyIix6rzK1j2jHQiUZEDfC8TXsuJRc 2vPY8cpoJywdhgHCGR+x2UBtlnmoaLO3aedt98js4MSG4sSFCQimko6i2VVpjXP3dqys wOlLVvh7UmUL1kGY9+5KdJyHQ7LY4lLPZE5jaFrp7SEoIoSVM4VdOAFr+XmBVa+M1Fio YP+Q== 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 Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id gd6-20020a17090b0fc600b002855e50a7d9si1580546pjb.26.2023.11.29.08.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 08:38:04 -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 F09C8802F85A; Wed, 29 Nov 2023 08:38:01 -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?b?UmFmYcWCIE1pxYJlY2tp?= , 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 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:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783917060891095729 X-GMAIL-MSGID: 1783917060891095729 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 */