Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fsi: occ: remove usage of the deprecated ida_simple_xx() API

Patch series "Remove usage of the deprecated ida_simple_xx() API".

The series removes the *last* usages of the deprecated ida_simple_xx() API.


This patch (of 3):

ida_alloc() and ida_free() should be preferred to the deprecated
ida_simple_get() and ida_simple_remove().

Note that the upper limit of ida_simple_get() is exclusive, but the one of
ida_alloc_range() is inclusive. So, this upper limit, INT_MAX, should
have been changed to INT_MAX-1.

But, it is likely that the INT_MAX 'idx' is valid that the max value passed
to ida_simple_get() should have been 0.

So, allow this INT_MAX 'idx' value now.

Link: https://lkml.kernel.org/r/cover.1717855701.git.christophe.jaillet@wanadoo.fr
Link: https://lkml.kernel.org/r/8e28b0c45fe8f28ca4475fe0027f8099c41259f0.1717855701.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Cc: Alistar Popple <alistair@popple.id.au>
Cc: Christian Gromm <christian.gromm@microchip.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Christophe JAILLET and committed by
Andrew Morton
08ab0915 5eb1911a

+8 -9
+8 -9
drivers/fsi/fsi-occ.c
··· 656 656 rc = of_property_read_u32(dev->of_node, "reg", &reg); 657 657 if (!rc) { 658 658 /* make sure we don't have a duplicate from dts */ 659 - occ->idx = ida_simple_get(&occ_ida, reg, reg + 1, 660 - GFP_KERNEL); 659 + occ->idx = ida_alloc_range(&occ_ida, reg, reg, 660 + GFP_KERNEL); 661 661 if (occ->idx < 0) 662 - occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX, 663 - GFP_KERNEL); 662 + occ->idx = ida_alloc_min(&occ_ida, 1, 663 + GFP_KERNEL); 664 664 } else { 665 - occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX, 666 - GFP_KERNEL); 665 + occ->idx = ida_alloc_min(&occ_ida, 1, GFP_KERNEL); 667 666 } 668 667 } else { 669 - occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX, GFP_KERNEL); 668 + occ->idx = ida_alloc_min(&occ_ida, 1, GFP_KERNEL); 670 669 } 671 670 672 671 platform_set_drvdata(pdev, occ); ··· 679 680 rc = misc_register(&occ->mdev); 680 681 if (rc) { 681 682 dev_err(dev, "failed to register miscdevice: %d\n", rc); 682 - ida_simple_remove(&occ_ida, occ->idx); 683 + ida_free(&occ_ida, occ->idx); 683 684 kvfree(occ->buffer); 684 685 return rc; 685 686 } ··· 718 719 else 719 720 device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child); 720 721 721 - ida_simple_remove(&occ_ida, occ->idx); 722 + ida_free(&occ_ida, occ->idx); 722 723 723 724 return 0; 724 725 }