idr: Remove unused ida_simple_{get,remove}
Subsystems (3)
PATCH 1/1 idr: Remove unused ida_simple_{get,remove}
These are no longer used anywhere, remove them; update the nvmem-prodiver.h to refer to ida_alloc() which is what is used now (see drivers/nvmem/core.c).
--- include/linux/idr.h | 8 -------- include/linux/nvmem-provider.h | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-)
include/linux/idr.h +0 -8
@@ -314,14 +314,6 @@ static inline void ida_init(struct ida *ida)xa_init_flags (&ida->xa,IDA_INIT_FLAGS ); } -/* -* ida_simple_get() and ida_simple_remove() are deprecated. Use -* ida_alloc() and ida_free() instead respectively. -*/ -#define ida_simple_get (ida, start, end, gfp) \ - ida_alloc_range(ida, start, (end) - 1, gfp) -#define ida_simple_remove (ida, id) ida_free(ida, id) -static inline bool ida_is_empty (const struct ida *ida) {return xa_empty (&ida->xa);
include/linux/nvmem-provider.h +1 -1
@@ -75,7 +75,7 @@ struct nvmem_keepout {* * Note: A default "nvmem<id>" name will be assigned to the device if * no name is specified in its configuration. In such case "<id>" is -* generated with ida_simple_get() and provided id field is ignored. +* generated with ida_alloc() and provided id field is ignored. * * Note: Specifying name and setting id to -1 implies a unique device * whose name is provided as-is (kept unaltered).
base-commit: 5191290407668028179f2544a11ae9b57f0bcf07
Signature · 1 line
2.30.2
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Stephen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on 5191290407668028179f2544a11ae9b57f0bcf07]
url: https://github.com/0day-ci/linux/commits/Stephen-Kitt/idr-Remove-unused-ida_simple_-get-remove/20220323-062521 base: 5191290407668028179f2544a11ae9b57f0bcf07 config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220323/[email protected]/config) compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/13945a32161b59a82eca06de385ea0f38b88439e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Stephen-Kitt/idr-Remove-unused-ida_simple_-get-remove/20220323-062521 git checkout 13945a32161b59a82eca06de385ea0f38b88439e
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
fs/eventfd.c: In function 'eventfd_free_ctx':
>> fs/eventfd.c:92:3: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
92 | ida_simple_remove(&eventfd_ida, ctx->id);
| ^~~~~~~~~~~~~~~~~
fs/eventfd.c: In function 'do_eventfd':
>> fs/eventfd.c:426:12: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
426 | ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
fs/proc/generic.c: In function 'proc_alloc_inum':
>> fs/proc/generic.c:206:6: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
206 | i = ida_simple_get(&proc_inum_ida, 0, UINT_MAX - PROC_DYNAMIC_FIRST + 1,
| ^~~~~~~~~~~~~~
fs/proc/generic.c: In function 'proc_free_inum':
>> fs/proc/generic.c:217:2: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
217 | ida_simple_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
block/blk-core.c: In function 'blk_alloc_queue':
>> block/blk-core.c:456:10: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
456 | q->id = ida_simple_get(&blk_queue_ida, 0, 0, GFP_KERNEL);
| ^~~~~~~~~~~~~~
>> block/blk-core.c:506:2: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
506 | ida_simple_remove(&blk_queue_ida, q->id);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
block/blk-sysfs.c: In function 'blk_release_queue':
>> block/blk-sysfs.c:796:2: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
796 | ida_simple_remove(&blk_queue_ida, q->id);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/base/swnode.c: In function 'software_node_release':
>> drivers/base/swnode.c:750:3: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
750 | ida_simple_remove(&swnode->parent->child_ids, swnode->id);
| ^~~~~~~~~~~~~~~~~
drivers/base/swnode.c: In function 'swnode_register':
>> drivers/base/swnode.c:779:8: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
779 | ret = ida_simple_get(parent ? &parent->child_ids : &swnode_root_ids,
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/input/input.c: In function 'input_get_new_minor':
>> drivers/input/input.c:2577:15: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
2577 | int minor = ida_simple_get(&input_ida,
| ^~~~~~~~~~~~~~
drivers/input/input.c: In function 'input_free_minor':
>> drivers/input/input.c:2600:2: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
2600 | ida_simple_remove(&input_ida, minor);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/ptp/ptp_clock.c: In function 'ptp_clock_release':
>> drivers/ptp/ptp_clock.c:177:2: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
177 | ida_simple_remove(&ptp_clocks_map, ptp->index);
| ^~~~~~~~~~~~~~~~~
drivers/ptp/ptp_clock.c: In function 'ptp_clock_register':
>> drivers/ptp/ptp_clock.c:212:10: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
212 | index = ida_simple_get(&ptp_clocks_map, 0, MINORMASK + 1, GFP_KERNEL);
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
net/core/xdp.c: In function '__xdp_mem_allocator_rcu_free':
>> net/core/xdp.c:76:2: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
76 | ida_simple_remove(&mem_id_pool, xa->mem.id);
| ^~~~~~~~~~~~~~~~~
net/core/xdp.c: In function '__mem_id_cyclic_get':
>> net/core/xdp.c:241:7: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
241 | id = ida_simple_get(&mem_id_pool, mem_id_next, MEM_ID_MAX, gfp);
| ^~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/ida_simple_remove +92 fs/eventfd.c
e1ad7468c77ddb Davide Libenzi 2007-05-10 88
562787a5c32ccd Davide Libenzi 2009-09-22 89 static void eventfd_free_ctx(struct eventfd_ctx *ctx)
562787a5c32ccd Davide Libenzi 2009-09-22 90 {
b556db17b0e7c4 Masatake YAMATO 2019-05-14 91 if (ctx->id >= 0)
b556db17b0e7c4 Masatake YAMATO 2019-05-14 @92 ida_simple_remove(&eventfd_ida, ctx->id);
562787a5c32ccd Davide Libenzi 2009-09-22 93 kfree(ctx);
562787a5c32ccd Davide Libenzi 2009-09-22 94 }562787a5c32ccd Davide Libenzi 2009-09-22 95
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Stephen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on 5191290407668028179f2544a11ae9b57f0bcf07]
url: https://github.com/0day-ci/linux/commits/Stephen-Kitt/idr-Remove-unused-ida_simple_-get-remove/20220323-062521 base: 5191290407668028179f2544a11ae9b57f0bcf07 config: arm-randconfig-p002-20220320 (https://download.01.org/0day-ci/archive/20220323/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.2.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/0day-ci/linux/commit/13945a32161b59a82eca06de385ea0f38b88439e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Stephen-Kitt/idr-Remove-unused-ida_simple_-get-remove/20220323-062521
git checkout 13945a32161b59a82eca06de385ea0f38b88439e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/base/ drivers/firmware/arm_scmi/ drivers/usb/chipidea/ drivers/usb/gadget/function/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/base/soc.c: In function 'soc_release':
>> drivers/base/soc.c:107:9: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
107 | ida_simple_remove(&soc_ida, soc_dev->soc_dev_num);
| ^~~~~~~~~~~~~~~~~
drivers/base/soc.c: In function 'soc_device_register':
>> drivers/base/soc.c:142:15: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
142 | ret = ida_simple_get(&soc_ida, 0, 0, GFP_KERNEL);
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/firmware/arm_scmi/bus.c: In function 'scmi_device_create':
>> drivers/firmware/arm_scmi/bus.c:184:14: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
184 | id = ida_simple_get(&scmi_bus_id, 1, 0, GFP_KERNEL);
| ^~~~~~~~~~~~~~
>> drivers/firmware/arm_scmi/bus.c:207:9: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
207 | ida_simple_remove(&scmi_bus_id, id);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/usb/chipidea/core.c: In function 'ci_hdrc_add_device':
>> drivers/usb/chipidea/core.c:856:14: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
856 | id = ida_simple_get(&ci_ida, 0, 0, GFP_KERNEL);
| ^~~~~~~~~~~~~~
>> drivers/usb/chipidea/core.c:886:9: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
886 | ida_simple_remove(&ci_ida, id);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/usb/gadget/function/f_hid.c: In function 'hidg_get_minor':
>> drivers/usb/gadget/function/f_hid.c:1031:15: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
1031 | ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL);
| ^~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_hid.c:1033:17: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
1033 | ida_simple_remove(&hidg_ida, ret);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/usb/gadget/function/f_printer.c: In function 'gprinter_get_minor':
>> drivers/usb/gadget/function/f_printer.c:1319:15: error: implicit declaration of function 'ida_simple_get' [-Werror=implicit-function-declaration]
1319 | ret = ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL);
| ^~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_printer.c:1321:17: error: implicit declaration of function 'ida_simple_remove' [-Werror=implicit-function-declaration]
1321 | ida_simple_remove(&printer_ida, ret);
| ^~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/ida_simple_remove +107 drivers/base/soc.c
74d1d82cdaaec7 Lee Jones 2012-02-06 102
74d1d82cdaaec7 Lee Jones 2012-02-06 103 static void soc_release(struct device *dev)
74d1d82cdaaec7 Lee Jones 2012-02-06 104 {
74d1d82cdaaec7 Lee Jones 2012-02-06 105 struct soc_device *soc_dev = container_of(dev, struct soc_device, dev);
74d1d82cdaaec7 Lee Jones 2012-02-06 106
c31e73121f4c1e Murali Nalajala 2019-10-07 @107 ida_simple_remove(&soc_ida, soc_dev->soc_dev_num);
c31e73121f4c1e Murali Nalajala 2019-10-07 108 kfree(soc_dev->dev.groups);
74d1d82cdaaec7 Lee Jones 2012-02-06 109 kfree(soc_dev);
74d1d82cdaaec7 Lee Jones 2012-02-06 110 }
74d1d82cdaaec7 Lee Jones 2012-02-06 111
6e12db376b60b7 Geert Uytterhoeven 2017-03-09 112 static struct soc_device_attribute *early_soc_dev_attr;
6e12db376b60b7 Geert Uytterhoeven 2017-03-09 113
74d1d82cdaaec7 Lee Jones 2012-02-06 114 struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr)
74d1d82cdaaec7 Lee Jones 2012-02-06 115 {
74d1d82cdaaec7 Lee Jones 2012-02-06 116 struct soc_device *soc_dev;
c31e73121f4c1e Murali Nalajala 2019-10-07 117 const struct attribute_group **soc_attr_groups;
74d1d82cdaaec7 Lee Jones 2012-02-06 118 int ret;
74d1d82cdaaec7 Lee Jones 2012-02-06 119
1da1b3628df34a Geert Uytterhoeven 2016-09-27 120 if (!soc_bus_type.p) {
6e12db376b60b7 Geert Uytterhoeven 2017-03-09 121 if (early_soc_dev_attr)
6e12db376b60b7 Geert Uytterhoeven 2017-03-09 122 return ERR_PTR(-EBUSY);
6e12db376b60b7 Geert Uytterhoeven 2017-03-09 123 early_soc_dev_attr = soc_dev_attr;
6e12db376b60b7 Geert Uytterhoeven 2017-03-09 124 return NULL;
1da1b3628df34a Geert Uytterhoeven 2016-09-27 125 }
1da1b3628df34a Geert Uytterhoeven 2016-09-27 126
74d1d82cdaaec7 Lee Jones 2012-02-06 127 soc_dev = kzalloc(sizeof(*soc_dev), GFP_KERNEL);
74d1d82cdaaec7 Lee Jones 2012-02-06 128 if (!soc_dev) {
74d1d82cdaaec7 Lee Jones 2012-02-06 129 ret = -ENOMEM;
74d1d82cdaaec7 Lee Jones 2012-02-06 130 goto out1;
74d1d82cdaaec7 Lee Jones 2012-02-06 131 }
74d1d82cdaaec7 Lee Jones 2012-02-06 132
c31e73121f4c1e Murali Nalajala 2019-10-07 133 soc_attr_groups = kcalloc(3, sizeof(*soc_attr_groups), GFP_KERNEL);
c31e73121f4c1e Murali Nalajala 2019-10-07 134 if (!soc_attr_groups) {
c31e73121f4c1e Murali Nalajala 2019-10-07 135 ret = -ENOMEM;
c31e73121f4c1e Murali Nalajala 2019-10-07 136 goto out2;
c31e73121f4c1e Murali Nalajala 2019-10-07 137 }
c31e73121f4c1e Murali Nalajala 2019-10-07 138 soc_attr_groups[0] = &soc_attr_group;
c31e73121f4c1e Murali Nalajala 2019-10-07 139 soc_attr_groups[1] = soc_dev_attr->custom_attr_group;
c31e73121f4c1e Murali Nalajala 2019-10-07 140
74d1d82cdaaec7 Lee Jones 2012-02-06 141 /* Fetch a unique (reclaimable) SOC ID. */
cfcf6a91aa0d59 Lee Duncan 2015-10-01 @142 ret = ida_simple_get(&soc_ida, 0, 0, GFP_KERNEL);
cfcf6a91aa0d59 Lee Duncan 2015-10-01 143 if (ret < 0)
c31e73121f4c1e Murali Nalajala 2019-10-07 144 goto out3;
cfcf6a91aa0d59 Lee Duncan 2015-10-01 145 soc_dev->soc_dev_num = ret;
74d1d82cdaaec7 Lee Jones 2012-02-06 146
74d1d82cdaaec7 Lee Jones 2012-02-06 147 soc_dev->attr = soc_dev_attr;
74d1d82cdaaec7 Lee Jones 2012-02-06 148 soc_dev->dev.bus = &soc_bus_type;
74d1d82cdaaec7 Lee Jones 2012-02-06 149 soc_dev->dev.groups = soc_attr_groups;
74d1d82cdaaec7 Lee Jones 2012-02-06 150 soc_dev->dev.release = soc_release;
74d1d82cdaaec7 Lee Jones 2012-02-06 151
74d1d82cdaaec7 Lee Jones 2012-02-06 152 dev_set_name(&soc_dev->dev, "soc%d", soc_dev->soc_dev_num);
74d1d82cdaaec7 Lee Jones 2012-02-06 153
74d1d82cdaaec7 Lee Jones 2012-02-06 154 ret = device_register(&soc_dev->dev);
c31e73121f4c1e Murali Nalajala 2019-10-07 155 if (ret) {
c31e73121f4c1e Murali Nalajala 2019-10-07 156 put_device(&soc_dev->dev);
c31e73121f4c1e Murali Nalajala 2019-10-07 157 return ERR_PTR(ret);
c31e73121f4c1e Murali Nalajala 2019-10-07 158 }
74d1d82cdaaec7 Lee Jones 2012-02-06 159
74d1d82cdaaec7 Lee Jones 2012-02-06 160 return soc_dev;
74d1d82cdaaec7 Lee Jones 2012-02-06 161
74d1d82cdaaec7 Lee Jones 2012-02-06 162 out3:
c31e73121f4c1e Murali Nalajala 2019-10-07 163 kfree(soc_attr_groups);
74d1d82cdaaec7 Lee Jones 2012-02-06 164 out2:
74d1d82cdaaec7 Lee Jones 2012-02-06 165 kfree(soc_dev);
74d1d82cdaaec7 Lee Jones 2012-02-06 166 out1:
74d1d82cdaaec7 Lee Jones 2012-02-06 167 return ERR_PTR(ret);
74d1d82cdaaec7 Lee Jones 2012-02-06 168 }
f7ccc7a397cf2e Vinod Koul 2019-07-24 169 EXPORT_SYMBOL_GPL(soc_device_register);
74d1d82cdaaec7 Lee Jones 2012-02-06 170 Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
Quoted 43 lines · Stephen Kitt
These are no longer used anywhere, remove them; update the
nvmem-prodiver.hto refer toida_alloc()which is what is used now (seedrivers/nvmem/core.c).Signed-off-by Stephen Kitt <[email protected]>---
include/linux/idr.h| 8 --------include/linux/nvmem-provider.h| 2 +-2 files changed, 1 insertion(+), 9 deletions(-)include/linux/idr.h +0
-8@@ -314,14 +314,6 @@ static inline void ida_init(struct ida *ida)xa_init_flags (&ida->xa,IDA_INIT_FLAGS ); } -/* -* ida_simple_get() and ida_simple_remove() are deprecated. Use -* ida_alloc() and ida_free() instead respectively. -*/ -#define ida_simple_get (ida, start, end, gfp) \ - ida_alloc_range(ida, start, (end) - 1, gfp) -#define ida_simple_remove (ida, id) ida_free(ida, id) -static inline bool ida_is_empty (const struct ida *ida) {return xa_empty (&ida->xa);include/linux/nvmem-provider.h +1
-1@@ -75,7 +75,7 @@ struct nvmem_keepout {* * Note: A default "nvmem<id>" name will be assigned to the device if * no name is specified in its configuration. In such case "<id>" is -* generated with ida_simple_get() and provided id field is ignored. +* generated with ida_alloc() and provided id field is ignored. * * Note: Specifying name and setting id to -1 implies a unique device * whose name is provided as-is (kept unaltered).
Quoted 1 line
base-commit:
5191290407668028179f2544a11ae9b57f0bcf07
Apologies for the waste of time, these are far from unused. I'm not sure why my searches didn't find anything yesterday...
Regards,
Stephen