Received: by 10.213.65.68 with SMTP id h4csp2785620imn; Mon, 9 Apr 2018 09:00:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/O9u9+emZQOrMG3cg/l6lpnYOGIwgsDGEdN/HbkN6JqYiqyDl+3ggTxT0fgHUPFrIUNQL5 X-Received: by 10.98.223.149 with SMTP id d21mr29525564pfl.160.1523289658885; Mon, 09 Apr 2018 09:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523289658; cv=none; d=google.com; s=arc-20160816; b=YyTkMlvfbAr/rZ2VeHoemG+Wl6/EIBwGO9pU7VlpLaWnkEMoIE4BRFwHOaME9QfdOG tunvY3hy8nAP6tY52iyIASewpAoazcfOgeqVjZCHu/OZYB7anl3IRxjI6efUnYh3tIkL J7iMEZ83MAuV7P/54pBZbI2fQTioB8TIQzTW7DuzlWL3MsUu9T+RLlE0OOp920J4I0E+ Z2EacibHXrLlZ35bpP4w3qpUCdSdYch+5LGuathYplWpfmhosFsZvqETh46C5r673lbc v86ok0XQgpdk61XuEOcMUTYM7tjQxfcW5vPh25dmbawbn2KX0oF/NbgRVz7qLb9Rlrua /IZw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6YnYPI3llQmI1M/d2yAs3uEqorCzdv/TM5hfhum3ORY=; b=WnDfZwPRZvcc8q5ZAEyqsbee9jP0/wOo/luhYEHBpMxjdZTUVOcLsl+c6sCb7hbaeL iAjzs6BtdHa3tQhLGc4wKGN4LeiaPIIT5p1B6LPnwjB0OH/1l24fL77Xvk790W+G37WB uwQwpOd27tBX0OfqUXBAR1QjiLa2E/YyPNMDA7PVhcWWqfQaVchl9R8NKPqSA8AKPJk4 KINR52Vy/Ur9q5mWMT4pIsDsawuomKM9qRG0AU7ozKb0/ilLdsJwaQAU2SKQ5d7pCLav K7Fhr5EP2T77pIW7Fkr9g0iniYRda+TtPai6x5+kvWntnS63S2j0tT0n7NAx+YwU/QwQ L6jQ== 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 t73si458410pfg.114.2018.04.09.09.00.21; Mon, 09 Apr 2018 09:00:58 -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 S1753218AbeDIPzv convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Apr 2018 11:55:51 -0400 Received: from gloria.sntech.de ([95.129.55.99]:35168 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752898AbeDIPzu (ORCPT ); Mon, 9 Apr 2018 11:55:50 -0400 Received: from ip9234b810.dynamic.kabel-deutschland.de ([146.52.184.16] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1f5Z8v-0006HH-Et; Mon, 09 Apr 2018 17:55:41 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Robin Murphy Cc: Tomeu Vizoso , Jeffy Chen , open list , jcliang@chromium.org, simon xue , tfiga@chromium.org, Romain Perier , Yakir Yang , Arnd Bergmann , Liang Chen , Rob Herring , Shawn Lin , Catalin Marinas , David Wu , Finley Xiao , Enric Balletbo i Serra , Jacob Chen , Kever Yang , Brian Norris , "open list:ARM/Rockchip SoC..." , Rocky Hao , Will Deacon , Nickey Yang , devicetree@vger.kernel.org, Mark Yao , Russell King , linux-arm-kernel@lists.infradead.org, Sugar Zhang , Caesar Wang , Mark Rutland Subject: Re: [PATCH v8 07/14] ARM: dts: rockchip: add clocks in iommu nodes Date: Mon, 09 Apr 2018 17:55:40 +0200 Message-ID: <2255884.b1SkkUdh3X@diego> In-Reply-To: References: <20180323073814.5802-1-jeffy.chen@rock-chips.com> <10157755.JROavG9E9U@diego> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, 9. April 2018, 17:53:01 CEST schrieb Robin Murphy: > On 09/04/18 16:44, Heiko St?bner wrote: > > Hi Tomeu, > > > > Am Montag, 9. April 2018, 16:41:56 CEST schrieb Tomeu Vizoso: > >> in today's linux-next, the DRM driver fails to probe because the iommu > >> driver fails to find the aclk. I need to apply this patch for things > >> to work again. > > > > Thanks for catching that issue. > > > > This seems to expose a backwards-compatibility issue, as this breaks > > all old devicetrees, so should get a proper fix, apart from me applying > > the dt-patch I missed. > > > > Looking at the iommu-clock-handling patch, I imagine this part as > > the culprit: > > > > + iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks); > > + iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks, > > + sizeof(*iommu->clocks), GFP_KERNEL); > > + if (!iommu->clocks) > > + return -ENOMEM; > > > > The clk-bulk functions seem to work with simple for loops and > > should (as the other standard clock functions) just work fine with > > an empty struct, so I guess a simple > > > > if (!iommu->clocks && iommu->num_clocks > 0) > > > > return -ENOMEM; > > > > should hopefully be enough. I'll try to give this a test later on > > if nobody beats me to it :-) > > But iommu->num_clocks is clearly set to a nonzero compile-time constant > at this point ;) > > I'd assume it's the return from devm_clk_bulk_get() which needs to > special-case the "no clocks found" case from any other error, and *then* > blat num_clocks to 0 if so. you're right of course. Looking at it again, I now clearly see the ARRAY_SIZE and am wondering what made me think num_clocks would be runtime-read. Must be those 25?C today ;-)