From patchwork Wed Oct 4 22:22:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 148615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp440003vqb; Wed, 4 Oct 2023 15:29:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7FNxKlNlIm0/fFQdGRtQ81TGPtdNRLaYxPXmRtdD9X/iYTDquWLqCPNRctljGM/O7Dlcy X-Received: by 2002:a05:6a20:7f83:b0:15e:b8a1:57b9 with SMTP id d3-20020a056a207f8300b0015eb8a157b9mr4519996pzj.24.1696458599329; Wed, 04 Oct 2023 15:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696458599; cv=none; d=google.com; s=arc-20160816; b=OkfLoRzFZ1IhzPFi9aaLY4J9Vo+ZXQuxhKfoN177K6AcAsK07IXmKmAiepH0aSXwID CtHExAkHkyqYAtM4uJI5pHiEHUM8LAiQGlB05wsYRdB86Is6wY3NFx3uUUCkI9yCucTW LAE+ZTt2/J5uT27dzs43v5SUFZ4I0GxuyZpug5fhZ3F07yDW5iNIvHTd49/sQeixEhnn lMi5NNnWX9E0yhHK+zC/dkHCYR23lxoQTNkgA6IKLxM9EJRZx7bj234yL03XhWtr7xDe xIU3SL4sHaV5We89M8cnWj5IE/ngsyIcXyFdFrZiauzWSUpSzWn5623cP+eTGHPq0WW4 Ufog== 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 Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j73-20020a638b4c000000b0058934e47c94si83406pge.740.2023.10.04.15.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 15:29:59 -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 86AF184CE640; Wed, 4 Oct 2023 15:29:58 -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 S235666AbjJDWXD (ORCPT + 18 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?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 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 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:29:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778865772109702508 X-GMAIL-MSGID: 1778865772109702508 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 */