Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp80018iof; Sun, 5 Jun 2022 21:44:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmyufpp/3Ek8ocIF433xvGegsC7CQeGmh4p3dXl+7b+8iouz7L7r0o4n7nBrpMSCpYNdWn X-Received: by 2002:a05:6a00:c84:b0:518:e0f6:f1af with SMTP id a4-20020a056a000c8400b00518e0f6f1afmr22528911pfv.47.1654490659009; Sun, 05 Jun 2022 21:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654490659; cv=none; d=google.com; s=arc-20160816; b=Q59DVBeWZG8lKMyd//K+Dgalk+EQGL/dyF13dM7rRpv7YxwKQBBc+ZqxYQp2W68AH1 dt25iWOELJTkzz0BQNQIDww42kf2S7aErhAiTCru3GLpxZiZYyeNNQXYVjtXloR6YqIx RpTRIvjBZcHFK+71X/dGwFryQptBPM8L42bjNU0PllkI/24oMoIUKMMcyMMXHLaVYjAc LH3T4DRK82C8R6IEcP9gPl3ytR+sKm26G0oYatHnwaBtfqsKOIczEM4JCUH1Wrq1EgiO sLQRZCOV+tbeYbVJSc6/yN4Ni/Wplg0V3W5t394L4SC8fS8p6g8STdYMQw9FoEHcWABy jQWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=glJnLDzH2f8ekkI9sNh0tV6JIOuyNjsw6HqYXHTf3NQ=; b=fCv2HzKd1UtJmLHIKlNVDM76obSW01R6nUYFqgIT0kCiht7hkZS0OBf6E3J2hf6u9u p7rxl1UHhqXU4ii+xf4Q96mGhG24LCSHxFcHN6Enh9qXS86VRiClTM+Q/LtdHYVMVq8K cq0IPERwe4IFClUpFKHQNacXXzBLTdhuN5aFxGgV5nTVX9uliu/dMc1f2m80V8SPTtvV /8756UP6e1DKD3LPRNaSs3iItXGlGx7BteP3v6sePH9G4YSZDXCiAYE8wuPsQHO4qC7N hGDWBzFxZQcKQjLORf3bsRyAusg6XxIbOFNV+IzGF+arGNxE9xZ+sO9116sMY8PLbJMM eroQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTc2jjhD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t20-20020a170902d29400b00161a8960004si16249100plc.473.2022.06.05.21.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:44:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTc2jjhD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D020312AED; Sun, 5 Jun 2022 21:02:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245659AbiFCPrq (ORCPT + 99 others); Fri, 3 Jun 2022 11:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245657AbiFCPrp (ORCPT ); Fri, 3 Jun 2022 11:47:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F173286F8; Fri, 3 Jun 2022 08:47:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21199618CD; Fri, 3 Jun 2022 15:47:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C28C385A9; Fri, 3 Jun 2022 15:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654271263; bh=DkHpOszBjvs97DI/fvHycYbfHbNLMuU6YAPeq1EHMUc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DTc2jjhDIeM8HhagsgByJvmNNwsqDzXU0w3R7vhjfxhdayanpzV/2zgPYTOzqQ8/F ZlEI/LJOVaNtYoZ2O7IWcbycGRkps53fEjq0oB0VHioXeV40BlmrFqaYQTjZEeQMLy U6PREmURbMnDn/KE/mcJmZjYWVwZ2j+9aUOfKrrMUinnf95PlGiIPWzxzdd6wVm2h2 LrolcvuAhZOCJHK5jpPB4PCg06ei+QJDEf0cgw4zeFMo5SOyUDX/YVooRlfQ76UVys RZmM9T86v9Hdtk2e6HuCYsHUHZawi+rwPVnpw2FRCPiEdbzDwext4x18zHntWXcj2P Wam9Z0/pnbi+A== Date: Fri, 3 Jun 2022 16:56:45 +0100 From: Jonathan Cameron To: keliu Cc: , , Subject: Re: [PATCH] iio: Directly use ida_alloc()/free() Message-ID: <20220603165645.28ecc972@jic23-huawei> In-Reply-To: <20220527091739.2949426-1-liuke94@huawei.com> References: <20220527091739.2949426-1-liuke94@huawei.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 27 May 2022 09:17:39 +0000 keliu wrote: > Use ida_alloc()/ida_free() instead of deprecated > ida_simple_get()/ida_simple_remove() . > > Signed-off-by: keliu Looks good to me. Applied to the togreg branch of iio.git and pushed out initially as testing to let 0-day see if it can find any problems we missed. Thanks, Jonathan > --- > drivers/iio/industrialio-core.c | 6 +++--- > drivers/iio/industrialio-trigger.c | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > index e1ed44dec2ab..41daa10cd63d 100644 > --- a/drivers/iio/industrialio-core.c > +++ b/drivers/iio/industrialio-core.c > @@ -1618,7 +1618,7 @@ static void iio_dev_release(struct device *device) > > iio_device_detach_buffers(indio_dev); > > - ida_simple_remove(&iio_ida, iio_dev_opaque->id); > + ida_free(&iio_ida, iio_dev_opaque->id); > kfree(iio_dev_opaque); > } > > @@ -1660,7 +1660,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) > mutex_init(&iio_dev_opaque->info_exist_lock); > INIT_LIST_HEAD(&iio_dev_opaque->channel_attr_list); > > - iio_dev_opaque->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); > + iio_dev_opaque->id = ida_alloc(&iio_ida, GFP_KERNEL); > if (iio_dev_opaque->id < 0) { > /* cannot use a dev_err as the name isn't available */ > pr_err("failed to get device id\n"); > @@ -1669,7 +1669,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) > } > > if (dev_set_name(&indio_dev->dev, "iio:device%d", iio_dev_opaque->id)) { > - ida_simple_remove(&iio_ida, iio_dev_opaque->id); > + ida_free(&iio_ida, iio_dev_opaque->id); > kfree(iio_dev_opaque); > return NULL; > } > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c > index f504ed351b3e..6eb9b721676e 100644 > --- a/drivers/iio/industrialio-trigger.c > +++ b/drivers/iio/industrialio-trigger.c > @@ -71,7 +71,7 @@ int __iio_trigger_register(struct iio_trigger *trig_info, > > trig_info->owner = this_mod; > > - trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL); > + trig_info->id = ida_alloc(&iio_trigger_ida, GFP_KERNEL); > if (trig_info->id < 0) > return trig_info->id; > > @@ -98,7 +98,7 @@ int __iio_trigger_register(struct iio_trigger *trig_info, > mutex_unlock(&iio_trigger_list_lock); > device_del(&trig_info->dev); > error_unregister_id: > - ida_simple_remove(&iio_trigger_ida, trig_info->id); > + ida_free(&iio_trigger_ida, trig_info->id); > return ret; > } > EXPORT_SYMBOL(__iio_trigger_register); > @@ -109,7 +109,7 @@ void iio_trigger_unregister(struct iio_trigger *trig_info) > list_del(&trig_info->list); > mutex_unlock(&iio_trigger_list_lock); > > - ida_simple_remove(&iio_trigger_ida, trig_info->id); > + ida_free(&iio_trigger_ida, trig_info->id); > /* Possible issue in here */ > device_del(&trig_info->dev); > }