From patchwork Thu Oct 5 15:59:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 148889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp414342vqb; Thu, 5 Oct 2023 09:22:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXUxNqiECf4nFPrVAJujVpL9vFGr0ASIqvINUOfWlm3sdVsXLIYUq473YgPe4MPKOJyLc6 X-Received: by 2002:a17:902:c212:b0:1c6:1611:e540 with SMTP id 18-20020a170902c21200b001c61611e540mr4916622pll.25.1696522974137; Thu, 05 Oct 2023 09:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696522974; cv=none; d=google.com; s=arc-20160816; b=Uj3fwTMkNIkkhjgRATo0wWOsu1iD40YX6E+Pk94uNUXQR9yrUZ2eDH4TxMZxrmIlLs gyNi9+8kZp288QnsSVhr+qBUQBzXx9Ozt4iIN4QErBl8ndIW+9Q+Dwm/3pJVRtQ3sLUJ shYX8LrLWOhHVDiVhQcq3PmkQFzEhybRFsfYyUQnRh41Y/5O+S5b5MNjFRTkUP9MseTr sV51xs6LzCgTNBVE7nUAx4bjdjr2GaVCtNURvdya14xq+LLUxb/2O0/fITE1DE1D38d1 7tPRI5Ei3+3lGJkbjZWwzMp1NFwWDfmWmFiCuVb9sr9fcviT7kRAEwf5Ada8cwVARfyN kDSg== 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=J0+UgdIzyNDpPu4jd0sjt9gAMGluuPWZ92FJdaayG8tYTSnVjSHzbZJsj7w9JcfN0U pflsqNduucNpk9eEcDjxUgxKtNUGhA1o/IILBVjlEjHFLTHOT3io0XNe8f1umiZaJGjc M9ffY7ECPX19L3A3QEvLeopjzXWiBtguao0yyYxjR2Bf7yN+PCjDESdX1dWW9PX7DLtK dQ/rKwlsIOtnu6MdP2cvWtypnwXFqlCxZr2+UArZoy0wBD6qISCpBqg00FL4ZtiJpIev mYxWntAmLpv2/s4zJxaXbq+S/tSHMr7qdto62ie55sTDfIUuEBnKmXIoH8Qvi24RcHlQ MkeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LM5De+Ri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id jz11-20020a170903430b00b001c724f99800si1656690plb.44.2023.10.05.09.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 09:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LM5De+Ri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 7B2FD8054BEC; Thu, 5 Oct 2023 09:22:53 -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 S243070AbjJEQWW (ORCPT + 19 others); Thu, 5 Oct 2023 12:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241468AbjJEQQJ (ORCPT ); Thu, 5 Oct 2023 12:16:09 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 543D23C3A; Thu, 5 Oct 2023 08:59:19 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8FAAE1BF207; Thu, 5 Oct 2023 15:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1696521558; 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=LM5De+RiQX+nTg+ib49/YUIVzd9DAeclp5XZnovNXjakXB0AegN3UHBdGFH7ho5anJUPoB gsQpXZxIrsM8EcyAe35ohIMbcSAKMw2R94fP4XR2qaJTWMnUrAp7ISJ7/qVEU5PeNXZUWB NeVDRmajCs1Tw65WQu5jQgNY55M0anL3RMFDiY1PbKfDuHcNNGjSiyQg77NbPl8SdxkrWS HrjmIzpZYJo3TsaF2hQp2BlgsQL4Q03RAYiU92fOhWX4J8F9CxPvi6sviNfjoBBmO6qwyW veHxHLj93pJaKo/wFpXGhonCy2Z+sJ7+WmtU+gVdAiMbVsNZqoLcPz4MBV981w== 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 v12 4/7] nvmem: Create a header for internal sharing Date: Thu, 5 Oct 2023 17:59:04 +0200 Message-Id: <20231005155907.2701706-5-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005155907.2701706-1-miquel.raynal@bootlin.com> References: <20231005155907.2701706-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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]); Thu, 05 Oct 2023 09:22:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778933273930763328 X-GMAIL-MSGID: 1778933273930763328 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 */