Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4188090imm; Sat, 25 Aug 2018 10:59:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYGA+4cSbzFrYsGaeon9rZBc8HUk/9Ra7k76mX/iKfy3bzYivHEwkmYLBfsbyNDX/uPCmc/ X-Received: by 2002:a62:6283:: with SMTP id w125-v6mr7061795pfb.108.1535219982659; Sat, 25 Aug 2018 10:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535219982; cv=none; d=google.com; s=arc-20160816; b=lX2fKC4ZmmZudYUZ9/sDr5WdChYcErX/Ukbx5MhzSlCV41cKk3+neK7MLaIReQwlpk 3QbmWaOGgSsf8Be7GVrbDhpb9i4Hjy7S5hq9IQ7nZSkmxnIoZzalYMvUNM9BoEdIcu+e SycXQ+TiL3SIAuYBJZXvaYXl4wI83qlTkzbzgwCg1DwirP4VOvuvEC+ZSawNkcPOeYsl DJ++YLgM1RxnwbTRzECdwZzugW8M2sX6761QyfacwVlka8SBSxY8d7NNM7oNMFghShXr boDvOgEgbRuwcQR7nXLbKQ2J4Dtrqvqo+DZ7FGQ+Gen8q2k613mf8qT2eHPxCM9pSCv1 MFLw== 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:organization:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=CZnftNgWxmzwvVAVEzd8UaIx+2Uf9l4+kAQwLIKznFI=; b=T+m/MdpZ0m7Z8o5hTMYKFMe9RHW6Fp0BnClMLu7Uyig554wY8McZVMjJlnhoMAFWXB KhHaG9+kGvtx8Uw62KHfa1ofd82x4PKRZ3G4R6vgb4gFSq4EP03f486qJw2WJg8WckBZ DWs8A57laB/veF0JA43CYAOFoZnofuh/v+flyNqUAej2Rm88WQjCzBIlzN1ei2VY2zlJ 5YCEv30VfcLiemhKkJO1JaPVyswGunGz2cWg2f6pTlyl0U/BMNTTX8DYSpEn72hTyVZq D9XhqFCWiXrp2fCrkM9V/Xi5Q5W4NyZGShfdHc5qnPgkOQEil/tk5dIn4S6lSuN+4/Jl OCQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@compulab.co.il header.s=default header.b="Z+Az6oH/"; 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 x9-v6si5100149plr.160.2018.08.25.10.58.59; Sat, 25 Aug 2018 10:59:42 -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=temperror (no key for signature) header.i=@compulab.co.il header.s=default header.b="Z+Az6oH/"; 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 S1727056AbeHYVef (ORCPT + 99 others); Sat, 25 Aug 2018 17:34:35 -0400 Received: from softlayer.compulab.co.il ([50.23.254.55]:40488 "EHLO compulab.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726672AbeHYVef (ORCPT ); Sat, 25 Aug 2018 17:34:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=compulab.co.il; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To: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=CZnftNgWxmzwvVAVEzd8UaIx+2Uf9l4+kAQwLIKznFI=; b=Z+Az6oH/jlQTBn/TxlsTdqegLo NdrLcUKEMlIY1eCkE9vrdAkcaewUCYDt+3mtj5+LW4nSxV6bIwevbpo93JhqS++4C5nhAtLCyHm45 aTZLTKXrz/E7SYbRS8H0dC17L7ACFfafpBL76mU7+W02TLxoYaRPq1btgXEPpydnO0D9y9LvOM4/X n9lE3S34740xQXPyVaPaL6+9GEZ4+xslJGmvQjxT8nTJMeGKF5ISxbW8/ugeeuKwCuBbxHjpelJld kipT4nPSVYYNSt1gZh9I8RvTEXu1MVKS4OkJ4BTedsr2EU0Cnf93vQoBAFO0irSSLl4EJHzfgRd7Z 7WUnJ3Lw==; Received: from [37.142.126.90] (port=47232 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.87) (envelope-from ) id 1ftclz-0004pT-6F; Sat, 25 Aug 2018 20:54:55 +0300 Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id CB726481186; Sat, 25 Aug 2018 20:54:53 +0300 (IDT) Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id oZl8dHaTJMvb; Sat, 25 Aug 2018 20:54:53 +0300 (IDT) Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 8B187481187; Sat, 25 Aug 2018 20:54:53 +0300 (IDT) X-Virus-Scanned: amavisd-new at zimbra-mta.compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3u17ch25vSrc; Sat, 25 Aug 2018 20:54:53 +0300 (IDT) Received: from [192.168.11.10] (lifshitz-linux.compulab.local [192.168.11.10]) by zimbra-mta.compulab.co.il (Postfix) with ESMTPSA id 51659481186; Sat, 25 Aug 2018 20:54:53 +0300 (IDT) Subject: Re: [PATCH -next] spi: Fix double IDR allocation with DT aliases To: Mark Brown Cc: Geert Uytterhoeven , linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180821095303.27664-1-geert+renesas@glider.be> <35fbd3ae-3ac3-f6ef-874b-3d99c4d4d29a@compulab.co.il> <20180823102121.GC5207@sirena.org.uk> From: Kirill Kapranov Organization: CompuLab Ltd. Message-ID: Date: Sat, 25 Aug 2018 20:54:53 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180823102121.GC5207@sirena.org.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Get-Message-Sender-Via: softlayer.compulab.co.il: acl_c_recent_authed_mail_ips_text_entry: kirill.kapranov@compulab.co.il|compulab.co.il X-Authenticated-Sender: softlayer.compulab.co.il: kirill.kapranov@compulab.co.il Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > For DT systems the dynamically allocated IDs start at the maximum > positive ID and work down so in practice it is vanishingly unlikely that > there will be a collision as idiomatic static DT IDs would be low > integers. Yes, this algorithm seems really bullet-proof. However, it isn't actually used now. The ID allocation algorithm using atomic_dec_return call had been introduced 2006-01-08 as [1]. It was being used in the mainline kernel (with some improvements) up to 2017-08-16, when it has been replaced with the newer algorithm using Linux idr, accordingly [2]. Since idr_alloc call works incrementally, the situation of a 'fixed' ID squatting by a driver with 'dynamic ID' seems more than possible. Therefore it would be justified to use a hardcoded constant SPI_DYN_FIRST_BUS_NUM (that was introduced in [2] and eliminated in [3]), but with a sufficiently greater value of the constant. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.18&id=8ae12a0d85987dc138f8c944cb78a92bf466cea0 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.18&id=9b61e302210eba55768962f2f11e96bb508c2408 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.18&id=42bdd7061a6e24d7b21d3d21973615fecef544ef