Message ID | 20230110105425.13188-1-zajec5@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2677055wrt; Tue, 10 Jan 2023 02:55:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXtnRopM7u+pGS4ApS+STNaW1KM66V4qyDQ/7BAiC/ntN8YpdS7Dfy2xKFgfsJNN9BtKRCTF X-Received: by 2002:a05:6402:4004:b0:48e:a9a2:407 with SMTP id d4-20020a056402400400b0048ea9a20407mr33049518eda.23.1673348142784; Tue, 10 Jan 2023 02:55:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673348142; cv=none; d=google.com; s=arc-20160816; b=aQIhyjuFGiPVjU/ExSax+u0yMZyb0YjRI7w4nwwTT1ueoO4UIzmRtNd/QIHSWueiXx /igymYY+eIDECdxH5zhmahup6PJPFap/cz5zbZLhHZVcl5gmKL/5BBcw5JBAmioM0D63 wkVdyEIYW4lX1UXJ7eRSG+NN4uZkkeIohHuSheFtEUF/AxgKiSq0isfS2ceAc2vEqfJN XTVuK1BAoqszlfYnPHOl4nXy9HtEKaoO//+3qObZ0V1oW9kLN90W5lHFEL/uNyU5eEDp CWkqkmqIVFUsT7Qsf/HJOqDUQ+XakONyBddprwmNPTA4T1s7u/GxT5dHnQd3Cva2ka0K z6DQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=kx33osG0iIsA/kyalJIybKATyfWaMXF9jLXNGZKLKMc=; b=HfsHjJyV07jiRGwZ64v0AyUMdEBV2gxLfEDUQ9zBFEWJrNErb3r0puZCBJcTsQkYK2 S2CaGXjZ3GEN6HhZxxJy0VTuKqeRscY93YiGAsD1Q/N6qt86zPBOQv0W8T6VaVNlfckj rQEnRSIFwp2a0ct333ORvSgnmkojLnWcA4Me2WBLSeY38lMXn2qQQueiDeEiIB48l4Lu lW6dFOd65SObUC80ZeaUIUooIQ2ZZevvbs5G/fW+REjbd+qAkUvlVFs7y1Mmw3rLzBvm vIoyUXQorI0dORd0F/3fHEWQmtIdeDmOAO0ftrd94l5TQ3H2MJGF2PzkK3IKKLn6cy9D Ewqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k5eMydzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt33-20020a1709072da100b007c151fc73d0si14443195ejc.653.2023.01.10.02.55.19; Tue, 10 Jan 2023 02:55:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k5eMydzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbjAJKy5 (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Tue, 10 Jan 2023 05:54:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238165AbjAJKyn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Jan 2023 05:54:43 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1E8A6AD83; Tue, 10 Jan 2023 02:54:35 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id m21so16943251edc.3; Tue, 10 Jan 2023 02:54:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kx33osG0iIsA/kyalJIybKATyfWaMXF9jLXNGZKLKMc=; b=k5eMydzOQ4SSz/enP/AZgMBTxZ3wxzbr4iy9HH74X9Wo7sH3oUW9IyrLVrLK2cf2wc zuSWFUOsT12RRRHg2LOo6wi1bQWeWdvi08ypPH0suPvYe+xYM9RWrc9BzUB71YgF9fOi Lq4HPmCy2nRPI+/kCyS8sG1WqgxIDuZeE73JQL4ny4jhpXP8KdtjHNyQJoRZLH10FQK4 WIgKcEIu5m3iYn1NQzZ2p92sCfpp+3ZnGYc8JsWpiSeWKlNP9jjHsaKIPHrS0XxWtJih 4BKng+Gsh8KOWVcY5YCvwpbZpxPJRWVEahK0ERsB1omXnGLj0ABvGnNNWA7a6XhI0p8n d87w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kx33osG0iIsA/kyalJIybKATyfWaMXF9jLXNGZKLKMc=; b=ndTdg9m9T56og+/86OnZwo65SC/dsfq6AJ9WAcXcI7g3rmnEroW7fERgMnI0EbuAK3 jBhUOTYvA6dXSJ/lBzk5CuzivMEPTUdhprkSwXKCVFEP3TKBe6JSDET5GGR8d8krJPWM b4OM/bUh64SQka/EugjizCIGyBQaq0q2MBkajxTnOyV4/WxjieSHWMPVsezl6JAmsw+f O0zd2xH+KfJDhEpkGVpPoxPQ5+awv5ABWrIDuloA4tbAQsOecOlWENWe85OqZCPsPt6D T8b3u9zQfJzuwdV3Z4r77dbQ2DVNc14LdSkHpZz6JValBTznkv0bBh3rtwRFfD57gkJv ZYMw== X-Gm-Message-State: AFqh2kpNd/1qXkzSa+k4hmD1E1iKWp/N5px83ctCG6EArHvL7xiIXr77 Uf9QcdgMkto9a9qDsruFOq8= X-Received: by 2002:a05:6402:2685:b0:493:b55d:d7f2 with SMTP id w5-20020a056402268500b00493b55dd7f2mr24287133edd.14.1673348074366; Tue, 10 Jan 2023 02:54:34 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id s1-20020aa7c541000000b00495c3573b36sm4818199edr.32.2023.01.10.02.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 02:54:33 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= <zajec5@gmail.com> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Miquel Raynal <miquel.raynal@bootlin.com>, Michael Walle <michael@walle.cc>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, u-boot@lists.denx.de, =?utf-8?b?UmFmYcWCIE1p?= =?utf-8?b?xYJlY2tp?= <rafal@milecki.pl> Subject: [PATCH 1/6] nvmem: core: add nvmem_dev_size() helper Date: Tue, 10 Jan 2023 11:54:20 +0100 Message-Id: <20230110105425.13188-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754632702488216057?= X-GMAIL-MSGID: =?utf-8?q?1754632702488216057?= |
Series |
[1/6] nvmem: core: add nvmem_dev_size() helper
|
|
Commit Message
Rafał Miłecki
Jan. 10, 2023, 10:54 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl> This is required by layouts that need to read whole NVMEM space. It applies to NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki <rafal@milecki.pl> --- drivers/nvmem/core.c | 13 +++++++++++++ include/linux/nvmem-consumer.h | 1 + 2 files changed, 14 insertions(+)
Comments
Hi Rafał, I love your patch! Perhaps something to improve: [auto build test WARNING on next-20230110] [also build test WARNING on v6.2-rc3] [cannot apply to robh/for-next shawnguo/for-next mtd/mtd/next mtd/mtd/fixes linus/master v6.2-rc3 v6.2-rc2 v6.2-rc1] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Rafa-Mi-ecki/nvmem-core-allow-read_post_process-callbacks-to-adjust-data-length/20230110-185915 patch link: https://lore.kernel.org/r/20230110105425.13188-1-zajec5%40gmail.com patch subject: [PATCH 1/6] nvmem: core: add nvmem_dev_size() helper config: m68k-allyesconfig compiler: m68k-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/4d5cc61f8d02a82344468f172a852ffc56cf0d5c git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Rafa-Mi-ecki/nvmem-core-allow-read_post_process-callbacks-to-adjust-data-length/20230110-185915 git checkout 4d5cc61f8d02a82344468f172a852ffc56cf0d5c # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/nvmem/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from drivers/nvmem/core.c:16: >> include/linux/nvmem-consumer.h:81:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 81 | const size_t nvmem_dev_size(struct nvmem_device *nvmem); | ^~~~~ >> drivers/nvmem/core.c:2070:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 2070 | const size_t nvmem_dev_size(struct nvmem_device *nvmem) | ^~~~~ -- In file included from drivers/nvmem/brcm_nvram.c:10: >> include/linux/nvmem-consumer.h:81:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 81 | const size_t nvmem_dev_size(struct nvmem_device *nvmem); | ^~~~~ vim +81 include/linux/nvmem-consumer.h 49 50 /* Cell based interface */ 51 struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id); 52 struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *id); 53 void nvmem_cell_put(struct nvmem_cell *cell); 54 void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); 55 void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); 56 int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len); 57 int nvmem_cell_read_u8(struct device *dev, const char *cell_id, u8 *val); 58 int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); 59 int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); 60 int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val); 61 int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id, 62 u32 *val); 63 int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id, 64 u64 *val); 65 66 /* direct nvmem device read/write interface */ 67 struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); 68 struct nvmem_device *devm_nvmem_device_get(struct device *dev, 69 const char *name); 70 void nvmem_device_put(struct nvmem_device *nvmem); 71 void devm_nvmem_device_put(struct device *dev, struct nvmem_device *nvmem); 72 int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset, 73 size_t bytes, void *buf); 74 int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset, 75 size_t bytes, void *buf); 76 ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, 77 struct nvmem_cell_info *info, void *buf); 78 int nvmem_device_cell_write(struct nvmem_device *nvmem, 79 struct nvmem_cell_info *info, void *buf); 80 > 81 const size_t nvmem_dev_size(struct nvmem_device *nvmem); 82 const char *nvmem_dev_name(struct nvmem_device *nvmem); 83
Hi Rafał, I love your patch! Perhaps something to improve: [auto build test WARNING on next-20230110] [also build test WARNING on v6.2-rc3] [cannot apply to robh/for-next shawnguo/for-next mtd/mtd/next mtd/mtd/fixes linus/master v6.2-rc3 v6.2-rc2 v6.2-rc1] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Rafa-Mi-ecki/nvmem-core-allow-read_post_process-callbacks-to-adjust-data-length/20230110-185915 patch link: https://lore.kernel.org/r/20230110105425.13188-1-zajec5%40gmail.com patch subject: [PATCH 1/6] nvmem: core: add nvmem_dev_size() helper config: hexagon-randconfig-r041-20230110 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 8d9828ef5aa9688500657d36cd2aefbe12bbd162) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/4d5cc61f8d02a82344468f172a852ffc56cf0d5c git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Rafa-Mi-ecki/nvmem-core-allow-read_post_process-callbacks-to-adjust-data-length/20230110-185915 git checkout 4d5cc61f8d02a82344468f172a852ffc56cf0d5c # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/nvmem/ drivers/thermal/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from drivers/nvmem/core.c:16: >> include/linux/nvmem-consumer.h:81:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const size_t nvmem_dev_size(struct nvmem_device *nvmem); ^~~~~~ >> drivers/nvmem/core.c:2070:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const size_t nvmem_dev_size(struct nvmem_device *nvmem) ^~~~~~ 2 warnings generated. -- In file included from drivers/thermal/mtk_thermal.c:12: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from drivers/thermal/mtk_thermal.c:12: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from drivers/thermal/mtk_thermal.c:12: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ In file included from drivers/thermal/mtk_thermal.c:15: >> include/linux/nvmem-consumer.h:81:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const size_t nvmem_dev_size(struct nvmem_device *nvmem); ^~~~~~ 7 warnings generated. vim +/const +81 include/linux/nvmem-consumer.h 49 50 /* Cell based interface */ 51 struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id); 52 struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *id); 53 void nvmem_cell_put(struct nvmem_cell *cell); 54 void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); 55 void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); 56 int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len); 57 int nvmem_cell_read_u8(struct device *dev, const char *cell_id, u8 *val); 58 int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); 59 int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); 60 int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val); 61 int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id, 62 u32 *val); 63 int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id, 64 u64 *val); 65 66 /* direct nvmem device read/write interface */ 67 struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); 68 struct nvmem_device *devm_nvmem_device_get(struct device *dev, 69 const char *name); 70 void nvmem_device_put(struct nvmem_device *nvmem); 71 void devm_nvmem_device_put(struct device *dev, struct nvmem_device *nvmem); 72 int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset, 73 size_t bytes, void *buf); 74 int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset, 75 size_t bytes, void *buf); 76 ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, 77 struct nvmem_cell_info *info, void *buf); 78 int nvmem_device_cell_write(struct nvmem_device *nvmem, 79 struct nvmem_cell_info *info, void *buf); 80 > 81 const size_t nvmem_dev_size(struct nvmem_device *nvmem); 82 const char *nvmem_dev_name(struct nvmem_device *nvmem); 83
On 10.01.23 11:54, Rafał Miłecki wrote: > From: Rafał Miłecki <rafal@milecki.pl> > > This is required by layouts that need to read whole NVMEM space. It > applies to NVMEM devices without hardcoded layout (like U-Boot > environment data block). > > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> > --- > drivers/nvmem/core.c | 13 +++++++++++++ > include/linux/nvmem-consumer.h | 1 + > 2 files changed, 14 insertions(+) > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index 1f05f0a50d86..81743ae8793b 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -2062,6 +2062,19 @@ void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) > } > EXPORT_SYMBOL_GPL(nvmem_del_cell_lookups); > > +/** > + * nvmem_dev_size() - Get the size of a given nvmem device. > + * > + * @nvmem: nvmem device. > + * > + * Return: size of the nvmem device. > + */ > +const size_t nvmem_dev_size(struct nvmem_device *nvmem) The const here is quite unusual. You can make the parameter a const struct nvmem_device though. > +{ > + return nvmem->size; > +} > +EXPORT_SYMBOL_GPL(nvmem_dev_size); > + > /** > * nvmem_dev_name() - Get the name of a given nvmem device. > * > diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h > index fa030d93b768..d88294ddf562 100644 > --- a/include/linux/nvmem-consumer.h > +++ b/include/linux/nvmem-consumer.h > @@ -78,6 +78,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, > int nvmem_device_cell_write(struct nvmem_device *nvmem, > struct nvmem_cell_info *info, void *buf); > > +const size_t nvmem_dev_size(struct nvmem_device *nvmem); > const char *nvmem_dev_name(struct nvmem_device *nvmem); > > void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries,
Hi Rafał, I love your patch! Perhaps something to improve: [auto build test WARNING on next-20230110] [also build test WARNING on v6.2-rc7] [cannot apply to robh/for-next shawnguo/for-next mtd/mtd/next mtd/mtd/fixes linus/master v6.2-rc3 v6.2-rc2 v6.2-rc1] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Rafa-Mi-ecki/nvmem-core-allow-read_post_process-callbacks-to-adjust-data-length/20230110-185915 patch link: https://lore.kernel.org/r/20230110105425.13188-1-zajec5%40gmail.com patch subject: [PATCH 1/6] nvmem: core: add nvmem_dev_size() helper config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230211/202302112138.XOdXy4yF-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/4d5cc61f8d02a82344468f172a852ffc56cf0d5c git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Rafa-Mi-ecki/nvmem-core-allow-read_post_process-callbacks-to-adjust-data-length/20230110-185915 git checkout 4d5cc61f8d02a82344468f172a852ffc56cf0d5c # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/nvmem/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202302112138.XOdXy4yF-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from drivers/nvmem/core.c:16: >> include/linux/nvmem-consumer.h:81:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 81 | const size_t nvmem_dev_size(struct nvmem_device *nvmem); | ^~~~~ >> drivers/nvmem/core.c:2070:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 2070 | const size_t nvmem_dev_size(struct nvmem_device *nvmem) | ^~~~~ -- In file included from drivers/nvmem/brcm_nvram.c:10: >> include/linux/nvmem-consumer.h:81:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 81 | const size_t nvmem_dev_size(struct nvmem_device *nvmem); | ^~~~~ vim +81 include/linux/nvmem-consumer.h 49 50 /* Cell based interface */ 51 struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id); 52 struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *id); 53 void nvmem_cell_put(struct nvmem_cell *cell); 54 void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); 55 void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); 56 int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len); 57 int nvmem_cell_read_u8(struct device *dev, const char *cell_id, u8 *val); 58 int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); 59 int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); 60 int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val); 61 int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id, 62 u32 *val); 63 int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id, 64 u64 *val); 65 66 /* direct nvmem device read/write interface */ 67 struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); 68 struct nvmem_device *devm_nvmem_device_get(struct device *dev, 69 const char *name); 70 void nvmem_device_put(struct nvmem_device *nvmem); 71 void devm_nvmem_device_put(struct device *dev, struct nvmem_device *nvmem); 72 int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset, 73 size_t bytes, void *buf); 74 int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset, 75 size_t bytes, void *buf); 76 ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, 77 struct nvmem_cell_info *info, void *buf); 78 int nvmem_device_cell_write(struct nvmem_device *nvmem, 79 struct nvmem_cell_info *info, void *buf); 80 > 81 const size_t nvmem_dev_size(struct nvmem_device *nvmem); 82 const char *nvmem_dev_name(struct nvmem_device *nvmem); 83
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 1f05f0a50d86..81743ae8793b 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -2062,6 +2062,19 @@ void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) } EXPORT_SYMBOL_GPL(nvmem_del_cell_lookups); +/** + * nvmem_dev_size() - Get the size of a given nvmem device. + * + * @nvmem: nvmem device. + * + * Return: size of the nvmem device. + */ +const size_t nvmem_dev_size(struct nvmem_device *nvmem) +{ + return nvmem->size; +} +EXPORT_SYMBOL_GPL(nvmem_dev_size); + /** * nvmem_dev_name() - Get the name of a given nvmem device. * diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index fa030d93b768..d88294ddf562 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -78,6 +78,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf); +const size_t nvmem_dev_size(struct nvmem_device *nvmem); const char *nvmem_dev_name(struct nvmem_device *nvmem); void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries,