Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1266097imm; Wed, 6 Jun 2018 13:08:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKKSChyNvaZ99z1HfwZ+xA6cN12Vzn3NyBmaaiGK5CubkB4rlu3a9/yv9HDuVuHyfnuQCON X-Received: by 2002:a63:6807:: with SMTP id d7-v6mr3592396pgc.7.1528315682564; Wed, 06 Jun 2018 13:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528315682; cv=none; d=google.com; s=arc-20160816; b=dhDpYiMDs3RK+rikn9wnLZ1dk1VGSQ/5l0nLdjddafSI/6MXQNp82FvTLFerq7zDmm c//J1R2CJUy6/kU+IuD4i1WOZy4I9wOyWPde770i/ehDeKF/d7ViYGHSAdRBCliESdMf aWSNJ17+sgiWqGzZzlZot9mS85eCgdtnJO/SL9ZjxljI/x16Z6s/0VXB+sP6UD6jQDZf pJi0i83kHqCfkZO31h9kY7bQWbyaSQUBTPjMAnQ6MywddRjYQZfT2E2FxBgLc7Zqovb8 HaFTS6fE2T0JUhcnc52PXrvSq5odjcJ2lu6fJ0i9vDEH6UgNX87Zkf/cThCl0dSgFKc5 jySg== 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:date:message-id:autocrypt :openpgp:references:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=8zzFcQrhNAkpWjbADr9oKqXdp5AKxf9I3SmSoH5Q2ik=; b=Xxs6LRxuPWdHJigQ0EL9wxHJEUkvB1Cv1aFXl4w++uT3/nyloErYJH68gAC3Ck3oaW uLWBxuFz1hJA5QiN7VqAoPRguhrliZABwZSGLQAre06wPWw3a8hOXsCBbImTMufnxMTr 4h2YvTgW3Jf5kpmkbF1JsD7ZqOUhMcFdWlOCsy3MtJUDaqt0eY8JhEHEw8w+XERBzqD6 H4ENeXArHBX06f3H73BVQKFz6WbhVFMoU55njJlyacg/mKH6zG7R12D0lAky22RozSGn jy6UpJ4Le5AGvC5GRlVItPT2l3rOwhIUDf7C5LHQa1lEusnttElZ/dXePSoJoGzsuZFK LrgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CU5epQLG; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si23649289pgq.65.2018.06.06.13.07.47; Wed, 06 Jun 2018 13:08:02 -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=@linaro.org header.s=google header.b=CU5epQLG; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754164AbeFFSJd (ORCPT + 99 others); Wed, 6 Jun 2018 14:09:33 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44983 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752404AbeFFSJ3 (ORCPT ); Wed, 6 Jun 2018 14:09:29 -0400 Received: by mail-wr0-f196.google.com with SMTP id y15-v6so7233556wrg.11 for ; Wed, 06 Jun 2018 11:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:from:to:cc:references:openpgp:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8zzFcQrhNAkpWjbADr9oKqXdp5AKxf9I3SmSoH5Q2ik=; b=CU5epQLGXsS9zJdf6vOAGv86SX7JbWXhj28NdQ21QaIe9WrwFp/PRFV8VZmT4+CK1u oRFLbj5Xa46XRe+TZAsDtBDDeTp1HGEpuE7J1SCyGR90znlHEKZ0ng6gtmMsJfCmWJ14 v+W7XWIzToha4KA0IkWe56CGpOkq1ETOiJw8g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:openpgp:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8zzFcQrhNAkpWjbADr9oKqXdp5AKxf9I3SmSoH5Q2ik=; b=OExvxS1W2V69SaRtEg0UveJliEOA1NH2PzO0vl4Q9s8lhAr4CB+orCMzuGSeXBTEPj 5GX64Ie4Qf74jhbS6mVOL2jkxOzK8VhFPevA+y8Q0N39XFEaS5HADaZe8f2iPLXWQS1I /023hn6OgCiMaR3oLBcwa5xMLa9tbj64fbfzcRDIM2y+wvrzZ6qToLKNGFBOfUhvG5lp vn6MgNvsTSWutdDgGqYaG4r98RMqJpzI/2xhqHxsuwrTYxn7iXsKR/kvkKKH4y5B6d4d Ji9zcNyhSR7wkWnMugDSAeXXx2bRo15lPv3tpaNnwdYid8+YEOdd8JE1sKt0sfTy88Ka Yobw== X-Gm-Message-State: APt69E1y0MpX0h4/f4HLDt1w+Hf1B2IjN/qZv8p1DYLNj5xh7hb+PECk QK2arad5Co23vsmeDyCjHamkQg== X-Received: by 2002:adf:9cca:: with SMTP id h10-v6mr3075263wre.11.1528308567739; Wed, 06 Jun 2018 11:09:27 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id c131-v6sm4782965wma.41.2018.06.06.11.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 11:09:26 -0700 (PDT) Subject: Re: [PATCH v4 1/7] interconnect: Add generic on-chip interconnect API From: Georgi Djakov To: Evan Green Cc: linux-pm@vger.kernel.org, gregkh@linuxfoundation.org, rjw@rjwysocki.net, robh+dt@kernel.org, Michael Turquette , khilman@baylibre.com, vincent.guittot@linaro.org, skannan@codeaurora.org, Bjorn Andersson , amit.kucheria@linaro.org, seansw@qti.qualcomm.com, davidai@quicinc.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <20180309210958.16672-1-georgi.djakov@linaro.org> <20180309210958.16672-2-georgi.djakov@linaro.org> <43fedb5b-f4a5-8362-d0a2-534b85473bc1@linaro.org> Openpgp: preference=signencrypt Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= xsFNBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamSpKOKFereIrKX2IcnZn8jyycE12zMkk+Sc ASMfXhfywB0tXRNmzsywdxQFcJ6jblPNxscnGMh2VlY2rezmqJdcK4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r6vySGa3Cof+miX06hQXKe99a5+eHNhtZJcMAIO89wZmj 7ayYJIXFqjl/X0KBcCbiAl4vbdBw1bqFnO4zd1lMXKVoa29UHqby4MPbQhjWNVv9kqp8A39+ E9xw890l1xdERkjVKX6IEJu2hf7X3MMl9tOjBK6MvdOUxvh1bNNmXh7OlBL1MpJYY/ydIm3B KEmKjLDvB0pePJkdTw== Message-ID: Date: Wed, 6 Jun 2018 21:09:24 +0300 MIME-Version: 1.0 In-Reply-To: <43fedb5b-f4a5-8362-d0a2-534b85473bc1@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Evan, On 06/06/2018 05:59 PM, Georgi Djakov wrote: >>> + >>> +/** >>> + * icc_node_create() - create a node >>> + * @id: node id >>> + * >>> + * Return: icc_node pointer on success, or ERR_PTR() on error >>> + */ >>> +struct icc_node *icc_node_create(int id) >>> +{ >>> + struct icc_node *node; >>> + >>> + /* check if node already exists */ >>> + node = node_find(id); >>> + if (node) >>> + return node; >> >> This is probably going to do more harm than good once icc_node_delete comes >> in, since it almost certainly indicates a programmer error or ID collision, >> and will likely result in a double free. We should probably fail with >> EEXIST instead. > > In the current approach we create the nodes one by one, and the linked > nodes are created when they are referenced. The other way around would > be to create first all the nodes and then populate the links to avoid > the "chicken and egg" problem. > Just to elaborate a bit more on that: We can't actually register all the nodes in advance, as we might have multiple interconnect providers probing in different order. Each provider may have nodes linking to nodes belonging to other providers (not probed yet). That's why we create the nodes on the first reference and then, when the actual provider driver is probed, the rest of the node data is filled. Thanks, Georgi