Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2898308rdb; Wed, 4 Oct 2023 15:23:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgcTr8bux/U+HVg2JeNblc2r3W2bwNGwT8tlWInf34L0t19lymIE3zsus2VnhkwUKQfQCe X-Received: by 2002:a05:6a20:9754:b0:156:e1ce:d4a4 with SMTP id hs20-20020a056a20975400b00156e1ced4a4mr3487496pzc.54.1696458187972; Wed, 04 Oct 2023 15:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696458187; cv=none; d=google.com; s=arc-20160816; b=CzrT0BuxZp4eMRrdWqgSOx9c8NcxbakWhJyoKrpq0nLDAat+REUF4cAYmxmy+sHOZx 28+o4aRvWKV15vOcxtY90g4Wn6f3BqelQoITK9lkmbsM2kj1v9oDd4AhdIscXccbgtfl qcF62FfRi3TqeTpXLwLqGI2giUA5yaDuE04K7dp6Ibfxg3vq8b0F/ASLeJfQ2KtACwfG DDqVnIxOVLgLqHXz5FqNlt2XNOL0Ib6ZSmxlhn0iBAZVUsxbgDTxgk+3GovgC1WsuJiN WjjNraX81yGwviBYvSZlnBxZAoUWaZOAIS4dmIELD76ol7TiUhxKjvh/oTZflSyPIzQU rnFA== 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=/WtKn/Tb4sVAlce85oVAG5zntlgbWadZVDUoXswIydw=; fh=XQzgxiPMj/Cqsom9sWl23DkvcXkGD6r/vx0NuuBn5R0=; b=vgxgUa3aBv2eUwzmJNl7Y0tnEt4HTWeLz15861fFOYnbLesV2KLQM2NFTlKAXb4t9u /iGvg0DVwje5qTqgCM8Uk/MF1jW/+qoJfLbzb4b5P11+XtS2jDXmYId7WXNtb+k+//qD ux/sieKx/dU2ma9L2Gq/NHlxQ0u1iwV/KrSrFxzsMLX6cvtbOwQwUQJFQC9oe5hMBKEv e7qUTPXi2tEeLoXFjdE5Sn0HBNUInVeV3z4eqfWcwYvgzWPx8t3qI7wytH7eKGISafju Iy3ZNcx3Rv1BgjeDLK/pb3nZqL0JnwzOt3LNU6Mez9CoKgTJhJkvvKw39dC2xKpbpIlH nZsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WEsIoZC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id g19-20020a63f413000000b005859f850b2csi100462pgi.38.2023.10.04.15.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 15:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WEsIoZC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 777C784CE640; Wed, 4 Oct 2023 15:23:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235504AbjJDWXD (ORCPT + 99 others); Wed, 4 Oct 2023 18:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235036AbjJDWW4 (ORCPT ); Wed, 4 Oct 2023 18:22:56 -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 1F79BEE; Wed, 4 Oct 2023 15:22:51 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 987BC1C0005; Wed, 4 Oct 2023 22:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1696458170; 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=/WtKn/Tb4sVAlce85oVAG5zntlgbWadZVDUoXswIydw=; b=WEsIoZC5O98yyVASIaiclGnH86JWzemScB3JQObFyalXk4oQUwgzIUIYVfh9rQsRjKKxFd xE0Lr7SFgWNQrsGjk5GjCegG90wryvMJzveeaLdlWKr5ZqMElhRf5NjsvuECMoin5NOd/7 +x+DWFM2gDmUYsvR7G0Yee4ZxD7FyBU31fm/gjG8Jnjc/aaW1KBlqlE9Zi4csATt+NfQUR hgH9tIGd76FzE/V2w/JqyvFMjXqG9vGAa17EgM8W35sRvynO7bLyfGv0G/t0plheT9e3ky Tsw2CqWziksEO3iBDgFefEXuf2jyHeHGVkMJ6HodimQ5fnO5k9xRMMtBLrkuIA== 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 v11 4/7] nvmem: Create a header for internal sharing Date: Thu, 5 Oct 2023 00:22:33 +0200 Message-Id: <20231004222236.411248-5-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004222236.411248-1-miquel.raynal@bootlin.com> References: <20231004222236.411248-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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED 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 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 15:23:07 -0700 (PDT) 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 c63057a7a3b8..073fe4a73e37 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