Remove nvmem deadcode
Subsystems (2)
cover Remove nvmem deadcode
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
This series removes some uncalled deadcode in nvmem.
The third patch probably deserves a bit closer inspection.
The first one removes nvmem_device_cell_read/write functions that haven't been used in ~10 years.
The second removes nvmem_add/del_cell_table - again this is removing uncalled functions; nvmem_add_cell_table is unused after the removal of the Davinci machines.
The third one removes the remaining nvmem_cell_table code - including a function that's called ( nvmem_add_cells_from_table ) - but my reading is that from the previous patch there's no way for this function to do anything active any more since the list it walks is empty.
Build tested only.
Dr. David Alan Gilbert (3):
nvmem: core: Remove unused nvmem_device_cell_(read|write)
nvmem: core: Remove nvmem_(add|del)_cell_table
nvmem: core: Remove remains of nvmem_cell_table
Documentation/driver-api/nvmem.rst | 23 ------ drivers/nvmem/core.c | 126 ----------------------------- include/linux/nvmem-consumer.h | 4 - include/linux/nvmem-provider.h | 24 ------ 4 files changed, 177 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/3 nvmem: core: Remove unused nvmem_device_cell_(read|write)
From: "Dr. David Alan Gilbert" <[email protected]>
nvmem_device_cell_read() and nvmem_device_cell_write() were added in 2015's
commit e2a5402ec7c6 ("nvmem: Add nvmem_device based consumer apis.") but have remained unused.
Remove them.
--- Documentation/driver-api/nvmem.rst | 4 --- drivers/nvmem/core.c | 58 ------------------------------ include/linux/nvmem-consumer.h | 4 --- 3 files changed, 66 deletions(-)
Documentation/driver-api/nvmem.rst +0 -4
@@ -132,10 +132,6 @@ To facilitate such consumers NVMEM framework provides below apis:: size_t bytes, void *buf); int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset, size_t bytes, void *buf); - int nvmem_device_cell_read(struct nvmem_device *nvmem, - struct nvmem_cell_info *info, void *buf); - int nvmem_device_cell_write(struct nvmem_device *nvmem, - struct nvmem_cell_info *info, void *buf); Before the consumers can read/write NVMEM directly, it should get hold of nvmem_controller from one of the `*nvmem_device_get()` api.
drivers/nvmem/core.c +0 -58
64 lines not on this page · raw message
include/linux/nvmem-consumer.h +0 -4
@@ -75,10 +75,6 @@ int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset, size_t bytes, void *buf);int nvmem_device_write (struct nvmem_device *nvmem,unsigned int offset,size_t bytes,void *buf); -ssize_t nvmem_device_cell_read (struct nvmem_device *nvmem, -struct nvmem_cell_info *info,void *buf); -int nvmem_device_cell_write (struct nvmem_device *nvmem, -struct nvmem_cell_info *info,void *buf);const char *nvmem_dev_name (struct nvmem_device *nvmem);size_t nvmem_dev_size (struct nvmem_device *nvmem);
Signature · 1 line
2.48.1
PATCH 2/3 nvmem: core: Remove nvmem_(add|del)_cell_table
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
nvmem_del_cell_table() was added in 2018's commit b985f4cba6db ("nvmem: add support for cell info") but remained unused.
nvmem_add_cell_table() was also added in that commit, however it's last use was removed in 2022 by
commit 2af4fcc0d357 ("ARM: davinci: remove unused board support")
Remove them.
--- Documentation/driver-api/nvmem.rst | 2 -- drivers/nvmem/core.c | 26 -------------------------- include/linux/nvmem-provider.h | 5 ----- 3 files changed, 33 deletions(-)
Documentation/driver-api/nvmem.rst +0 -2
@@ -76,8 +76,6 @@ nvmem_cell_table struct:: .ncells = ARRAY_SIZE(foo_nvmem_cells), }; - nvmem_add_cell_table(&foo_nvmem_cell_table); - Additionally it is possible to create nvmem cell lookup entries and register them with the nvmem framework from machine code as shown in the example below::
drivers/nvmem/core.c +0 -26
@@ -2069,32 +2069,6 @@ int nvmem_device_write(struct nvmem_device *nvmem, }EXPORT_SYMBOL_GPL (nvmem_device_write); -/** -* nvmem_add_cell_table() - register a table of cell info entries -* -* @table: table of cell info entries -*/ -void nvmem_add_cell_table (struct nvmem_cell_table *table) -{ -mutex_lock (&nvmem_cell_mutex); -list_add_tail (&table->node, &nvmem_cell_tables); -mutex_unlock (&nvmem_cell_mutex); -} -EXPORT_SYMBOL_GPL (nvmem_add_cell_table); - -/** -* nvmem_del_cell_table() - remove a previously registered cell info table -* -* @table: table of cell info entries -*/ -void nvmem_del_cell_table (struct nvmem_cell_table *table) -{ -mutex_lock (&nvmem_cell_mutex); -list_del (&table->node); -mutex_unlock (&nvmem_cell_mutex); -} -EXPORT_SYMBOL_GPL (nvmem_del_cell_table); -/** * nvmem_add_cell_lookups() - register a list of cell lookup entries *
include/linux/nvmem-provider.h +0 -5
@@ -190,9 +190,6 @@ void nvmem_unregister(struct nvmem_device *nvmem);struct nvmem_device *devm_nvmem_register (struct device *dev,const struct nvmem_config *cfg); -void nvmem_add_cell_table (struct nvmem_cell_table *table); -void nvmem_del_cell_table (struct nvmem_cell_table *table); -int nvmem_add_one_cell (struct nvmem_device *nvmem,const struct nvmem_cell_info *info);
@@ -223,8 +220,6 @@ devm_nvmem_register(struct device *dev, const struct nvmem_config *c)return nvmem_register (c); } -static inline void nvmem_add_cell_table (struct nvmem_cell_table *table) {} -static inline void nvmem_del_cell_table (struct nvmem_cell_table *table) {}static inline int nvmem_add_one_cell (struct nvmem_device *nvmem,const struct nvmem_cell_info *info) {
Signature · 1 line
2.48.1
PATCH 3/3 nvmem: core: Remove remains of nvmem_cell_table
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
With the previous patch removing the unused nvmem_add_cell_table, there's no way to add a table, and thus the rest of the table infrastructure can go.
--- Documentation/driver-api/nvmem.rst | 17 ------------ drivers/nvmem/core.c | 42 ------------------------------ include/linux/nvmem-provider.h | 19 -------------- 3 files changed, 78 deletions(-)
Documentation/driver-api/nvmem.rst +0 -17
@@ -59,23 +59,6 @@ For example, a simple nvram case:: devm_nvmem_register(&config); } -Users of board files can define and register nvmem cells using the -nvmem_cell_table struct:: - - static struct nvmem_cell_info foo_nvmem_cells[] = { - { - .name = "macaddr", - .offset = 0x7f00, - .bytes = ETH_ALEN, - } - }; - - static struct nvmem_cell_table foo_nvmem_cell_table = { - .nvmem_name = "i2c-eeprom", - .cells = foo_nvmem_cells, - .ncells = ARRAY_SIZE(foo_nvmem_cells), - }; - Additionally it is possible to create nvmem cell lookup entries and register them with the nvmem framework from machine code as shown in the example below::
drivers/nvmem/core.c +0 -42
60 lines not on this page · raw message
include/linux/nvmem-provider.h +0 -19
@@ -137,25 +137,6 @@ struct nvmem_config {struct device *base_dev; }; -/** -* struct nvmem_cell_table - NVMEM cell definitions for given provider -* -* @nvmem_name: Provider name. -* @cells: Array of cell definitions. -* @ncells: Number of cell definitions in the array. -* @node: List node. -* -* This structure together with related helper functions is provided for users -* that don't can't access the nvmem provided structure but wish to register -* cell definitions for it e.g. board files registering an EEPROM device. -*/ -struct nvmem_cell_table { -const char *nvmem_name; -const struct nvmem_cell_info *cells; -size_t ncells; -struct list_head node; -}; -/** * struct nvmem_layout - NVMEM layout definitions *
Signature · 1 line
2.48.1
Quoted 19 lines · * [email protected] ([email protected]) wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
This series removes some uncalled deadcode in nvmem.
The third patch probably deserves a bit closer inspection.The first one removes nvmem_device_cell_read/write functions that haven't been used in ~10 years.
The second removes nvmem_add/del_cell_table - again this is removing uncalled functions;
nvmem_add_cell_tableis unused after the removal of the Davinci machines.The third one removes the remaining
nvmem_cell_tablecode - including a function that's called (nvmem_add_cells_from_table) - but my reading is that from the previous patch there's no way for this function to do anything active any more since the list it walks is empty.
Quoted 3 lines
Build tested only.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
Hi,
I'd appreciate a review on this series if you get a chance.
Dave (cleaning up his patch queue)
Quoted 16 lines
Dr. David Alan Gilbert (3):
nvmem: core: Remove unusednvmem_device_cell_(read|write)
nvmem: core: Remove nvmem_(add|del)_cell_table
nvmem: core: Remove remains ofnvmem_cell_tableDocumentation/driver-api/nvmem.rst | 23 ------ drivers/nvmem/core.c | 126 ----------------------------- include/linux/nvmem-consumer.h | 4 - include/linux/nvmem-provider.h | 24 ------ 4 files changed, 177 deletions(-)Signature · 1 line
2.48.1
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/