Commit b737a221 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Andrew Morton

most: remove usage of the deprecated ida_simple_xx() API

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

This is less verbose.

Link: https://lkml.kernel.org/r/ddbb2e3f249ba90417dc7ab01713faa1091fb44c.1717855701.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarParthiban Veerasooran <parthiban.veerasooran@microchip.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Alistar Popple <alistair@popple.id.au>
Cc: Christian Gromm <christian.gromm@microchip.com>
Cc: Eddie James <eajames@linux.ibm.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 08ab0915
...@@ -1286,7 +1286,7 @@ int most_register_interface(struct most_interface *iface) ...@@ -1286,7 +1286,7 @@ int most_register_interface(struct most_interface *iface)
!iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) !iface->poison_channel || (iface->num_channels > MAX_CHANNELS))
return -EINVAL; return -EINVAL;
id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL); id = ida_alloc(&mdev_id, GFP_KERNEL);
if (id < 0) { if (id < 0) {
dev_err(iface->dev, "Failed to allocate device ID\n"); dev_err(iface->dev, "Failed to allocate device ID\n");
return id; return id;
...@@ -1294,7 +1294,7 @@ int most_register_interface(struct most_interface *iface) ...@@ -1294,7 +1294,7 @@ int most_register_interface(struct most_interface *iface)
iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL); iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
if (!iface->p) { if (!iface->p) {
ida_simple_remove(&mdev_id, id); ida_free(&mdev_id, id);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1308,7 +1308,7 @@ int most_register_interface(struct most_interface *iface) ...@@ -1308,7 +1308,7 @@ int most_register_interface(struct most_interface *iface)
dev_err(iface->dev, "Failed to register interface device\n"); dev_err(iface->dev, "Failed to register interface device\n");
kfree(iface->p); kfree(iface->p);
put_device(iface->dev); put_device(iface->dev);
ida_simple_remove(&mdev_id, id); ida_free(&mdev_id, id);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1366,7 +1366,7 @@ int most_register_interface(struct most_interface *iface) ...@@ -1366,7 +1366,7 @@ int most_register_interface(struct most_interface *iface)
} }
kfree(iface->p); kfree(iface->p);
device_unregister(iface->dev); device_unregister(iface->dev);
ida_simple_remove(&mdev_id, id); ida_free(&mdev_id, id);
return -ENOMEM; return -ENOMEM;
} }
EXPORT_SYMBOL_GPL(most_register_interface); EXPORT_SYMBOL_GPL(most_register_interface);
...@@ -1397,7 +1397,7 @@ void most_deregister_interface(struct most_interface *iface) ...@@ -1397,7 +1397,7 @@ void most_deregister_interface(struct most_interface *iface)
device_unregister(&c->dev); device_unregister(&c->dev);
} }
ida_simple_remove(&mdev_id, iface->p->dev_id); ida_free(&mdev_id, iface->p->dev_id);
kfree(iface->p); kfree(iface->p);
device_unregister(iface->dev); device_unregister(iface->dev);
} }
......
...@@ -100,7 +100,7 @@ static void destroy_cdev(struct comp_channel *c) ...@@ -100,7 +100,7 @@ static void destroy_cdev(struct comp_channel *c)
static void destroy_channel(struct comp_channel *c) static void destroy_channel(struct comp_channel *c)
{ {
ida_simple_remove(&comp.minor_id, MINOR(c->devno)); ida_free(&comp.minor_id, MINOR(c->devno));
kfifo_free(&c->fifo); kfifo_free(&c->fifo);
kfree(c); kfree(c);
} }
...@@ -425,7 +425,7 @@ static int comp_probe(struct most_interface *iface, int channel_id, ...@@ -425,7 +425,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
if (c) if (c)
return -EEXIST; return -EEXIST;
current_minor = ida_simple_get(&comp.minor_id, 0, 0, GFP_KERNEL); current_minor = ida_alloc(&comp.minor_id, GFP_KERNEL);
if (current_minor < 0) if (current_minor < 0)
return current_minor; return current_minor;
...@@ -472,7 +472,7 @@ static int comp_probe(struct most_interface *iface, int channel_id, ...@@ -472,7 +472,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
err_free_c: err_free_c:
kfree(c); kfree(c);
err_remove_ida: err_remove_ida:
ida_simple_remove(&comp.minor_id, current_minor); ida_free(&comp.minor_id, current_minor);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment