Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6838688imm; Tue, 24 Jul 2018 04:07:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpex5/PZomnfGI9iccJB1JqSU8ajLVX54zzoZTT0PuRTJLqRLOL1GZ4X6QQJponJEb2QhJIs X-Received: by 2002:a62:1314:: with SMTP id b20-v6mr17413232pfj.230.1532430459758; Tue, 24 Jul 2018 04:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532430459; cv=none; d=google.com; s=arc-20160816; b=eRiJ1xurYGmNsOAIULiS3t0nOFMX14e+mul/b+nHED6bKSIC61Jk/SWnDKZ0kKbSlL 9vjYq1JkY7rBSkxHma8Nq+sfwsctuykeKGNnBGs7jp2L1wD0TNtOAGudXLBjTTV1rhe+ LW97FSWPnMz3FIumNTUh0OiyamoxsoB/2OSH8Dn8vgz5AFTcHSLUcMTAWnNzlMZtaSxS n/Pp9hEtl0pkmV/3zK2wDydFMJqjMkVilY8rUzVYoGpiJ8QktGsorMsIsm7YISTaGfdd X0qx2axMDu7Y54nT/MPFnfqfrAuZf9LMcqlSpMJcZ/xa+gZAFqGaQKVc1mQT7D6mxMvL kmyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=jC8Dy5WGimtBrRx48CMB4dHoeBdXvaMl/i51FqU/K4w=; b=gFXkDObQ0wJ1LBGaZf55CXu6o0VHPglaVHAjpEMiYJMKZLVVguRU6uwdshPCOkAWPN j4XzhM1KgsooKWQNHCbgPE8RSaS+amiUTUEt8KRADTCsHncv1ZuumcdfApOA8aNCR1Uz AvWrAUCPVTfPIuTvbatbj27B1JHQYJjKq/mLnDcObj50cNyir0FC1sM+I1hXgNFTA99x 8knvrwCLCoNCMkC6Fcw9359Ln9u7Dmyr0YxzWu8rfdliRK6gtUxDGyaQFOKF5MUc7RYW Zki2FGM3Kd6TpXBsLtwx+RQeiyaY7dpqf6pG/8dWKEl8fL1MU4fBevApPO1sxU2JIXbM Tg+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w27-v6si11475306pgc.232.2018.07.24.04.07.25; Tue, 24 Jul 2018 04:07:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388522AbeGXMLE (ORCPT + 99 others); Tue, 24 Jul 2018 08:11:04 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:37330 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388307AbeGXMLD (ORCPT ); Tue, 24 Jul 2018 08:11:03 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2001:1bc8:1a6:d3d5::80:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 3826C634C7F; Tue, 24 Jul 2018 14:05:08 +0300 (EEST) Received: from sakke by valkosipuli.localdomain with local (Exim 4.89) (envelope-from ) id 1fhv7s-0008O2-0P; Tue, 24 Jul 2018 14:05:08 +0300 Date: Tue, 24 Jul 2018 14:05:07 +0300 From: Sakari Ailus To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: Re: [PATCH 14/26] media: Convert entity ID allocation to new IDA API Message-ID: <20180724110507.idyjc3vbbivwbxtb@valkosipuli.retiisi.org.uk> References: <20180621212835.5636-1-willy@infradead.org> <20180621212835.5636-15-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180621212835.5636-15-willy@infradead.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Sakari Ailus > --- > 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