Randy Dunlap
24c776355f
kernel.h: drop hex.h and update all hex.h users
...
Remove <linux/hex.h> from <linux/kernel.h> and update all users/callers of
hex.h interfaces to directly #include <linux/hex.h> as part of the process
of putting kernel.h on a diet.
Removing hex.h from kernel.h means that 36K C source files don't have to
pay the price of parsing hex.h for the roughly 120 C source files that
need it.
This change has been build-tested with allmodconfig on most ARCHes. Also,
all users/callers of <linux/hex.h> in the entire source tree have been
updated if needed (if not already #included).
Link: https://lkml.kernel.org/r/20251215005206.2362276-1-rdunlap@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Yury Norov (NVIDIA) <yury.norov@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2026-01-20 19:44:19 -08:00
Uday Shankar
6d6c1ba782
net, treewide: define and use MAC_ADDR_STR_LEN
...
There are a few places in the tree which compute the length of the
string representation of a MAC address as 3 * ETH_ALEN - 1. Define a
constant for this and use it where relevant. No functionality changes
are expected.
Signed-off-by: Uday Shankar <ushankar@purestorage.com >
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com >
Acked-by: Johannes Berg <johannes@sipsolutions.net >
Reviewed-by: Breno Leitao <leitao@debian.org >
Reviewed-by: Simon Horman <horms@verge.net.au >
Link: https://patch.msgid.link/20250312-netconsole-v6-1-3437933e79b8@purestorage.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com >
2025-03-19 19:17:58 +01:00
Shen Lichuan
b3d75e9ba0
nvmem: Correct some typos in comments
...
Fixed some confusing typos that were currently identified with codespell,
the details are as follows:
-in the code comments:
drivers/nvmem/brcm_nvram.c:25: underlaying ==> underlying
drivers/nvmem/core.c:1250: alredy ==> already
drivers/nvmem/core.c:1268: alredy ==> already
drivers/nvmem/lpc18xx_otp.c:24: reseverd ==> reserved
drivers/nvmem/microchip-otpc.c:159: devide ==> divide
Signed-off-by: Shen Lichuan <shenlichuan@vivo.com >
Acked-by: Vladimir Zapolskiy <vz@mleia.com >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20241030140315.40562-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-11-05 05:33:47 +01:00
Jeff Johnson
c553bad4c5
nvmem: add missing MODULE_DESCRIPTION() macros
...
make allmodconfig && make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvmem/nvmem-apple-efuses.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvmem/nvmem_brcm_nvram.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvmem/nvmem_u-boot-env.o
Add the missing invocations of the MODULE_DESCRIPTION() macro.
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20240705074852.423202-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-07-05 09:55:04 +02:00
Rafał Miłecki
1e37bf84af
nvmem: brcm_nvram: store a copy of NVRAM content
...
This driver uses MMIO access for reading NVRAM from a flash device.
Underneath there is a flash controller that reads data and provides
mapping window.
Using MMIO interface affects controller configuration and may break real
controller driver. It was reported by multiple users of devices with
NVRAM stored on NAND.
Modify driver to read & cache NVRAM content during init and use that
copy to provide NVMEM data when requested. On NAND flashes due to their
alignment NVRAM partitions can be quite big (1 MiB and more) while
actual NVRAM content stays quite small (usually 16 to 32 KiB). To avoid
allocating so much memory check for actual data length.
Link: https://lore.kernel.org/linux-mtd/CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com/
Fixes: 3fef9ed062 ("nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM")
Cc: <Stable@vger.kernel.org >
Cc: Arınç ÜNAL <arinc.unal@arinc9.com >
Cc: Florian Fainelli <florian.fainelli@broadcom.com >
Cc: Scott Branden <scott.branden@broadcom.com >
Signed-off-by: Rafał Miłecki <rafal@milecki.pl >
Acked-by: Arınç ÜNAL <arinc.unal@arinc9.com >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20231215111358.316727-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-12-15 13:15:02 +01:00
Yangtao Li
cfadd0e7d9
nvmem: brcm_nvram: Use devm_platform_get_and_ioremap_resource()
...
Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.
Signed-off-by: Yangtao Li <frank.li@vivo.com >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20230823132744.350618-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-08-23 16:34:00 +02:00
Rafał Miłecki
73bcd133c9
nvmem: brcm_nvram: add .read_post_process() for MACs
...
1. Parse ASCII MAC format into byte based
2. Calculate relative addresses based on index argument
Signed-off-by: Rafał Miłecki <rafal@milecki.pl >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Message-ID: <20230611140330.154222-5-srinivas.kandagatla@linaro.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-06-15 13:42:16 +02:00
Jiasheng Jiang
b0576ade3a
nvmem: brcm_nvram: Add check for kzalloc
...
Add the check for the return value of kzalloc in order to avoid
NULL pointer dereference.
Fixes: 6e977eaa82 ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")
Cc: stable@vger.kernel.org
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20230127104015.23839-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-01-28 14:36:28 +01:00
Rafał Miłecki
a5be5ce0e2
firmware/nvram: bcm47xx: support init from IO memory
...
Provide NVMEM content to the NVRAM driver from a simple
memory resource. This is necessary to use NVRAM in a memory-
mapped flash device. Patch taken from OpenWrts development
tree.
This patch makes it possible to use memory-mapped NVRAM
on the D-Link DWL-8610AP and the D-Link DIR-890L.
Cc: Hauke Mehrtens <hauke@hauke-m.de >
Cc: linux-mips@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com >
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Signed-off-by: Rafał Miłecki <rafal@milecki.pl >
[Added an export for modules potentially using the init symbol]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org >
Link: https://lore.kernel.org/r/20221103082529.359084-1-linus.walleij@linaro.org
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com >
2022-11-09 10:27:10 -08:00
Kenneth Lee
d3524bb5b9
nvmem: brcm_nvram: Use kzalloc for allocating only one element
...
Use kzalloc(...) rather than kcalloc(1, ...) because the number of
elements we are specifying in this case is 1, so kzalloc would
accomplish the same thing and we can simplify.
Signed-off-by: Kenneth Lee <klee33@uw.edu >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-24 14:54:38 +02:00
Rafał Miłecki
207775f7e1
nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells
...
DT binding for Broadcom's NVRAM supports specifying NVMEM cells as NVMEM
device (provider) subnodes. Look for such subnodes when collecing NVMEM
cells. This allows NVMEM consumers to use NVRAM variables.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20220429162701.2222-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-05-09 15:44:21 +02:00
Rafał Miłecki
6e977eaa82
nvmem: brcm_nvram: parse NVRAM content into NVMEM cells
...
NVRAM consist of header and NUL separated key-value pairs. Parse it and
create NVMEM cell for every key-value entry.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20220225175822.8293-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-03-18 14:08:36 +01:00
Rafał Miłecki
3fef9ed062
nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM
...
This driver provides access to Broadcom's NVRAM.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl >
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Link: https://lore.kernel.org/r/20210330111241.19401-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-04-02 16:26:33 +02:00