Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp90674imm; Thu, 21 Jun 2018 14:30:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKsgml7BWz51O/lVCTi1PFYfpAqKp7iS0G34oVzbuuTchgjsX4NNZ/Z3uSWhgXf6TcoNYTE X-Received: by 2002:a65:4a10:: with SMTP id s16-v6mr24015512pgq.57.1529616628308; Thu, 21 Jun 2018 14:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529616628; cv=none; d=google.com; s=arc-20160816; b=NqqKMTJA6vsAMjjTOJUpWOfcxeByWUDZK5ShhOr/I+xPBARvnFJSdex1PQOS/Po3re 6pUMXj3Eac9wzaH+3Oi0q1hn8ASEGgN+OKRJtyh9TIKIO8Y4Q+5xWmmYwc+iOI/Skli7 9kA3sLdnA7KuflFmZUMAjOAQLMW+SVaXY8DWgs0kd7y5yRIFJ3ojOTT58fHAn139vpM/ img9gFAoLjcRO6f/VgO63Dj1Mv0FXnUqZ/V4BoE0yu+Ud4U1z1t3IM6FCQJ/DYgPupHc hFr6oj5PaK222Ac2AzS6Ao1SybT+hjhJ7vWcCXRN9EHCjzKpwVjFQgDGQS5vnH+aXKR/ UTzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=CCjWeuIcI4vHVyGY1m7zhPkItei4hVsL+lm4Vmi5J0E=; b=Wc3ej+lDcA40rBK1GzLYmn13NYccGb3w7poFclDJhU5+/p3lN5UiQz2X9uVDAGH57q ydkze6BI2g2NHhIjfhiArYa5q8NevF9SYctdEmo9hvL9HAP1dabOIs5zdJuol4G7RCAe 7aVoDbWKorOwB1c5kbG9QuWQ9GbAYHXDb/5YRUrgOivQpBRZs/RcHXfb3Po9lc7a+wrt XhCFhp7Iq3WU5wPgJZBGNKYKYPAmQ5uq4ItwHWeMsmRACAxzWo6mw9NoCUb3LvuSiP7e PRLW5K6y58R88Zy9SPZz6A4G9lnbCgjQOFPtg/BdM/wHv70+JZm8/u6cG8Q2OK3hwvQc 2GOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GPB8j8Tb; 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 w15-v6si5847217plq.455.2018.06.21.14.30.13; Thu, 21 Jun 2018 14:30:28 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GPB8j8Tb; 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 S934048AbeFUV3R (ORCPT + 99 others); Thu, 21 Jun 2018 17:29:17 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41774 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933946AbeFUV3J (ORCPT ); Thu, 21 Jun 2018 17:29:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CCjWeuIcI4vHVyGY1m7zhPkItei4hVsL+lm4Vmi5J0E=; b=GPB8j8TbUmA2IQatxPGpmoxV4 rX+Vj5JmZ/+whFDY1StsUmJnZbDSkWasgxreJ3tHE5evPcmAyOOr6RlAJjeeoQK3jkoy1r/60Nstr HJIS7nlOwWSAJaWD3sjZjpI4iSucWBf/UZoYtBpNycAhMM4+dKN+heqwD0M6/BGyQjEzwHPBD7klB iEPMbZ0kkhuTw0PCEQ7DOPq1gSS1FNUuZ+HAyFHXRq+HOHZNW++vG125rYjUBbgUzx1e86WfT5CZI 3Dtotl8HwNazs8yRdfau1iEoxnxjOGt3JNYOU/DLJmMpAYG5PN0xFbAe/sxLHecyJ/0Poi0Sbo0/N Buj2nuRxw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fW78f-0001bw-D8; Thu, 21 Jun 2018 21:29:09 +0000 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 14/26] media: Convert entity ID allocation to new IDA API Date: Thu, 21 Jun 2018 14:28:23 -0700 Message-Id: <20180621212835.5636-15-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180621212835.5636-1-willy@infradead.org> References: <20180621212835.5636-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Removes a call to ida_pre_get(). Signed-off-by: Matthew Wilcox --- 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