Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2639239imm; Sun, 24 Jun 2018 00:59:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJMU0F4p0oAVIWDjBTMDofmU0Nn6A6diY8mt0bYLMsSksQY2Fm85NRXV/21W5BAYuyYcY28 X-Received: by 2002:a62:a50e:: with SMTP id v14-v6mr4639528pfm.121.1529827162434; Sun, 24 Jun 2018 00:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529827162; cv=none; d=google.com; s=arc-20160816; b=J+DgP/n0p9VJrmkklAVFdN0Yt9/milTgTjHXgR/2OeXR/JYwjhkUQJlEEN9fyPb6Uu 8fxKe2fyEeYgTiR4eNF0Rc4RVJlW723cLO5buCL//vShi0MDkKOumnhDV4MPPXWfKFKW HrWmRAcBq5Uja3XYwrZSbl/dHCn/Ddk3M8Hr7pQ6yUq32D6RzNhE9rOebM5Fc0BEmxEP n6Z0LYGusfh/123ZXl0PrYQD/UoZaAWN530brBkcw6hITlYcBwShetzICFzBIorIHGWN kuZJ5048ZKwqwMgIhnRRto/52dfEYEtAqtv8i54ZxsjP2go9nChU0l3rDWm3wgdw1Whj NPPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=0W97AUaVxwsgzM7Q/16mLz5XVFVdmhECz3GtLNw9bbI=; b=0/2LElztFdrrgSn1rU77XCm3zjzwjx8A04EcEFhnzmRxnlhJJw/lDgYvoAduIY7Sdu lEKaOMHVI8hQssrIMrdjFOV1ivaG036Gg4JlYkLHAkxjUHnL8Yw+krOrzyqQUps2OUcY iKxir7FQ7jshU07/xhmVQtH8fCSwXZAElhxZq/gvRM5hl83muq94Bb/Pbq8Jz6jo6bdo PsHgUUvjb5y8tFqGfM6MBFTsIn19mFqoPCXM/e69Sy9ZhvjLgf4odfpACARCQKmNtNMP C1AEqJHH1BZVsuM0CS/NyljPFvDLU2VI/VpfJJgycLcbdOGxaaYSlwgh6QB03vRDsNhy iayQ== ARC-Authentication-Results: i=1; mx.google.com; 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 e195-v6si868488pfh.64.2018.06.24.00.58.54; Sun, 24 Jun 2018 00:59:22 -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; 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 S1751783AbeFXH5u (ORCPT + 99 others); Sun, 24 Jun 2018 03:57:50 -0400 Received: from www381.your-server.de ([78.46.137.84]:39496 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbeFXH5t (ORCPT ); Sun, 24 Jun 2018 03:57:49 -0400 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www381.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1fWzu7-0002z2-Kq; Sun, 24 Jun 2018 09:57:47 +0200 Received: from [188.174.114.87] (helo=[192.168.178.37]) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1fWzu7-0002b9-Bj; Sun, 24 Jun 2018 09:57:47 +0200 Subject: Re: [PATCH 16/26] dmaengine: Convert to new IDA API To: Matthew Wilcox , linux-kernel@vger.kernel.org Cc: Dan Williams , Vinod Koul , dmaengine@vger.kernel.org References: <20180621212835.5636-1-willy@infradead.org> <20180621212835.5636-17-willy@infradead.org> From: Lars-Peter Clausen Message-ID: Date: Sun, 24 Jun 2018 09:57:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180621212835.5636-17-willy@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (Could not determine AV Version) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/21/2018 11:28 PM, Matthew Wilcox wrote: > Simpler and shorter code. > > Signed-off-by: Matthew Wilcox > --- [...]> { > - 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; This used to return 0 on success, now it returns the ID. That wont work considering that it is used like this rc = get_dma_id(device); if (rc != 0) ... > } > > @@ -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; > } >