drivers: char: Directly use ida_alloc()/free()
Subsystems (6)
PATCH 1/1 drivers: char: Directly use ida_alloc()/free()
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .
Signed-off-by keliu <[email protected]>
--- drivers/char/hw_random/virtio-rng.c | 6 +++--- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- drivers/char/ppdev.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/char/hw_random/virtio-rng.c +3 -3
@@ -135,7 +135,7 @@ static int probe_common(struct virtio_device *vdev)if (!vi)return -ENOMEM ; - vi->index = index =ida_simple_get (&rng_index_ida,0 ,0 ,GFP_KERNEL ); + vi->index = index =ida_alloc (&rng_index_ida,GFP_KERNEL );if (index <0 ) { err = index; goto err_ida;
@@ -165,7 +165,7 @@ static int probe_common(struct virtio_device *vdev)return 0 ; err_find: -ida_simple_remove (&rng_index_ida, index); +ida_free (&rng_index_ida, index); err_ida:kfree (vi);return err;
@@ -183,7 +183,7 @@ static void remove_common(struct virtio_device *vdev)hwrng_unregister (&vi->hwrng);virtio_reset_device (vdev); vdev->config->del_vqs (vdev); -ida_simple_remove (&rng_index_ida, vi->index); +ida_free (&rng_index_ida, vi->index);kfree (vi); }
drivers/char/ipmi/ipmi_msghandler.c +2 -2
@@ -3018,7 +3018,7 @@ static void cleanup_bmc_work(struct work_struct *work)int id = bmc->pdev.id;/* Unregister overwrites id */ platform_device_unregister (&bmc->pdev); -ida_simple_remove (&ipmi_bmc_ida, id); +ida_free (&ipmi_bmc_ida, id); } static void
@@ -3134,7 +3134,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, bmc->pdev.name ="ipmi_bmc" ; - rv =ida_simple_get (&ipmi_bmc_ida,0 ,0 ,GFP_KERNEL ); + rv =ida_alloc (&ipmi_bmc_ida,GFP_KERNEL );if (rv <0 ) {kfree (bmc); goto out;
drivers/char/ppdev.c +3 -3
@@ -299,7 +299,7 @@ static int register_device(int minor, struct pp_struct *pp) goto err; } - index =ida_simple_get (&ida_index,0 ,0 ,GFP_KERNEL ); + index =ida_alloc (&ida_index,GFP_KERNEL );memset (&ppdev_cb,0 ,sizeof (ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags &PP_EXCL ) ?PARPORT_FLAG_EXCL :0 ;
@@ -310,7 +310,7 @@ static int register_device(int minor, struct pp_struct *pp)if (!pdev) {pr_warn ("%s: failed to register device!\n" , name); rc = -ENXIO ; -ida_simple_remove (&ida_index, index); +ida_free (&ida_index, index); goto err; }
@@ -750,7 +750,7 @@ static int pp_release(struct inode *inode, struct file *file)if (pp->pdev) {parport_unregister_device (pp->pdev); -ida_simple_remove (&ida_index, pp->index); +ida_free (&ida_index, pp->index); pp->pdev =NULL ;pr_debug (CHRDEV "%x: unregistered pardevice\n" , minor); }
Signature · 1 line
2.25.1
Quoted 4 lines · keliu
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .Signed-off-by keliu <[email protected]>
virtio bits
pls cc people that commented on a similar patch in the past though.
Thanks!
Quoted 92 lines
--- drivers/char/hw_random/virtio-rng.c | 6 +++--- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- drivers/char/ppdev.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-)drivers/char/hw_random/virtio-rng.c +3
-3@@ -135,7 +135,7 @@ static int probe_common(struct virtio_device *vdev)if (!vi)return -ENOMEM ; - vi->index = index =ida_simple_get (&rng_index_ida,0 ,0 ,GFP_KERNEL ); + vi->index = index =ida_alloc (&rng_index_ida,GFP_KERNEL );if (index <0 ) { err = index; goto err_ida;@@ -165,7 +165,7 @@ static int probe_common(struct virtio_device *vdev)return 0 ; err_find: -ida_simple_remove (&rng_index_ida, index); +ida_free (&rng_index_ida, index); err_ida:kfree (vi);return err;@@ -183,7 +183,7 @@ static void remove_common(struct virtio_device *vdev)hwrng_unregister (&vi->hwrng);virtio_reset_device (vdev); vdev->config->del_vqs (vdev); -ida_simple_remove (&rng_index_ida, vi->index); +ida_free (&rng_index_ida, vi->index);kfree (vi); }drivers/char/ipmi/ipmi_msghandler.c +2
-2@@ -3018,7 +3018,7 @@ static void cleanup_bmc_work(struct work_struct *work)int id = bmc->pdev.id;/* Unregister overwrites id */ platform_device_unregister (&bmc->pdev); -ida_simple_remove (&ipmi_bmc_ida, id); +ida_free (&ipmi_bmc_ida, id); } static void@@ -3134,7 +3134,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, bmc->pdev.name ="ipmi_bmc" ; - rv =ida_simple_get (&ipmi_bmc_ida,0 ,0 ,GFP_KERNEL ); + rv =ida_alloc (&ipmi_bmc_ida,GFP_KERNEL );if (rv <0 ) {kfree (bmc); goto out;drivers/char/ppdev.c +3
-3@@ -299,7 +299,7 @@ static int register_device(int minor, struct pp_struct *pp) goto err; } - index =ida_simple_get (&ida_index,0 ,0 ,GFP_KERNEL ); + index =ida_alloc (&ida_index,GFP_KERNEL );memset (&ppdev_cb,0 ,sizeof (ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags &PP_EXCL ) ?PARPORT_FLAG_EXCL :0 ;@@ -310,7 +310,7 @@ static int register_device(int minor, struct pp_struct *pp)if (!pdev) {pr_warn ("%s: failed to register device!\n" , name); rc = -ENXIO ; -ida_simple_remove (&ida_index, index); +ida_free (&ida_index, index); goto err; }@@ -750,7 +750,7 @@ static int pp_release(struct inode *inode, struct file *file)if (pp->pdev) {parport_unregister_device (pp->pdev); -ida_simple_remove (&ida_index, pp->index); +ida_free (&ida_index, pp->index); pp->pdev =NULL ;pr_debug (CHRDEV "%x: unregistered pardevice\n" , minor); }Signature · 1 line
2.25.1
Quoted 9 lines · keliu
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .Signed-off-by keliu <[email protected]>--- drivers/char/hw_random/virtio-rng.c | 6 +++--- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- drivers/char/ppdev.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-)
If you want this to go into individual maintainer trees, you will need to split it up. Otherwise, how are you planning to get this change into the kernel?
-corey
Quoted 88 lines
drivers/char/hw_random/virtio-rng.c +3
-3@@ -135,7 +135,7 @@ static int probe_common(struct virtio_device *vdev)if (!vi)return -ENOMEM ; - vi->index = index =ida_simple_get (&rng_index_ida,0 ,0 ,GFP_KERNEL ); + vi->index = index =ida_alloc (&rng_index_ida,GFP_KERNEL );if (index <0 ) { err = index; goto err_ida;@@ -165,7 +165,7 @@ static int probe_common(struct virtio_device *vdev)return 0 ; err_find: -ida_simple_remove (&rng_index_ida, index); +ida_free (&rng_index_ida, index); err_ida:kfree (vi);return err;@@ -183,7 +183,7 @@ static void remove_common(struct virtio_device *vdev)hwrng_unregister (&vi->hwrng);virtio_reset_device (vdev); vdev->config->del_vqs (vdev); -ida_simple_remove (&rng_index_ida, vi->index); +ida_free (&rng_index_ida, vi->index);kfree (vi); }drivers/char/ipmi/ipmi_msghandler.c +2
-2@@ -3018,7 +3018,7 @@ static void cleanup_bmc_work(struct work_struct *work)int id = bmc->pdev.id;/* Unregister overwrites id */ platform_device_unregister (&bmc->pdev); -ida_simple_remove (&ipmi_bmc_ida, id); +ida_free (&ipmi_bmc_ida, id); } static void@@ -3134,7 +3134,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, bmc->pdev.name ="ipmi_bmc" ; - rv =ida_simple_get (&ipmi_bmc_ida,0 ,0 ,GFP_KERNEL ); + rv =ida_alloc (&ipmi_bmc_ida,GFP_KERNEL );if (rv <0 ) {kfree (bmc); goto out;drivers/char/ppdev.c +3
-3@@ -299,7 +299,7 @@ static int register_device(int minor, struct pp_struct *pp) goto err; } - index =ida_simple_get (&ida_index,0 ,0 ,GFP_KERNEL ); + index =ida_alloc (&ida_index,GFP_KERNEL );memset (&ppdev_cb,0 ,sizeof (ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags &PP_EXCL ) ?PARPORT_FLAG_EXCL :0 ;@@ -310,7 +310,7 @@ static int register_device(int minor, struct pp_struct *pp)if (!pdev) {pr_warn ("%s: failed to register device!\n" , name); rc = -ENXIO ; -ida_simple_remove (&ida_index, index); +ida_free (&ida_index, index); goto err; }@@ -750,7 +750,7 @@ static int pp_release(struct inode *inode, struct file *file)if (pp->pdev) {parport_unregister_device (pp->pdev); -ida_simple_remove (&ida_index, pp->index); +ida_free (&ida_index, pp->index); pp->pdev =NULL ;pr_debug (CHRDEV "%x: unregistered pardevice\n" , minor); }Signature · 1 line
2.25.1