Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1913765imm; Sat, 23 Jun 2018 05:31:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLOwe/1hlOGn+Vhi04t453P0P2lKVapyPkjgyuoz9ym0omGFt6XhDF6WfTFjopdVjycn2rx X-Received: by 2002:a63:7553:: with SMTP id f19-v6mr4826701pgn.314.1529757110103; Sat, 23 Jun 2018 05:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529757110; cv=none; d=google.com; s=arc-20160816; b=ETv35Phw+XEVx1OfW5We12sJmuPjEbCiOfoQYoL3PI0s8WDzeGpSt6gEpvYd6cT6nl hFUEuvOAh/RVWc90/RhdKNVBouJdgxEJLBXVF+/+lsNJ8JcN6fAV1rhKGUyaYXkEOiuJ hcq7zBjpmgXP70kV4f+ehZ57hfjeKbEXNKSuVRfYBDj049n3J/fP441RlTxhFgjoXjcI rwsCSDNxEJwCrLUZHRJW9hbVt4cPyiwCNWKq2Ubs7qjZBxDTauoyL1TAKOkUxN+FLdW8 hMprQwoViiKmlSJQob80lQsqwjqw/uCQA7DPACCx6/Jm6kVSZC8zchYFYbenefhGTGwU gPLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=2dh1ZAaLkUwbbHaXzYZsdQrgKgjkh7KaZ0baxVhzCLc=; b=F483W3B2R8hio/FcgT1EZZ3LP/4JI8ArQpPAfHFMy3NplghC9aIQIBvahLS77xr7lO QmuS92DiTQKl0AmGrCQqSBDZSrFhrXNXEW2Yxfl7auXLRFBgVKup59QchK0xWufpswmj +SuBjY6Xfp+7BmE4kKUn0jvvQYcvTNyGX1Nbspdih59gB0bU4qmyesscH3yJY8Xk7L2n /mv66tAkXCCdGHeaXEWF/l+AzAGp6TkZ89HXZnP73DzvYa2gLQbVMZ+T+5UtBwUDLndJ +bkR3mInVL3toTNzSDf424fQycDb+JzYOBa8yCaNvoGHmOiI9g84u9tueEb0jVMJYbFb uCAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eJscNRgK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i16-v6si3156760pgn.252.2018.06.23.05.31.35; Sat, 23 Jun 2018 05:31:50 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b=eJscNRgK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752015AbeFWMau (ORCPT + 99 others); Sat, 23 Jun 2018 08:30:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:42092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbeFWMas (ORCPT ); Sat, 23 Jun 2018 08:30:48 -0400 Received: from localhost (unknown [122.178.210.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3F9B324BEA; Sat, 23 Jun 2018 12:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529757048; bh=9aqOlUUN+N1JLn+FRzdn1bu+EJCRCNPq4raGuCInXe4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eJscNRgKkbDElqdY95HJIaBGCNv9C2LnkQgcdeu8bKJEMAviWrauN7r+ss6yok5GV T2mreZ3YHHGrxZNcOZm8OqpcHwpD9ayFgGbD7xd0ttLOzgspcrIkJpAL6AjtHGrXDR 8MR1KNpwziLxVrG7Un95zK4Pgwc7vCOUtoBY0S6o= Date: Sat, 23 Jun 2018 18:00:39 +0530 From: Vinod To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, Dan Williams , dmaengine@vger.kernel.org Subject: Re: [PATCH 16/26] dmaengine: Convert to new IDA API Message-ID: <20180623123039.GX27187@vkoul-mobl> References: <20180621212835.5636-1-willy@infradead.org> <20180621212835.5636-17-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180621212835.5636-17-willy@infradead.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-06-18, 14:28, Matthew Wilcox wrote: > Simpler and shorter code. I couldn't find ida_alloc/ida_free in 4.18-rc1 so I assume this will go thru tree adding this so: Acked-by: Vinod Koul > > Signed-off-by: Matthew Wilcox > --- > drivers/dma/dmaengine.c | 20 +++++--------------- > 1 file changed, 5 insertions(+), 15 deletions(-) > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index 08ba8473a284..1e9bdadfc312 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -161,9 +161,7 @@ static void chan_dev_release(struct device *dev) > > chan_dev = container_of(dev, typeof(*chan_dev), device); > if (atomic_dec_and_test(chan_dev->idr_ref)) { > - mutex_lock(&dma_list_mutex); > - ida_remove(&dma_ida, chan_dev->dev_id); > - mutex_unlock(&dma_list_mutex); > + ida_free(&dma_ida, chan_dev->dev_id); > kfree(chan_dev->idr_ref); > } > kfree(chan_dev); > @@ -896,16 +894,10 @@ static bool device_has_all_tx_types(struct dma_device *device) > > static int get_dma_id(struct dma_device *device) > { > - int rc; > - > - do { > - if (!ida_pre_get(&dma_ida, GFP_KERNEL)) > - return -ENOMEM; > - mutex_lock(&dma_list_mutex); > - rc = ida_get_new(&dma_ida, &device->dev_id); > - mutex_unlock(&dma_list_mutex); > - } while (rc == -EAGAIN); > + int rc = ida_alloc(&dma_ida, GFP_KERNEL); > > + if (rc >= 0) > + device->dev_id = rc; > return rc; > } > > @@ -1090,9 +1082,7 @@ int dma_async_device_register(struct dma_device *device) > err_out: > /* if we never registered a channel just release the idr */ > if (atomic_read(idr_ref) == 0) { > - mutex_lock(&dma_list_mutex); > - ida_remove(&dma_ida, device->dev_id); > - mutex_unlock(&dma_list_mutex); > + ida_free(&dma_ida, device->dev_id); > kfree(idr_ref); > return rc; > } > -- > 2.17.1 -- ~Vinod