Skip to content

Commit

Permalink
most: remove usage of the deprecated ida_simple_xx() API
Browse files Browse the repository at this point in the history
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.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Parthiban 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: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
tititiou36 authored and akpm00 committed Jun 25, 2024
1 parent 08ab091 commit b737a22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions drivers/most/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,15 +1286,15 @@ int most_register_interface(struct most_interface *iface)
!iface->poison_channel || (iface->num_channels > MAX_CHANNELS))
return -EINVAL;

id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL);
id = ida_alloc(&mdev_id, GFP_KERNEL);
if (id < 0) {
dev_err(iface->dev, "Failed to allocate device ID\n");
return id;
}

iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
if (!iface->p) {
ida_simple_remove(&mdev_id, id);
ida_free(&mdev_id, id);
return -ENOMEM;
}

Expand All @@ -1308,7 +1308,7 @@ int most_register_interface(struct most_interface *iface)
dev_err(iface->dev, "Failed to register interface device\n");
kfree(iface->p);
put_device(iface->dev);
ida_simple_remove(&mdev_id, id);
ida_free(&mdev_id, id);
return -ENOMEM;
}

Expand Down Expand Up @@ -1366,7 +1366,7 @@ int most_register_interface(struct most_interface *iface)
}
kfree(iface->p);
device_unregister(iface->dev);
ida_simple_remove(&mdev_id, id);
ida_free(&mdev_id, id);
return -ENOMEM;
}
EXPORT_SYMBOL_GPL(most_register_interface);
Expand Down Expand Up @@ -1397,7 +1397,7 @@ void most_deregister_interface(struct most_interface *iface)
device_unregister(&c->dev);
}

ida_simple_remove(&mdev_id, iface->p->dev_id);
ida_free(&mdev_id, iface->p->dev_id);
kfree(iface->p);
device_unregister(iface->dev);
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/most/most_cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void destroy_cdev(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);
kfree(c);
}
Expand Down Expand Up @@ -425,7 +425,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
if (c)
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)
return current_minor;

Expand Down Expand Up @@ -472,7 +472,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
err_free_c:
kfree(c);
err_remove_ida:
ida_simple_remove(&comp.minor_id, current_minor);
ida_free(&comp.minor_id, current_minor);
return retval;
}

Expand Down

0 comments on commit b737a22

Please sign in to comment.