Received: by 10.192.165.148 with SMTP id m20csp3703792imm; Mon, 23 Apr 2018 10:51:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49fMYawFF0Xus7rJnxYSaNFMooX0Kzz9ts+vdKyKQ1OQohPGGi6nBlbrOdkkExT9I6pL8bX X-Received: by 10.99.117.71 with SMTP id f7mr8612813pgn.204.1524505896889; Mon, 23 Apr 2018 10:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524505896; cv=none; d=google.com; s=arc-20160816; b=fspFzDvVMoQ6IqwX80TmpCxRydQs08NiDpvp22gSM/BFyvP7zk8YtZQnRA8NJdLgS/ 0Hrde7UR8Lz7Chpbp3lSoSLFPiJ7E7I7SPR6r6kYBO2xK4oVPsmHARIZaZS7PundXrh6 +0lHdIDXn+TMTimgs3oNYaczKimGvAE6GIW88KN7i4uVHurXzTQ758EpNDYfpLw/kN+N 5x/iV5nm6JbJQNGMoE3oQVHeNqC0xFZOfKhspvHvNYDqLYYiMxIwbjUEKjgA0WbYIlPd FnWeSfv1Wht+/IWHuUM4mjUer/fHOdxATU14d3MwHcqdMADJNVkObL+YuCjUy3ygZPxM 0PgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JdfOHL2Mv5M5bdKHdbRPCtHXxjxvElv8TSDlGubBhCo=; b=wIey+OnXuFBaw1yuwoiA1tUsJnycJLyL6AF58Wxm+3blJeyI3/eklmGK0lLK/5FA8E w3NQpuZly8y0bFbYh5jexUnUYfYmomBfQZvWdsVYlY49EKty/Zg+ut5ZbwlmFBGAubP9 AhB88TUBmwH5yafH/JUTlcHBCLcp4fq3x09pDfpqi6kTaRDMxUEADdVTUwFJY+TKeR4U 6EFniCrw9qhiPEubu8Yk0XXzJYnJT5ZiaQ6atAk3wnYEXkkOvU+pYnFnmH9Xz9FS6Vpz n7dXTXLOlHX2QT3pzIoH6M2UjSfEhEHp/0+0aK9j6eykKofNa6Gp1nmiBC3yL7HCX3aw XmHg== 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 p78si11747329pfa.180.2018.04.23.10.51.22; Mon, 23 Apr 2018 10:51:36 -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 S932335AbeDWRqe (ORCPT + 99 others); Mon, 23 Apr 2018 13:46:34 -0400 Received: from muru.com ([72.249.23.125]:38368 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932245AbeDWRqY (ORCPT ); Mon, 23 Apr 2018 13:46:24 -0400 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 3E8198179; Mon, 23 Apr 2018 17:48:07 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Cc: Dave Gerlach , Greg Kroah-Hartman , Nishanth Menon , Suman Anna , Tero Kristo , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/16] bus: ti-sysc: Make child clock alias handling more generic Date: Mon, 23 Apr 2018 10:45:41 -0700 Message-Id: <20180423174549.57412-9-tony@atomide.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180423174549.57412-1-tony@atomide.com> References: <20180423174549.57412-1-tony@atomide.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to prepare supporting clkctrl optional clocks, we need to make the current child clock handling more generic so we can use the clock role names for the optional clocks in the following patch. Cc: Tero Kristo Signed-off-by: Tony Lindgren --- drivers/bus/ti-sysc.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -811,29 +811,38 @@ static int sysc_init_syss_mask(struct sysc *ddata) } /* - * Many child device drivers need to have fck available to get the clock - * rate for device internal configuration. + * Many child device drivers need to have fck and opt clocks available + * to get the clock rate for device internal configuration etc. */ -static int sysc_child_add_fck(struct sysc *ddata, - struct device *child) +static int sysc_child_add_named_clock(struct sysc *ddata, + struct device *child, + const char *name) { - struct clk *fck; + struct clk *clk; struct clk_lookup *l; - const char *name = clock_names[SYSC_FCK]; + int error = 0; - if (IS_ERR_OR_NULL(ddata->clocks[SYSC_FCK])) + if (!name) return 0; - fck = clk_get(child, name); - if (!IS_ERR(fck)) { - clk_put(fck); + clk = clk_get(child, name); + if (!IS_ERR(clk)) { + clk_put(clk); return -EEXIST; } - l = clkdev_create(ddata->clocks[SYSC_FCK], name, dev_name(child)); + clk = clk_get(ddata->dev, name); + if (IS_ERR(clk)) + return -ENODEV; + + l = clkdev_create(clk, name, dev_name(child)); + if (!l) + error = -ENOMEM; - return l ? 0 : -ENODEV; + clk_put(clk); + + return error; } static struct device_type sysc_device_type = { @@ -983,7 +992,8 @@ static int sysc_notifier_call(struct notifier_block *nb, switch (event) { case BUS_NOTIFY_ADD_DEVICE: - error = sysc_child_add_fck(ddata, dev); + error = sysc_child_add_named_clock(ddata, dev, + clock_names[SYSC_FCK]); if (error && error != -EEXIST) dev_warn(ddata->dev, "could not add %s fck: %i\n", dev_name(dev), error); -- 2.17.0