From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752448AbbALImY (ORCPT ); Mon, 12 Jan 2015 03:42:24 -0500 Received: from metis.ext.pengutronix.de ([92.198.50.35]:47669 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752420AbbALImU (ORCPT ); Mon, 12 Jan 2015 03:42:20 -0500 Message-ID: <1421052137.3081.4.camel@pengutronix.de> Subject: Re: [PATCH v2] clk: Do not complain about correctly set read-only muxes when assigning clock parents from device tree From: Philipp Zabel To: Stephen Boyd Cc: Mike Turquette , linux-kernel@vger.kernel.org, kernel@pengutronix.de Date: Mon, 12 Jan 2015 09:42:17 +0100 In-Reply-To: <54B0233C.60201@codeaurora.org> References: <1420559120-17405-1-git-send-email-p.zabel@pengutronix.de> <54AEF788.3060401@codeaurora.org> <1420815016.3914.16.camel@pengutronix.de> <54B0233C.60201@codeaurora.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Freitag, den 09.01.2015, 10:51 -0800 schrieb Stephen Boyd: > On 01/09/2015 06:50 AM, Philipp Zabel wrote: > > Hi Stephen, > > > > Am Donnerstag, den 08.01.2015, 13:32 -0800 schrieb Stephen Boyd: > > [...] > >> Why not do this in the core? As far as I can tell other drivers could > >> run into the same problem, no? Does this work? > >> > >> -----8<------- > >> > >> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > >> index f4963b7d4e17..3278645f4729 100644 > >> --- a/drivers/clk/clk.c > >> +++ b/drivers/clk/clk.c > >> @@ -1677,16 +1677,18 @@ int clk_set_parent(struct clk *clk, struct clk *parent) > >> if (!clk) > >> return 0; > >> > >> - /* verify ops for for multi-parent clks */ > >> - if ((clk->num_parents > 1) && (!clk->ops->set_parent)) > >> - return -ENOSYS; > >> - > >> /* prevent racing with updates to the clock topology */ > >> clk_prepare_lock(); > >> > >> if (clk->parent == parent) > >> goto out; > >> > >> + /* verify ops for for multi-parent clks */ > >> + if ((clk->num_parents > 1) && (!clk->ops->set_parent)) { > >> + ret = -ENOSYS; > >> + goto out; > >> + } > >> + > >> /* check that we are allowed to re-parent if the clock is in use */ > >> if ((clk->flags & CLK_SET_PARENT_GATE) && clk->prepare_count) { > >> ret = -EBUSY; > > "[PATCH] clk: make set_parent succeed for any clock if the parent to be > > set is the same as the current parent" ? > > > > It works, but it also changes the API, as it makes > > clk_set_parent(some_non_mux, its_current_parent) > > succeed instead of return -ENOSYS. > > I would think a non_mux clk would have clk->num_parents == 1, so I don't > see how it would return -ENOSYS here. What you mention should succeed > today. Otherwise we have a bug. Right. In that case, I'm all for it. regards Philipp