Received: by 10.223.164.202 with SMTP id h10csp660874wrb; Wed, 22 Nov 2017 13:14:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMaUnsxFTIs+QQkhG6RGCvdkFMlDGCTUUtsnRORNlUyRq5xdmOAtyXZobsY56OihIorvZNJE X-Received: by 10.84.235.137 with SMTP id p9mr21678361plk.291.1511385268719; Wed, 22 Nov 2017 13:14:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511385268; cv=none; d=google.com; s=arc-20160816; b=JDfR4iD6PPWWeLmucF1FPN/XhZWQEh03+xK6UQx1E8y2EGyERP3OVEqkCrBMlWQB76 MQMsON9tsScH8OlYG3a8oafewTjL/xQgXKoh2RJOolGoMNsLCJwDOnuT/4XblN76wbRe dXBpXNR2nUyJHcgkbLfcvcA8Ni0cR22Q87/N0hhoWRAOSGJQByJU9zPcGK0DHx6ZKAlC fa2n95eys74yyPZMAV6KCpptjqnqw/FgQHzpkbM5WPiKxG4gnK84QUY4P0ZKDrBzaaz7 PEhRdkSx8qosdPeOGxUt2Jt2RGS4SaKkrGdSFOjDlpoGIlZy2DGdCUNezQwg/bpm+YIm FJWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=zb75AIUv0AnHhZH24TmXkg+8McC6I4Stp52F2JNqsBE=; b=hSUs0YUSQDFltge8Ic5jh07M1uB3mNFDBGS05YT8pjbjS+PU69tr/BebgqMxm4VEKQ uVZNJcAPOEa41peEtmskJUZC/OKuTjMWDC97ZAKnAI1ZQsfedZSFAKDiTXvd+PR7Uh7z 29q19d5+gKwrD1wRFxnMhIDVgBRg6ybkfOTlAleQi3ItYlPix1xsLeVbenJGetMJm8IH Bti+MdpWUQDNOpTVEU73e3gA6FjVtEh03VMzo+5ByHqgfNlzvwAKTNsvxff6oFLgKO6r zmN5+thaRa6I7bN9sQHlxX1HiBAXKfAuKt/7r+Qi3M9jwHki+NIQ+jVAMOBJHr2qyLH1 8cEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qigUwWIq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34si14927487plf.648.2017.11.22.13.14.17; Wed, 22 Nov 2017 13:14:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qigUwWIq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752237AbdKVVLk (ORCPT + 77 others); Wed, 22 Nov 2017 16:11:40 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:43948 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbdKVVIU (ORCPT ); Wed, 22 Nov 2017 16:08:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zb75AIUv0AnHhZH24TmXkg+8McC6I4Stp52F2JNqsBE=; b=qigUwWIq5tSjEtn2lQpuWbGsd VuR4jS6q/Hicra5Q14csAWFvXDXzhL2wZhRZJoElbAAFGmerXUaJWGbDa00EQUdU3EekeQT8RPOKg 89GiXKoDgsbcV1N8kVBTx+FuQ+DE69uc0924EZj2EyaRVkMrMjGbAVum5GWzEJmHhmi2ErTPznTyV iyRDUY5vrx0OGQXXXl+ZrfsChIJocajUsM1WxPfUeFq1sz6G3pPtSRb093ReVN7Ma5vJ4EP1OWEXk YAQkzwuI/dYpjbBCLyDHPU+53bj0fqdTyiF3WbYMtP7PYsPwp/881MuU68EWyAGo9qBNXDqimpp6F Sisy78diw==; Received: from willy by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1eHcFn-0007y1-Ra; Wed, 22 Nov 2017 21:08:19 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox Subject: [PATCH 51/62] dca: Remove idr_preload calls Date: Wed, 22 Nov 2017 13:07:28 -0800 Message-Id: <20171122210739.29916-52-willy@infradead.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171122210739.29916-1-willy@infradead.org> References: <20171122210739.29916-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox The IDR now has its own locking, so remove the dca lock and calls to idr_preload. Also, there is no need to call idr_destroy on a freshly initialised IDR. Signed-off-by: Matthew Wilcox --- drivers/dca/dca-sysfs.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/dca/dca-sysfs.c b/drivers/dca/dca-sysfs.c index 126cf295b198..afa1d5c0f55e 100644 --- a/drivers/dca/dca-sysfs.c +++ b/drivers/dca/dca-sysfs.c @@ -31,7 +31,6 @@ static struct class *dca_class; static struct idr dca_idr; -static spinlock_t dca_idr_lock; int dca_sysfs_add_req(struct dca_provider *dca, struct device *dev, int slot) { @@ -55,23 +54,14 @@ int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev) struct device *cd; int ret; - idr_preload(GFP_KERNEL); - spin_lock(&dca_idr_lock); - - ret = idr_alloc(&dca_idr, dca, 0, 0, GFP_NOWAIT); - if (ret >= 0) - dca->id = ret; - - spin_unlock(&dca_idr_lock); - idr_preload_end(); + ret = idr_alloc(&dca_idr, dca, 0, 0, GFP_KERNEL); if (ret < 0) return ret; + dca->id = ret; cd = device_create(dca_class, dev, MKDEV(0, 0), NULL, "dca%d", dca->id); if (IS_ERR(cd)) { - spin_lock(&dca_idr_lock); idr_remove(&dca_idr, dca->id); - spin_unlock(&dca_idr_lock); return PTR_ERR(cd); } dca->cd = cd; @@ -82,21 +72,17 @@ void dca_sysfs_remove_provider(struct dca_provider *dca) { device_unregister(dca->cd); dca->cd = NULL; - spin_lock(&dca_idr_lock); idr_remove(&dca_idr, dca->id); - spin_unlock(&dca_idr_lock); } int __init dca_sysfs_init(void) { idr_init(&dca_idr); - spin_lock_init(&dca_idr_lock); dca_class = class_create(THIS_MODULE, "dca"); - if (IS_ERR(dca_class)) { - idr_destroy(&dca_idr); + if (IS_ERR(dca_class)) return PTR_ERR(dca_class); - } + return 0; } -- 2.15.0 From 1584750546902588678@xxx Wed Nov 22 07:31:34 +0000 2017 X-GM-THRID: 1584750546902588678 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread