From patchwork Wed Oct 11 11:15:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 151289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460063vqb; Wed, 11 Oct 2023 04:16:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6QmBtP9kgyK8EJG2Oq1W//u0lzafwcRy3icIA+9kDsflhABmwTVKXARHWvUomscb7ErDy X-Received: by 2002:a17:902:f24b:b0:1c9:af6a:6d12 with SMTP id j11-20020a170902f24b00b001c9af6a6d12mr5194533plc.5.1697022988791; Wed, 11 Oct 2023 04:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697022988; cv=none; d=google.com; s=arc-20160816; b=QA8AjPcfpguHH/3RxV98v9KLGM9xKjO0o1aPwY0lcZxfD3IHhp9n4k0qAvvPbz3g9k SIVGgEDHS+BeQGQlwizwj/C9SLqf2b95x/C5lM1nAuWH9I470yLyCtANEuMk7K1wuf2q GK8xRKUzOjus+00t6+LXRpF48uX+VL9cETE9W1Q9aKS1CVtsmY0dFlDaVianUhhFB/nt /sVo30LmuYlH4Fsx3KNO+7B6aSuiBXGQpzxm4HUMYiZeWvwnTUzOQP7wN8yrjSTNlAbs JfWZkkwRljxn88XMLan++QHwG/w5y2EPQd00I/uTu7AdRxTgFK15dRzcWLKghdYEsIOr voQg== 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 Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id x2-20020a170902a38200b001bb9370760fsi3584335pla.90.2023.10.11.04.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:16:28 -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 C315B8347B6D; Wed, 11 Oct 2023 04:16:25 -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 S1345945AbjJKLPx (ORCPT + 18 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?b?UmFmYcWCIE1pxYJlY2tp?= , 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 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:25 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457577447744704 X-GMAIL-MSGID: 1779457577447744704 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 */