Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933912AbcLHB3v (ORCPT ); Wed, 7 Dec 2016 20:29:51 -0500 Received: from mail-wj0-f180.google.com ([209.85.210.180]:33874 "EHLO mail-wj0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932372AbcLHB3s (ORCPT ); Wed, 7 Dec 2016 20:29:48 -0500 From: Rasmus Villemoes To: Tejun Heo , Andrew Morton Cc: linux-kernel@vger.kernel.org, Lai Jiangshan , Jens Axboe , Greg Kroah-Hartman , Rasmus Villemoes Subject: [RFC 07/10] drivers/base/platform.c: use simpler id allocator Date: Thu, 8 Dec 2016 02:23:02 +0100 Message-Id: <1481160187-9652-8-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1481160187-9652-1-git-send-email-linux@rasmusvillemoes.dk> References: <1481160187-9652-1-git-send-email-linux@rasmusvillemoes.dk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1761 Lines: 58 Use the newly introduced tida allocator, which saves about 16 KB of memory. Signed-off-by: Rasmus Villemoes --- drivers/base/platform.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index c4af00385502..3177222b28dc 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ #include "power/power.h" /* For automatically allocated device IDs */ -static DEFINE_IDA(platform_devid_ida); +static DEFINE_TIDA(platform_devid_ida); struct device platform_bus = { .init_name = "platform", @@ -372,7 +372,7 @@ int platform_device_add(struct platform_device *pdev) * that we remember it must be freed, and we append a suffix * to avoid namespace collision with explicit IDs. */ - ret = ida_simple_get(&platform_devid_ida, 0, 0, GFP_KERNEL); + ret = tida_get(&platform_devid_ida, GFP_KERNEL); if (ret < 0) goto err_out; pdev->id = ret; @@ -411,7 +411,7 @@ int platform_device_add(struct platform_device *pdev) failed: if (pdev->id_auto) { - ida_simple_remove(&platform_devid_ida, pdev->id); + tida_put(&platform_devid_ida, pdev->id); pdev->id = PLATFORM_DEVID_AUTO; } @@ -443,7 +443,7 @@ void platform_device_del(struct platform_device *pdev) device_del(&pdev->dev); if (pdev->id_auto) { - ida_simple_remove(&platform_devid_ida, pdev->id); + tida_put(&platform_devid_ida, pdev->id); pdev->id = PLATFORM_DEVID_AUTO; } -- 2.1.4