* [PATCH] most: Directly use ida_alloc()/free()
@ 2022-05-27 8:33 keliu
2022-05-27 15:37 ` Randy Dunlap
0 siblings, 1 reply; 4+ messages in thread
From: keliu @ 2022-05-27 8:33 UTC (permalink / raw)
To: rdunlap, gregkh, christian.gromm, linux-kernel; +Cc: keliu
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .
Signed-off-by: keliu <liuke94@huawei.com>
---
drivers/most/core.c | 10 +++++-----
drivers/most/most_cdev.c | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/most/core.c b/drivers/most/core.c
index e4412c7d25b0..81d60d4ee8c2 100644
--- a/drivers/most/core.c
+++ b/drivers/most/core.c
@@ -1286,7 +1286,7 @@ 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;
@@ -1294,7 +1294,7 @@ int most_register_interface(struct most_interface *iface)
iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
if (!iface->p) {
- ida_simple_remove(&mdev_id, id);
+ ida_free(&mdev_id, id);
return -ENOMEM;
}
@@ -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;
}
@@ -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);
@@ -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);
}
diff --git a/drivers/most/most_cdev.c b/drivers/most/most_cdev.c
index 3722f9abd7b9..27913b1c8128 100644
--- a/drivers/most/most_cdev.c
+++ b/drivers/most/most_cdev.c
@@ -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);
}
@@ -424,7 +424,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;
@@ -471,7 +471,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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] most: Directly use ida_alloc()/free()
2022-05-27 8:33 [PATCH] most: Directly use ida_alloc()/free() keliu
@ 2022-05-27 15:37 ` Randy Dunlap
2022-05-27 16:50 ` Christophe JAILLET
0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2022-05-27 15:37 UTC (permalink / raw)
To: keliu, gregkh, christian.gromm, linux-kernel
On 5/27/22 01:33, keliu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
>
> Signed-off-by: keliu <liuke94@huawei.com>
The Signed-off-by: needs a more complete name (unless that is your full name).
Do any of Christophe's comments apply here?
thanks.
> ---
> drivers/most/core.c | 10 +++++-----
> drivers/most/most_cdev.c | 6 +++---
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/most/core.c b/drivers/most/core.c
> index e4412c7d25b0..81d60d4ee8c2 100644
> --- a/drivers/most/core.c
> +++ b/drivers/most/core.c
> @@ -1286,7 +1286,7 @@ 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;
> @@ -1294,7 +1294,7 @@ int most_register_interface(struct most_interface *iface)
>
> iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
> if (!iface->p) {
> - ida_simple_remove(&mdev_id, id);
> + ida_free(&mdev_id, id);
> return -ENOMEM;
> }
>
> @@ -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;
> }
>
> @@ -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);
> @@ -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);
> }
> diff --git a/drivers/most/most_cdev.c b/drivers/most/most_cdev.c
> index 3722f9abd7b9..27913b1c8128 100644
> --- a/drivers/most/most_cdev.c
> +++ b/drivers/most/most_cdev.c
> @@ -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);
> }
> @@ -424,7 +424,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;
>
> @@ -471,7 +471,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;
> }
>
--
~Randy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] most: Directly use ida_alloc()/free()
2022-05-27 15:37 ` Randy Dunlap
@ 2022-05-27 16:50 ` Christophe JAILLET
2022-05-27 17:06 ` Marion & Christophe JAILLET
0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2022-05-27 16:50 UTC (permalink / raw)
To: Randy Dunlap, keliu, gregkh, christian.gromm, linux-kernel
Le 27/05/2022 à 17:37, Randy Dunlap a écrit :
>
>
> On 5/27/22 01:33, keliu wrote:
>> Use ida_alloc()/ida_free() instead of deprecated
>> ida_simple_get()/ida_simple_remove() .
>>
>> Signed-off-by: keliu <liuke94@huawei.com>
>
> The Signed-off-by: needs a more complete name (unless that is your full name).
>
> Do any of Christophe's comments apply here?
Hi,
This one looks fine. Thanks keliu.
Should I nitpick, there is an extra <space> in the commit description
before the final "." :)
In fact, I'm sure of who can give a Reviewed-by: or Acked-by: tag. So up
to now, I only comment in-line when I go through patches randomly picked
on the linext-kernel ML.
I think it is mainly for maintainer, but if anyone can give them, I'll
be glad to add them if it helps in the process.
CJ
>
> thanks.
>
>> ---
>> drivers/most/core.c | 10 +++++-----
>> drivers/most/most_cdev.c | 6 +++---
>> 2 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/most/core.c b/drivers/most/core.c
>> index e4412c7d25b0..81d60d4ee8c2 100644
>> --- a/drivers/most/core.c
>> +++ b/drivers/most/core.c
>> @@ -1286,7 +1286,7 @@ 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;
>> @@ -1294,7 +1294,7 @@ int most_register_interface(struct most_interface *iface)
>>
>> iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
>> if (!iface->p) {
>> - ida_simple_remove(&mdev_id, id);
>> + ida_free(&mdev_id, id);
>> return -ENOMEM;
>> }
>>
>> @@ -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;
>> }
>>
>> @@ -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);
>> @@ -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);
>> }
>> diff --git a/drivers/most/most_cdev.c b/drivers/most/most_cdev.c
>> index 3722f9abd7b9..27913b1c8128 100644
>> --- a/drivers/most/most_cdev.c
>> +++ b/drivers/most/most_cdev.c
>> @@ -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);
>> }
>> @@ -424,7 +424,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;
>>
>> @@ -471,7 +471,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;
>> }
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] most: Directly use ida_alloc()/free()
2022-05-27 16:50 ` Christophe JAILLET
@ 2022-05-27 17:06 ` Marion & Christophe JAILLET
0 siblings, 0 replies; 4+ messages in thread
From: Marion & Christophe JAILLET @ 2022-05-27 17:06 UTC (permalink / raw)
To: Randy Dunlap, keliu, gregkh, christian.gromm, linux-kernel
Le 27/05/2022 à 18:50, Christophe JAILLET a écrit :
> Le 27/05/2022 à 17:37, Randy Dunlap a écrit :
>>
>>
>> On 5/27/22 01:33, keliu wrote:
>>> Use ida_alloc()/ida_free() instead of deprecated
>>> ida_simple_get()/ida_simple_remove() .
>>>
>>> Signed-off-by: keliu <liuke94@huawei.com>
>>
>> The Signed-off-by: needs a more complete name (unless that is your
>> full name).
>>
>> Do any of Christophe's comments apply here?
>
> Hi,
>
> This one looks fine. Thanks keliu.
>
> Should I nitpick, there is an extra <space> in the commit description
> before the final "." :)
>
>
> In fact, I'm sure of who can give a Reviewed-by: or Acked-by: tag. So up
Typo: read: ... I'm NOT sure ...
> to now, I only comment in-line when I go through patches randomly picked
> on the linext-kernel ML.
>
> I think it is mainly for maintainer, but if anyone can give them, I'll
> be glad to add them if it helps in the process.
>
> CJ
>
>
>>
>> thanks.
>>
>>> ---
>>> drivers/most/core.c | 10 +++++-----
>>> drivers/most/most_cdev.c | 6 +++---
>>> 2 files changed, 8 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/most/core.c b/drivers/most/core.c
>>> index e4412c7d25b0..81d60d4ee8c2 100644
>>> --- a/drivers/most/core.c
>>> +++ b/drivers/most/core.c
>>> @@ -1286,7 +1286,7 @@ 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;
>>> @@ -1294,7 +1294,7 @@ int most_register_interface(struct
>>> most_interface *iface)
>>> iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
>>> if (!iface->p) {
>>> - ida_simple_remove(&mdev_id, id);
>>> + ida_free(&mdev_id, id);
>>> return -ENOMEM;
>>> }
>>> @@ -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;
>>> }
>>> @@ -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);
>>> @@ -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);
>>> }
>>> diff --git a/drivers/most/most_cdev.c b/drivers/most/most_cdev.c
>>> index 3722f9abd7b9..27913b1c8128 100644
>>> --- a/drivers/most/most_cdev.c
>>> +++ b/drivers/most/most_cdev.c
>>> @@ -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);
>>> }
>>> @@ -424,7 +424,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;
>>> @@ -471,7 +471,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;
>>> }
>>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-27 17:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 8:33 [PATCH] most: Directly use ida_alloc()/free() keliu
2022-05-27 15:37 ` Randy Dunlap
2022-05-27 16:50 ` Christophe JAILLET
2022-05-27 17:06 ` Marion & Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).