From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C09DC433C1 for ; Mon, 22 Mar 2021 11:07:35 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 15FF561931 for ; Mon, 22 Mar 2021 11:07:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15FF561931 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4EwmVM22M9dpQlcRS/DXVJcNtnX5Yyu9QK/AdY6sxaU=; b=OdHRWFbS/JZmxe7eVmhLMWikX XZeO95QqUNtB1ezSygKMhAuXKLrKGjwKV0p1oI+tqnLV8DCrnZ0vMa6XZNYB96/9R32tAbDzzpxh3 dEKVIRA9UYUQDTr+g9THrtNuClThi23DK/HrGCGM4EsyhGFIjpViH0ZlWx+uz5Lestsuhxgv9BO0R nHMD7CB1OkwpQ3GIGjnZi7uGBbPopENJF3VZhH3UvU41gxR6sH2xFnO0WVtIAzqzEQawAE1V2zugp lnCeZD8RUk6T2jo7lEJJle5HrAXM7+cC81moWZ/syLiUFAj36duxAD3S2Nx5Tv4hVwguQsYC/e0eR 6XrH6X8yA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOINU-00BPLK-31; Mon, 22 Mar 2021 11:05:44 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOINL-00BPK9-3X for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 11:05:38 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A044E61879; Mon, 22 Mar 2021 11:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616411131; bh=9PoZ2UOAkMcPPEoghhVL5b7gkf7yE9xH1RgjLaPzkno=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V59K6zDFWymyp9QUxzwsidE+vdao8WL9jfLDqvUnzP1Bw6NWUx8SoOCNYizS3o9ep j8EJhCp56mRpfs+cASmFJRUoxCofOcIuhRskcKo0beTF0nBD7Qb5fOqrGM0noW17d2 jjinYW3wnDZNoCxX7mV0o/rQtfVDjEPq9juhKOyuI13iTW8rbVUN9TEL0Q0vLf6oWV ps3SZQfAJosZCvVn/224d9O780yAAnfNIcFRiHfYrdvRZqmPYEgeF8uMe/PpE9qvGR wZgMgAEFN+I7t00zLsCLtY3K8VXWisHZo0l5XxA1xcRykgTfeMOAmKsQDqmLkTTPT3 ElWDyHmxaTYmw== Date: Mon, 22 Mar 2021 13:05:26 +0200 From: Abel Vesa To: Adam Ford Cc: Ahmad Fatoum , linux-clk , Aisheng Dong , Linus Walleij , Abel Vesa , Stephen Boyd , Fabio Estevam , Michael Turquette , Adam Ford-BE , Linux Kernel Mailing List , NXP Linux Team , Pengutronix Kernel Team , Shawn Guo , Sascha Hauer , arm-soc , Jerome Brunet Subject: Re: [PATCH V4] clk: imx: Fix reparenting of UARTs not associated with stdout Message-ID: References: <20210313122818.445228-1-aford173@gmail.com> <0361ab5b-a26e-7631-9bae-8909715f6354@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_110536_236994_58FCA6F7 X-CRM114-Status: GOOD ( 24.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 21-03-20 18:00:25, Adam Ford wrote: > On Sun, Mar 14, 2021 at 4:40 AM Ahmad Fatoum wrote: > > > > On 13.03.21 16:16, Ahmad Fatoum wrote: > > >> +/* i.MX boards use device trees now. For build tests without CONFIG_OF, do nothing */ > > >> +#ifdef CONFIG_OF > > >> if (imx_keep_uart_clocks) { > > >> int i; > > >> > > >> - imx_uart_clocks = clks; > > >> - for (i = 0; imx_uart_clocks[i]; i++) > > >> - clk_prepare_enable(*imx_uart_clocks[i]); > > >> + imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL); > > >> + > > >> + if (!of_stdout) > > >> + return; > > > > > > Memory leak. Just do if (imx_keep_uart_clocks && of_stdout) > > > > Please dismiss. I overlooked that you free it in a later initcall. > > Abel, > > Are you OK with this? I also have a V5 posted [1] which does what > Ahmad suggested. > I'm OK with this version. Applied it on my clk/imx branch: git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux.git Thanks a lot for all the effort. > Either of these will fix reparenting issues, but I need this for > Bluetooth to operate correctly, because both beacon imx8mn and imx8mn > kits switch the UART parent to an 80MHz clock in order to run at > 4Mbps. > > thank you, > > adam > > > > >> static int __init imx_clk_disable_uart(void) > > >> { > > >> - if (imx_keep_uart_clocks && imx_uart_clocks) { > > >> + if (imx_keep_uart_clocks && imx_enabled_uart_clocks) { > > >> int i; > > >> > > >> - for (i = 0; imx_uart_clocks[i]; i++) > > >> - clk_disable_unprepare(*imx_uart_clocks[i]); > > >> + for (i = 0; i < imx_enabled_uart_clocks; i++) { > > >> + clk_disable_unprepare(imx_uart_clocks[i]); > > >> + clk_put(imx_uart_clocks[i]); > > >> + }; > > >> + kfree(imx_uart_clocks); > > >> } > > > > -- > > Pengutronix e.K. | | > > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel