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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 874B6C48BCD for ; Wed, 9 Jun 2021 13:18:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6AFAC613C1 for ; Wed, 9 Jun 2021 13:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233849AbhFINUg (ORCPT ); Wed, 9 Jun 2021 09:20:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:38972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231935AbhFINUf (ORCPT ); Wed, 9 Jun 2021 09:20:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E1A3A613BE; Wed, 9 Jun 2021 13:18:39 +0000 (UTC) Subject: Re: [PATCH 5/5] can: flexcan: add mcf5441x support To: Geert Uytterhoeven , Joakim Zhang , Angelo Dureghello Cc: "wg@grandegger.com" , "mkl@pengutronix.de" , "linux-m68k@vger.kernel.org" , "linux-can@vger.kernel.org" References: <20210608204542.983925-1-angelo@kernel-space.org> <20210608204542.983925-5-angelo@kernel-space.org> From: Greg Ungerer Message-ID: <8e37464b-34ce-97bd-6422-ce723075bffb@linux-m68k.org> Date: Wed, 9 Jun 2021 23:18:38 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-can@vger.kernel.org Hi Geert, On 9/6/21 6:12 pm, Geert Uytterhoeven wrote: > Hi Joakim, Angelo, > > On Wed, Jun 9, 2021 at 4:05 AM Joakim Zhang wrote: >>> From: Angelo Dureghello >>> Sent: 2021年6月9日 4:46 >>> To: gerg@linux-m68k.org; wg@grandegger.com; mkl@pengutronix.de >>> Cc: geert@linux-m68k.org; linux-m68k@vger.kernel.org; >>> linux-can@vger.kernel.org; Joakim Zhang ; >>> Angelo Dureghello >>> Subject: [PATCH 5/5] can: flexcan: add mcf5441x support >>> >>> Add flexcan support for NXP ColdFire mcf5441x family. >>> >>> This flexcan module is quite similar to imx6 flexcan module, but with some >>> exceptions: >>> >>> - 3 separate interrupt sources, MB, BOFF and ERR, >>> - implements 16 mb only, >>> - m68k architecture is not supporting devicetrees, so a >>> platform data check/case has been added, >>> - ColdFire is m68k, so big-endian cpu, with a little-endian flexcan >>> module. >>> >>> Signed-off-by: Angelo Dureghello > >>> --- a/drivers/net/can/flexcan.c >>> +++ b/drivers/net/can/flexcan.c > >>> @@ -637,13 +650,17 @@ static int flexcan_clks_enable(const struct >>> flexcan_priv *priv) { >>> int err; >>> >>> - err = clk_prepare_enable(priv->clk_ipg); >>> - if (err) >>> - return err; >>> + if (priv->clk_ipg) { >>> + err = clk_prepare_enable(priv->clk_ipg); >>> + if (err) >>> + return err; >>> + } >>> >>> - err = clk_prepare_enable(priv->clk_per); >>> - if (err) >>> - clk_disable_unprepare(priv->clk_ipg); >>> + if (priv->clk_per) { >>> + err = clk_prepare_enable(priv->clk_per); >>> + if (err) >>> + clk_disable_unprepare(priv->clk_ipg); >>> + } >> >> No need do this check, it will be handled in clk_prepare_enable() / clk_disable_unprepare(). So this change is unnecessary. > > Except that the non-CCF implementation of clk_enable() in > arch/m68k/coldfire/clk.c still returns -EINVAL instead of NULL. > Any plans to move to CCF? Or at least fix legacy clk_enable(). That was a recent change, see commit c1fb1bf64bb6 ("m68k: let clk_enable() return immediately if clk is NULL"). It could just as easily just return on that NULL check. Regards Greg >>> @@ -2091,6 +2133,11 @@ static int flexcan_probe(struct platform_device >>> *pdev) >>> >>> devtype_data = of_device_get_match_data(&pdev->dev); >>> >>> + if (pdata && !devtype_data) { >>> + devtype_data = >>> + (struct flexcan_devtype_data *)&fsl_mcf_devtype_data; > > Cast not needed? > > Gr{oetje,eeting}s, > > Geert >