* [PATCH 14/26] media: Convert entity ID allocation to new IDA API
[not found] <20180621212835.5636-1-willy@infradead.org>
@ 2018-06-21 21:28 ` Matthew Wilcox
2018-07-24 11:05 ` Sakari Ailus
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2018-06-21 21:28 UTC (permalink / raw)
To: linux-kernel; +Cc: Matthew Wilcox, Mauro Carvalho Chehab, linux-media
Removes a call to ida_pre_get().
Signed-off-by: Matthew Wilcox <willy@infradead.org>
---
drivers/media/media-device.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index ae59c3177555..d51088bcd735 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -575,18 +575,12 @@ int __must_check media_device_register_entity(struct media_device *mdev,
entity->num_links = 0;
entity->num_backlinks = 0;
- if (!ida_pre_get(&mdev->entity_internal_idx, GFP_KERNEL))
- return -ENOMEM;
-
- mutex_lock(&mdev->graph_mutex);
-
- ret = ida_get_new_above(&mdev->entity_internal_idx, 1,
- &entity->internal_idx);
- if (ret < 0) {
- mutex_unlock(&mdev->graph_mutex);
+ ret = ida_alloc_min(&mdev->entity_internal_idx, 1, GFP_KERNEL);
+ if (ret < 0)
return ret;
- }
+ entity->internal_idx = ret;
+ mutex_lock(&mdev->graph_mutex);
mdev->entity_internal_idx_max =
max(mdev->entity_internal_idx_max, entity->internal_idx);
@@ -632,7 +626,7 @@ static void __media_device_unregister_entity(struct media_entity *entity)
struct media_interface *intf;
unsigned int i;
- ida_simple_remove(&mdev->entity_internal_idx, entity->internal_idx);
+ ida_free(&mdev->entity_internal_idx, entity->internal_idx);
/* Remove all interface links pointing to this entity */
list_for_each_entry(intf, &mdev->interfaces, graph_obj.list) {
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 14/26] media: Convert entity ID allocation to new IDA API
2018-06-21 21:28 ` [PATCH 14/26] media: Convert entity ID allocation to new IDA API Matthew Wilcox
@ 2018-07-24 11:05 ` Sakari Ailus
2018-07-30 14:55 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 4+ messages in thread
From: Sakari Ailus @ 2018-07-24 11:05 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-kernel, Mauro Carvalho Chehab, linux-media
On Thu, Jun 21, 2018 at 02:28:23PM -0700, Matthew Wilcox wrote:
> Removes a call to ida_pre_get().
>
> Signed-off-by: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> drivers/media/media-device.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index ae59c3177555..d51088bcd735 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -575,18 +575,12 @@ int __must_check media_device_register_entity(struct media_device *mdev,
> entity->num_links = 0;
> entity->num_backlinks = 0;
>
> - if (!ida_pre_get(&mdev->entity_internal_idx, GFP_KERNEL))
> - return -ENOMEM;
> -
> - mutex_lock(&mdev->graph_mutex);
> -
> - ret = ida_get_new_above(&mdev->entity_internal_idx, 1,
> - &entity->internal_idx);
> - if (ret < 0) {
> - mutex_unlock(&mdev->graph_mutex);
> + ret = ida_alloc_min(&mdev->entity_internal_idx, 1, GFP_KERNEL);
> + if (ret < 0)
> return ret;
> - }
> + entity->internal_idx = ret;
>
> + mutex_lock(&mdev->graph_mutex);
> mdev->entity_internal_idx_max =
> max(mdev->entity_internal_idx_max, entity->internal_idx);
>
> @@ -632,7 +626,7 @@ static void __media_device_unregister_entity(struct media_entity *entity)
> struct media_interface *intf;
> unsigned int i;
>
> - ida_simple_remove(&mdev->entity_internal_idx, entity->internal_idx);
> + ida_free(&mdev->entity_internal_idx, entity->internal_idx);
>
> /* Remove all interface links pointing to this entity */
> list_for_each_entry(intf, &mdev->interfaces, graph_obj.list) {
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 14/26] media: Convert entity ID allocation to new IDA API
2018-07-24 11:05 ` Sakari Ailus
@ 2018-07-30 14:55 ` Mauro Carvalho Chehab
2018-07-31 18:16 ` Matthew Wilcox
0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2018-07-30 14:55 UTC (permalink / raw)
To: Sakari Ailus
Cc: Matthew Wilcox, linux-kernel, Mauro Carvalho Chehab, linux-media
Em Tue, 24 Jul 2018 14:05:07 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> On Thu, Jun 21, 2018 at 02:28:23PM -0700, Matthew Wilcox wrote:
> > Removes a call to ida_pre_get().
> >
> > Signed-off-by: Matthew Wilcox <willy@infradead.org>
>
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
I'm assuming that the entire series will be applied together via some
other tree. So:
Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
> > ---
> > drivers/media/media-device.c | 16 +++++-----------
> > 1 file changed, 5 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> > index ae59c3177555..d51088bcd735 100644
> > --- a/drivers/media/media-device.c
> > +++ b/drivers/media/media-device.c
> > @@ -575,18 +575,12 @@ int __must_check media_device_register_entity(struct media_device *mdev,
> > entity->num_links = 0;
> > entity->num_backlinks = 0;
> >
> > - if (!ida_pre_get(&mdev->entity_internal_idx, GFP_KERNEL))
> > - return -ENOMEM;
> > -
> > - mutex_lock(&mdev->graph_mutex);
> > -
> > - ret = ida_get_new_above(&mdev->entity_internal_idx, 1,
> > - &entity->internal_idx);
> > - if (ret < 0) {
> > - mutex_unlock(&mdev->graph_mutex);
> > + ret = ida_alloc_min(&mdev->entity_internal_idx, 1, GFP_KERNEL);
> > + if (ret < 0)
> > return ret;
> > - }
> > + entity->internal_idx = ret;
> >
> > + mutex_lock(&mdev->graph_mutex);
> > mdev->entity_internal_idx_max =
> > max(mdev->entity_internal_idx_max, entity->internal_idx);
> >
> > @@ -632,7 +626,7 @@ static void __media_device_unregister_entity(struct media_entity *entity)
> > struct media_interface *intf;
> > unsigned int i;
> >
> > - ida_simple_remove(&mdev->entity_internal_idx, entity->internal_idx);
> > + ida_free(&mdev->entity_internal_idx, entity->internal_idx);
> >
> > /* Remove all interface links pointing to this entity */
> > list_for_each_entry(intf, &mdev->interfaces, graph_obj.list) {
>
Thanks,
Mauro
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 14/26] media: Convert entity ID allocation to new IDA API
2018-07-30 14:55 ` Mauro Carvalho Chehab
@ 2018-07-31 18:16 ` Matthew Wilcox
0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2018-07-31 18:16 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Sakari Ailus, linux-kernel, Mauro Carvalho Chehab, linux-media
On Mon, Jul 30, 2018 at 11:55:21AM -0300, Mauro Carvalho Chehab wrote:
> Em Tue, 24 Jul 2018 14:05:07 +0300
> Sakari Ailus <sakari.ailus@iki.fi> escreveu:
>
> > On Thu, Jun 21, 2018 at 02:28:23PM -0700, Matthew Wilcox wrote:
> > > Removes a call to ida_pre_get().
> > >
> > > Signed-off-by: Matthew Wilcox <willy@infradead.org>
> >
> > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
> I'm assuming that the entire series will be applied together via some
> other tree. So:
>
> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Yep, thanks. It's in linux-next and it's all going in via my 'ida'
branch.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-31 19:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20180621212835.5636-1-willy@infradead.org>
2018-06-21 21:28 ` [PATCH 14/26] media: Convert entity ID allocation to new IDA API Matthew Wilcox
2018-07-24 11:05 ` Sakari Ailus
2018-07-30 14:55 ` Mauro Carvalho Chehab
2018-07-31 18:16 ` Matthew Wilcox
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).