Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1342771ybk; Sun, 10 May 2020 13:56:26 -0700 (PDT) X-Google-Smtp-Source: APiQypJajMgFFkny4spnhvWDIdZpTc13d+dVcvS1K7p7ocohCOT83IgUnPzJ2r0dogikNAS4SHII X-Received: by 2002:a17:907:4304:: with SMTP id nh4mr11081133ejb.193.1589144186508; Sun, 10 May 2020 13:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589144186; cv=none; d=google.com; s=arc-20160816; b=ftL57MKtZdeSQHRQSDurPlJKfk1w07Rs9XAzxK9873Ea6AToBhuLcZ9/0Sr6xctL/I tcH9eyaUypjWIBiSEX76zoXDKwiA37BMNdYmyTgHP+TILCCRjaW2r1U7kT7+5B77zYWm 9Ia3lOjPea6Th6QfU/u9IyH1QmrrT+R25+iY0nnjEVQhKlhQePuy6ZcKt5FcTFukU7/g RGGsNfK6Juy/jTPzSAruxhnwLbUqKGZJeHHrGvTsxpoWY7y4wVOcWp+Bp7PS7blOOwL5 spQoDP7jEntH2dJR3cZiCSo/8vHZ+jWCwx565+tAkoP6ECwgQXgEyADt5YL8hj5MmcG8 2XgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XN9HVfx2Nq8ELSLfKqyYdBqRcQTahj+sAQBqI9rxLfw=; b=RWa49UY6/cTHN5AD492tSgH4gaGYTdz05cPq4q2fewlF7DIjvu3PO1UZnn3Ct+lBxv hM/I5TcNwtMOJjMbhkDpSa4uiIbP+o+c0EoT81ccDYD9gyCBJF/bb1SvCYTv7fvfCAgu iAUgiWKIlFEkbrOjdMXtwIduSAKwdJddn7vgLjGaj98XJ29FtpWQL1VAHKcL9rmixuKF Ok2VuJvEhH9h3XtiqWAvoQT5ezBsd7jO+EKcvvrVmJYlLDwk3jUcWJyaLdw+OtQR+E0T GrdTtlG60Vx8dLNIbqb/h9K8mKoBZvkTKTq9lvBuUK+ooEGkoBU2wIHaopdoIj9AgucP EA6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=l8bxUB+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n7si4933980ejy.248.2020.05.10.13.56.03; Sun, 10 May 2020 13:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=l8bxUB+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729484AbgEJUwk (ORCPT + 99 others); Sun, 10 May 2020 16:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729377AbgEJUwi (ORCPT ); Sun, 10 May 2020 16:52:38 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E50C061A0C; Sun, 10 May 2020 13:52:38 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id n17so6169548ejh.7; Sun, 10 May 2020 13:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XN9HVfx2Nq8ELSLfKqyYdBqRcQTahj+sAQBqI9rxLfw=; b=l8bxUB+OrW+TcvrPvGlUmvJXPn//BVuK9BnU2b1VBHsgiYWVYgOMxZ0VzOrllgvIn/ 99E02MCrZNtOycINWxbpLqzL1nJh8mgIGGZKezFiejkQ62ae3u6kZ/VBXRwzbbyXJKTs wSseBhqSkgQwTG5qaUTYI63lji6hBJU47bfO56CtufPSsTXriT4bBCRlxosqIB27hVf8 EM4xsKQFqq6jBv1V5qBjWaitxMrVNFR0MIS+cr7T/x4ilLFGZwM0vUsb6+jdaIyMpueQ OjLER+XdxGM50xXwbhnnu9XApbJxAifm+KFKEHOqAQwopk50CnoWfOOlEM81B43SwUqo BV8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XN9HVfx2Nq8ELSLfKqyYdBqRcQTahj+sAQBqI9rxLfw=; b=tfvyab2HN7bPDTC+jNlsibE0HQVmqWSP/PK/rz62BhHs71M/jPmDWSnDZ0KzRHyRCX tLAyUqDQC8KPLFdsMA915TsJKcUq1ZDpmIbW9msx/9zKj++Frm/OYJ8/OIzO5Af71xIw MCQDdhIaD9Lqy8Wgw2O/iFh8CX+eTM1VEDOQxqOvHaSYRS9n4X0bR+XAZdORo94iZFIE LMmT1B0UoModlRE/bVnIbaL1mSO4X7M4KSINa6O7tq8hnIXgKMjBEOajXCoEwxLHxzYd 9+bOhBD0/a0nWNAOHci+NKOxQlU0F+cRA+mBRyUGYOl9wkIFTKCIuU8bJPwhrBlmx+R8 Kt7w== X-Gm-Message-State: AGi0PuZAYtOtjz8kQ6K7Zjd4xPj0PepXdsewaUMODgShnm7DHjV83YKk yRimFr+gqXtCXnF5MJLp5vKDgLfPNQwL0HEFB3w= X-Received: by 2002:a17:906:4048:: with SMTP id y8mr10685706ejj.258.1589143956392; Sun, 10 May 2020 13:52:36 -0700 (PDT) MIME-Version: 1.0 References: <20200428210229.703309-1-martin.blumenstingl@googlemail.com> <20200428210229.703309-3-martin.blumenstingl@googlemail.com> <1jlfmdi9uw.fsf@starbuckisacylon.baylibre.com> <1jh7x1i3hj.fsf@starbuckisacylon.baylibre.com> <1j1rnygye6.fsf@starbuckisacylon.baylibre.com> In-Reply-To: <1j1rnygye6.fsf@starbuckisacylon.baylibre.com> From: Martin Blumenstingl Date: Sun, 10 May 2020 22:52:25 +0200 Message-ID: Subject: Re: [PATCH v6 2/2] mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host To: Jerome Brunet Cc: Ulf Hansson , Stephen Boyd , "open list:ARM/Amlogic Meson..." , "linux-mmc@vger.kernel.org" , DTML , Rob Herring , Jianxin Pan , Linux Kernel Mailing List , yinxin_1989@aliyun.com, Linux ARM , lnykww@gmail.com, Anand Moon Content-Type: multipart/mixed; boundary="00000000000004a71b05a55169bf" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000004a71b05a55169bf Content-Type: text/plain; charset="UTF-8" Hi Jerome, On Tue, May 5, 2020 at 6:05 PM Jerome Brunet wrote: [...] > > 2. Keep the existing approach, with devm_clk_get(). I am fine with > > this as well, we can always switch to 1) later on. > > I have a problem with this approach. > The dt-bindings would include "#clock-cells = <1>" for a device that > does not actually provide and only needs it has a temporary work around. > Those bindings are supposed to be stable ... actually I don't see a problem here because this specific MMC controller has a clock controller built into it. Rob also didn't see any problem with this when he reviewed the dt-bindings > I have proposed 2 other short term solutions, let's see how it goes since I was also curious how this turns out I first implemented your suggestion to use a similar clk_hw registration style as dwmac-meson8b. That made the code easier to read - thank you for the suggestion! On top of that I switched from clk_hw_onecell_data to directly accessing "clk_hw.clk". Unfortunately the diffstat is not as great as I hoped, it saves 21 lines (11 in the driver code, 6 in the soc.dtsi, 5 in the dt-bindings) Once devm_clk_hw_get_clk() is implemented 8 lines have to be added again for error checking. I attached the patch for the drivers/mmc/host/meson-mx-sdhc* parts if you are curious (it'll apply only on top of my github branch, not on this series). Please let me know if you want me to submit an updated series where I directly access "clk_hw.clk" to get the "struct clk" or if I should keep clk_hw_onecell_data. If it's the former then I'll also add a TODO comment for the conversion to devm_clk_hw_get_clk() so it's easy to find. Regards, Martin --00000000000004a71b05a55169bf Content-Type: text/x-patch; charset="US-ASCII"; name="temp.diff" Content-Disposition: attachment; filename="temp.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ka1j1f5g0 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvbW1jL2hvc3QvbWVzb24tbXgtc2RoYy1jbGtjLmMgYi9kcml2 ZXJzL21tYy9ob3N0L21lc29uLW14LXNkaGMtY2xrYy5jCmluZGV4IGEzNjQ4M2Q4NTlmOC4uZDJl MzY1MTdlMGY2IDEwMDY0NAotLS0gYS9kcml2ZXJzL21tYy9ob3N0L21lc29uLW14LXNkaGMtY2xr Yy5jCisrKyBiL2RyaXZlcnMvbW1jL2hvc3QvbWVzb24tbXgtc2RoYy1jbGtjLmMKQEAgLTcsNiAr Nyw3IEBACiAKICNpbmNsdWRlIDxkdC1iaW5kaW5ncy9jbG9jay9tZXNvbi1teC1zZGhjLWNsa2Mu aD4KIAorI2luY2x1ZGUgPGxpbnV4L2Nsay5oPgogI2luY2x1ZGUgPGxpbnV4L2Nsay1wcm92aWRl ci5oPgogI2luY2x1ZGUgPGxpbnV4L2RldmljZS5oPgogI2luY2x1ZGUgPGxpbnV4L3BsYXRmb3Jt X2RldmljZS5oPgpAQCAtMjIsNyArMjMsNiBAQCBzdHJ1Y3QgbWVzb25fbXhfc2RoY19jbGtjIHsK IAlzdHJ1Y3QgY2xrX2dhdGUJCQl0eF9jbGtfZW47CiAJc3RydWN0IGNsa19nYXRlCQkJcnhfY2xr X2VuOwogCXN0cnVjdCBjbGtfZ2F0ZQkJCXNkX2Nsa19lbjsKLQlzd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