Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp120247iob; Tue, 17 May 2022 20:53:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP62d2EhSGILgVwilMEU2f4n5H7La0QI8gpRuZ+CZTNgPrYjZpOLDGNMwNXSgLWpg/nyB0 X-Received: by 2002:a17:902:f809:b0:161:44a5:3349 with SMTP id ix9-20020a170902f80900b0016144a53349mr20005919plb.140.1652846033338; Tue, 17 May 2022 20:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652846033; cv=none; d=google.com; s=arc-20160816; b=EJWti+t3n1LxEmGo0qyHlrUIKshwgzuqB7ly4jJIMEPFjpdtQ9aJ/ovEJMQkYU/ex4 kT2hMeo4DN5nsIetYq/sWVurGoC26O3M+jHzaDJn4jlA0sfW3aPS5VKo9/s+aa2EpeUv 0bYr/SZpYy3uuyPfpJG27zAz1Sl6FHpfbk0L6d79sTFaxl7kbpElE0lEdJpUOC/44d6e E5j7AmEZLyiNLFNDhPjJCLM1H68oEUBRKTpztaz9Lwyu2pJlyRzcauDFfViAm+VRKOvi mF+g9/kRZMG1DF8QqVf9y8xda3oEsMQ9yYs5Ijd1WUMWD8oJj4ePCe0YY1Y9rUhI5k9i ot0g== 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:sender:dkim-signature; bh=NpzpNLoEmkRn/F6uE5+1oVZ1luFPE9xSZEAZD03pdY0=; b=B1gfy6J7kQZl0hLf50tlKRzjRs85DGOKYBQBRoLHK2WAsPEDuC2R3AFTFc/QRsu/4w qmwXoRNZIloUb/suJ6r64Z5npf4LQ7EhQxxqzwN7MVSyRJalyNVVUI69xCC2pIviqQus nE/tT6ytgbe7oKjx05OCAsfdH7aMx9zAw+zu71u2GsHrYAMsGfddFw48QxxaWjHuPpMp UeILYkt+GUWjaHP53CTc11BfLWDUirarAESurA1QEMHEU/ghM6e+DmWdCcqwBWFaiD74 Iv6kzyVdzHueYuUihjWBch84UTkW/2ESPPspmZlGGJqtVAZiOMBudJoaWcNb6W80CyWW LiLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FkMdQ424; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t10-20020a17090aae0a00b001cb4d9e17c6si1238439pjq.84.2022.05.17.20.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 20:53:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FkMdQ424; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5CF7195A1B; Tue, 17 May 2022 20:34:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345817AbiEQMsW (ORCPT + 99 others); Tue, 17 May 2022 08:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346368AbiEQMsN (ORCPT ); Tue, 17 May 2022 08:48:13 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BECD3FBE3; Tue, 17 May 2022 05:48:10 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id i25-20020a9d6259000000b00605df9afea7so12091884otk.1; Tue, 17 May 2022 05:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=NpzpNLoEmkRn/F6uE5+1oVZ1luFPE9xSZEAZD03pdY0=; b=FkMdQ424AFm5M4F/la9481PW4y7bKE4/auUO4eSkzUdj6YeDa8M2rjq1p7Wz54zNqr uG5FWhf2fZYePV8/u9/SktVm6eF9boZfRLzRJ2BwEbG4En9gXIyRyZ9q3S9gBnNtER2T nFHzne0bdnmApZ3G2LK41oGO2twG8y4iggio2J4i7SGwErgbAf0gujw0N8lhqsmGPatY pD4cyk/NA1pgU42CfDrTIMwt+sy2Iuyv18XldQm5QVQc1bt5bKrRhDKauzqg+WCzAcvO TAssoj5mHf3QOTg0VL2mlCCSWSN2Ohi8I64K8VOYbr/lu8QL1yczqBdVEUSCeH+aNJI+ Ghew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=NpzpNLoEmkRn/F6uE5+1oVZ1luFPE9xSZEAZD03pdY0=; b=7mtA49q5zkhom3fgWffwOz4KiaQI+/jBol2cLCTuFClD7OMzUD+KuA7GMEfz9WglSJ V3g1yDMfjQwPZ08W6Vdar+cy6s4asG/O45cszmHPAlAV+ynUjW5Gf4T0KywbgIpZXYrc IuSltj7uaj4R+SkY/Tjvsa2rM3rfm1O/6rNR/GtjIV00t6WLn5QuLwlS7k97HpRGmk6o sYSw7GE/WrirU56iIwGmuRMbKg1KUwbu7YL9ORSMxtAX93Hw3CQ9i8dwNpEZDPjoRTfD QbSOnXExm8zW4pjarcwCFcEuohIJSw9MBZmj28cbMlbaIgyNRO1orqoTQzeuJHhwKWME 0U5A== X-Gm-Message-State: AOAM530updsHCbjKzCUHYnMAX5nFeMWHsekVuq51PM674BmjJTSnkYOc kAhpWzpLd4/g0VK+O6+pOK4= X-Received: by 2002:a05:6830:25cc:b0:5c9:5fc5:32b1 with SMTP id d12-20020a05683025cc00b005c95fc532b1mr7925519otu.138.1652791689934; Tue, 17 May 2022 05:48:09 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id f22-20020a9d5e96000000b00606765d8db2sm4790749otl.77.2022.05.17.05.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 05:48:09 -0700 (PDT) Sender: Guenter Roeck Date: Tue, 17 May 2022 05:48:08 -0700 From: Guenter Roeck To: keliu Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] hwmon: Directly use ida_alloc()/free() Message-ID: <20220517124808.GA3438318@roeck-us.net> References: <20220517063126.2142637-1-liuke94@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220517063126.2142637-1-liuke94@huawei.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, May 17, 2022 at 06:31:25AM +0000, keliu wrote: > Use ida_alloc()/ida_free() instead of deprecated > ida_simple_get()/ida_simple_remove() . > > Signed-off-by: keliu Applied. Thanks, Guenter > --- > drivers/hwmon/hwmon.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c > index 22de7a9e7ba7..2e2cd79d89eb 100644 > --- a/drivers/hwmon/hwmon.c > +++ b/drivers/hwmon/hwmon.c > @@ -764,7 +764,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, > "hwmon: '%s' is not a valid name attribute, please fix\n", > name); > > - id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL); > + id = ida_alloc(&hwmon_ida, GFP_KERNEL); > if (id < 0) > return ERR_PTR(id); > > @@ -856,7 +856,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, > free_hwmon: > hwmon_dev_release(hdev); > ida_remove: > - ida_simple_remove(&hwmon_ida, id); > + ida_free(&hwmon_ida, id); > return ERR_PTR(err); > } > > @@ -968,7 +968,7 @@ void hwmon_device_unregister(struct device *dev) > > if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) { > device_unregister(dev); > - ida_simple_remove(&hwmon_ida, id); > + ida_free(&hwmon_ida, id); > } else > dev_dbg(dev->parent, > "hwmon_device_unregister() failed: bad class ID!\n");