Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5318172rdb; Wed, 13 Dec 2023 05:36:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtH1DV9mfIiBvqdICo/jCLz3XTN8nMm3sa8NY4vCHrMknZZu1W4YvXRQEO0qDZSIYv8euP X-Received: by 2002:a05:6a00:10d1:b0:6ce:48e7:e668 with SMTP id d17-20020a056a0010d100b006ce48e7e668mr5215115pfu.26.1702474604094; Wed, 13 Dec 2023 05:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702474604; cv=none; d=google.com; s=arc-20160816; b=VJ9PF3+eaa/G5ooJD8gGacZkDdYg51M2mcDg1uEIeVW8f02ChxUU+WywxA2FFPcjgv 3SeFKvzkTFzQqpgfyB7IlkzzC5gzrwqxuRboDCaKjxlNcGVjysOej2MVY1LwDFCnow2P s00jQ+Rtb0cLUPXBr0WDaJW+FNrYp1bApC3iZ+TwhclrKIR9CP0nPtswiXVy2bNwztOq 4GIaGYChhyse69BckXpBSRl9fxu3vZYWJzrz45CfiymraPuZIJOvYjYZ+HZNKAuGncyV FPynI6e1Cbk1S41+etcxEi4hYDIASOue6sdoHRE9wzLzy/OmFYU2DD5J/uQ1qrvGZXxg 3l6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LUNZM3Z8u/540zLJfhO7Jej37hRWqFxD4AT6uh2+ms4=; fh=x/JIgSNwqB89cP9kjM4dcdKodA+pwq62OXT0yY06kfI=; b=LNAbZAK7oPIA19NyQ/GNo0RzY4sm6FEN1WkQvSC97/v7wbGniAu6m2PMborBAJpCc6 rUhDSDYTU065j3lR9tNo456CpiWcKwlH/e+NQONYFAk4dg1/fRSaSNIvw9aRIdMTThsJ dW25l+X4vt56fT6/150typhL46AcqZWYWQ2xlothvc/MH+KmLScRAlJWmEmXhravCSMm y89E+m9wzU/Z/JCvKGz8JAEhwPVCZyLZToFQOZplsadL1h2d0Ak+bVUcLJHeoZmYB4Oi r/PQ1LDIN/IzLqGZJ1rQFthrNmhPTGD/0qBaqYoSQGlI2DMaa1UBO7QuIcrlkY5KuKMJ IlSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XdTk2gEk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k24-20020a63ba18000000b005c6eb4bc772si7963019pgf.844.2023.12.13.05.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:36:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XdTk2gEk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 23CE98221794; Wed, 13 Dec 2023 05:36:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379264AbjLMNgJ (ORCPT + 99 others); Wed, 13 Dec 2023 08:36:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379267AbjLMNgG (ORCPT ); Wed, 13 Dec 2023 08:36:06 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7CA5DC; Wed, 13 Dec 2023 05:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702474570; x=1734010570; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=NEtuRYz798pOKaCZjGgcl/J6ODZ0hj92ozwgXCg6Ui0=; b=XdTk2gEk9pM5AuOBhy/TaqmUbuUVM1J/QiwqV/b3E3dNK+1DvbvykoHD ie+cnsiYARFD0/Re77n3pl5XqxNsk6PjH5gbjYE0nFFQ0ZHObJF3GFa5G YiBEgDUOxt7n4NZ425PLnZ9NTVgz8arXIiTBQTBbsBSML/J/JIJII9GTN tHRyhGo0I2kaaolzWAwRVmMwKNZpRLBzy2ZrlXK6c2JpIYSpMvoUv19ws 98lblFJDIfDudk8JJeeNcZYr+nXAFqSYvILWXvyCY8iJb/d8HRLh4Ac99 hzU5ulMYjB9YGtBGx8mhlHNSUTnza16kWgIO8gsncql7REoNyQX/JXXN1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="8354476" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="8354476" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 05:36:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="750108795" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="750108795" Received: from kuha.fi.intel.com ([10.237.72.185]) by orsmga006.jf.intel.com with SMTP; 13 Dec 2023 05:36:06 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 13 Dec 2023 15:36:05 +0200 Date: Wed, 13 Dec 2023 15:36:05 +0200 From: Heikki Krogerus To: Christophe JAILLET Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: typec: Remove usage of the deprecated ida_simple_xx() API Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:36:39 -0800 (PST) On Sun, Dec 10, 2023 at 06:36:15PM +0100, Christophe JAILLET wrote: > ida_alloc() and ida_free() should be preferred to the deprecated > ida_simple_get() and ida_simple_remove(). > > This is less verbose. > > Signed-off-by: Christophe JAILLET Acked-by: Heikki Krogerus > --- > drivers/usb/typec/class.c | 8 ++++---- > drivers/usb/typec/pd.c | 4 ++-- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c > index 16a670828dde..5fe01bf795b9 100644 > --- a/drivers/usb/typec/class.c > +++ b/drivers/usb/typec/class.c > @@ -476,7 +476,7 @@ static int altmode_id_get(struct device *dev) > else > ids = &to_typec_port(dev)->mode_ids; > > - return ida_simple_get(ids, 0, 0, GFP_KERNEL); > + return ida_alloc(ids, GFP_KERNEL); > } > > static void altmode_id_remove(struct device *dev, int id) > @@ -490,7 +490,7 @@ static void altmode_id_remove(struct device *dev, int id) > else > ids = &to_typec_port(dev)->mode_ids; > > - ida_simple_remove(ids, id); > + ida_free(ids, id); > } > > static void typec_altmode_release(struct device *dev) > @@ -1798,7 +1798,7 @@ static void typec_release(struct device *dev) > { > struct typec_port *port = to_typec_port(dev); > > - ida_simple_remove(&typec_index_ida, port->id); > + ida_free(&typec_index_ida, port->id); > ida_destroy(&port->mode_ids); > typec_switch_put(port->sw); > typec_mux_put(port->mux); > @@ -2297,7 +2297,7 @@ struct typec_port *typec_register_port(struct device *parent, > if (!port) > return ERR_PTR(-ENOMEM); > > - id = ida_simple_get(&typec_index_ida, 0, 0, GFP_KERNEL); > + id = ida_alloc(&typec_index_ida, GFP_KERNEL); > if (id < 0) { > kfree(port); > return ERR_PTR(id); > diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c > index 85d015cdbe1f..7f3d61f220f2 100644 > --- a/drivers/usb/typec/pd.c > +++ b/drivers/usb/typec/pd.c > @@ -571,7 +571,7 @@ static void pd_release(struct device *dev) > { > struct usb_power_delivery *pd = to_usb_power_delivery(dev); > > - ida_simple_remove(&pd_ida, pd->id); > + ida_free(&pd_ida, pd->id); > kfree(pd); > } > > @@ -616,7 +616,7 @@ usb_power_delivery_register(struct device *parent, struct usb_power_delivery_des > if (!pd) > return ERR_PTR(-ENOMEM); > > - ret = ida_simple_get(&pd_ida, 0, 0, GFP_KERNEL); > + ret = ida_alloc(&pd_ida, GFP_KERNEL); > if (ret < 0) { > kfree(pd); > return ERR_PTR(ret); > -- > 2.34.1 -- heikki