Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3539420rdb; Sun, 10 Dec 2023 09:36:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNie9m9MpVVlDk/ZHRK5erhuuVFT7HC55Px5PJ9vX79gg6gHspUl4E8fZQ+ie/isu3+oV9 X-Received: by 2002:a05:6a00:a1f:b0:6ce:5fcb:5fa4 with SMTP id p31-20020a056a000a1f00b006ce5fcb5fa4mr4264632pfh.19.1702229792717; Sun, 10 Dec 2023 09:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702229792; cv=none; d=google.com; s=arc-20160816; b=I+St+2OGlwTTFO76E9Uq25Qc2NMVHvcu016uE2HefV5rSPCO6+CENecIslCmp2rPDR ytLcIsgYHeLRtiriqOOcVkxoo/G2b6aR61CLyRwOuNXFbEdIIvZ5/dw7grMhIxdaCEdV 5Ei0pTtlGo6KABXp/ICqdrFb8R/+/+s92wKbT5bIArIu6toMJyfgTkWP2EucYZ3WIW4/ E8ILZyjho/bwcb9063QgG26kTkZts/Ifc/lyf/IDq0PyfCmGhE1l/yDAptQK+tMqAldN OuYsBD7uqqChZfUaag5WbRIcGKK45CCZ4LKRRhjBGyDEK4diX3aKO1U1yClVgdcREDF4 QBoQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=3nUYliN94T1NkME5cPRgstUEirYwToMnADC29sMEwME=; fh=r4GCg8BXajaiHcVKLVIGAG3xdm8Yd9jMcTzRVUzW5nQ=; b=0bnnJMnCjDLVBRjapAi3TMc8Hx6CBky7V2dVKPSAipTWK/laPRp36MTBWufOa0mClr oZZKQwRRTPIzQHaUL+6yyntfHBy4soRQ2T6nse95M6wakPCtEzkpEcvpKi4P7LJDXEAW Ynnw2CB+drVq5DC5sSmRUJUfo7utuPT7r+QeOrBBE8ytBaC/TewdEwfR4zSN/5AhTJwk nscR16O0f7kSrxC5n4aPISBicgmaLcdRvkcFGJ5wbQcxFII/ELCvnIwzA8fsZFmKLHK3 C4c1KCv81wueoZetiBJvrWuaNFeISWmPlhBFrnXH3g0I13MvsRVMNIrjhgJo3+Mf7SzK wDsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=AxSz70YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id b5-20020a63eb45000000b005bd85b32495si4981384pgk.685.2023.12.10.09.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 09:36:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=AxSz70YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id F2B4E8077FB6; Sun, 10 Dec 2023 09:36:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231861AbjLJRgQ (ORCPT + 99 others); Sun, 10 Dec 2023 12:36:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjLJRgP (ORCPT ); Sun, 10 Dec 2023 12:36:15 -0500 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0D77FA for ; Sun, 10 Dec 2023 09:36:21 -0800 (PST) Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id CNj0rzutIa8POCNj0rYn7g; Sun, 10 Dec 2023 18:36:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702229780; bh=3nUYliN94T1NkME5cPRgstUEirYwToMnADC29sMEwME=; h=From:To:Cc:Subject:Date; b=AxSz70YDDsU/5CeRF8hPLoSXwXW4uIk3DrZLefDz3WzhukcKpENMG14i5fQe29Kqw 6W7/JuIKrOtz/Oig+Sp9t0NyVhktqS23nTnwh7abJEXPC7N9p+wUBCL4apv4UujF6R 0cX+OY778i8Zfzpas/KBixzppkGtt9IpybUBSW61xqaKm54BXy7cUHTpSpM6hyMMfT ATMHF7Uy7iPGg83ZLBG2UiR9A8Sg5PK4gEHVUf9CTOnQEDwoyKmXrJjroR1tL/6w4M ju7EQbA2AZQ0JeasrQsTjeMYLK3R87BDVry9c8FZ/Y5uguXvuq6uNvnW4Hg7BY9ODd eS27BWJPt7DDQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 10 Dec 2023 18:36:20 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-usb@vger.kernel.org Subject: [PATCH] usb: typec: Remove usage of the deprecated ida_simple_xx() API Date: Sun, 10 Dec 2023 18:36:15 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Sun, 10 Dec 2023 09:36:30 -0800 (PST) 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 --- 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