Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2470565pxj; Mon, 31 May 2021 03:04:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygTDPxOmyTV/IORgBbOSsM/O5s/Tkc4BmnRQAxRiYbGhzy0CrY3fsIPdRj95E6WYQXZtZk X-Received: by 2002:a05:6602:242b:: with SMTP id g11mr16095864iob.105.1622455471068; Mon, 31 May 2021 03:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622455471; cv=none; d=google.com; s=arc-20160816; b=V/YKZFo4CK2UkY0h29jKVcs5IbWVkAy50BOUXgFrOXdszTH6Tvo9Rqs+rTThLQpyax B3j5UrpXNurFfSHCyIHx8vQVi0h6rgcxiV66QRO8MLG0iI9Tz44x1001UlSLDFHXNoOP kvPgijVIp8eBsyRBVzrCl/6jFXUyerdK7HsEtdSTYtyi/53lBB0CXrNbTVI6qK0Ko7bF 3/hD3aOrbrbAk7HM6PcQ+MLCNMbfw7k1Bq3K6NhJMLjQp7cTJo9B8BHWwdzWSfGSv8NN WnGO8BmdhsLNO2gVNZffKgtrYjMHt4izAm8tn/wVBT1HKqFjSvSe688aoVtUFqGAJlxR y1Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=MfCx5i0SruY+IiGu9maV+THuQIrwfGZSNqbaXizbSNU=; b=lOPPIzMXVkAsgkWuINi4ZI4snFyIS1oQYsTggKhXJyL31Quk6X9I//64oMv084BIGA KLpVQlw5W/wPKOnpitlSr6SGm316J9RpBpgoG6WUMZH4v1pct0Hg7rr0lVIXgm3Vxs4x Xrj/BzVovOTR751CBvHVUj3L0ks1gQj9hQpySsN2gaA2sIytiDlMIgbkWmuQv4b4ac8S S5XtC/BVLILoKrrO47yaL9a1ozz7J8QetWuerfQ5zA7H5/ERyJkQ2D5NFmE2ZzefB606 mZvr5MQW379gBFrlRIROP5s/++WV7HoUQi3PQqM2Qd79mE3uHXdnqcv/z+jvOMHxMjX3 7QZg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x7si13837120jat.98.2021.05.31.03.04.17; Mon, 31 May 2021 03:04:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231280AbhEaKFV (ORCPT + 99 others); Mon, 31 May 2021 06:05:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231283AbhEaKFP (ORCPT ); Mon, 31 May 2021 06:05:15 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 030BBC061760 for ; Mon, 31 May 2021 03:03:34 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnelR-0004st-Tc; Mon, 31 May 2021 12:03:17 +0200 Received: from pengutronix.de (unknown [IPv6:2a03:f580:87bc:d400:eb0a:85ec:ae31:4631]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id 8766762FC76; Mon, 31 May 2021 10:03:15 +0000 (UTC) Date: Mon, 31 May 2021 12:03:14 +0200 From: Marc Kleine-Budde To: Andy Shevchenko Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam , Thomas Kopp , Wolfgang Grandegger , "David S. Miller" , Jakub Kicinski Subject: Re: [PATCH v2 1/2] can: mcp251xfd: Try to get crystal clock rate from property Message-ID: <20210531100314.w4ydd3ozhbb7k6sv@pengutronix.de> References: <20210526193327.70468-1-andriy.shevchenko@linux.intel.com> <20210531084720.6xql2r4uhp6ruzl6@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="empwam5wixyaduli" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --empwam5wixyaduli Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 31.05.2021 12:58:29, Andy Shevchenko wrote: > On Mon, May 31, 2021 at 10:47:20AM +0200, Marc Kleine-Budde wrote: > > On 26.05.2021 22:33:26, Andy Shevchenko wrote: > > > In some configurations, mainly ACPI-based, the clock frequency of the= device > > > is supplied by very well established 'clock-frequency' property. Henc= e, try > > > to get it from the property at last if no other providers are availab= le. >=20 > > > return dev_err_probe(&spi->dev, PTR_ERR(reg_xceiver), > > > "Failed to get Transceiver regulator!\n"); > > > =20 > > > - clk =3D devm_clk_get(&spi->dev, NULL); > > > + /* Always ask for fixed clock rate from a property. */ > > > + device_property_read_u32(&spi->dev, "clock-frequency", &rate); > >=20 > > what about error handling....? >=20 > Not needed, but rate should be assigned to 0, which is missed. >=20 > > > + clk =3D devm_clk_get_optional(&spi->dev, NULL); > > > if (IS_ERR(clk)) > > > return dev_err_probe(&spi->dev, PTR_ERR(clk), > > > "Failed to get Oscillator (clock)!\n"); > > > freq =3D clk_get_rate(clk); > > > + if (freq =3D=3D 0) > > > + freq =3D rate; > >=20 > > ... this means we don't fail if there is neither a clk nor a > > clock-frequency property. >=20 > The following will check for it (which is already in the code) >=20 > if (freq <=3D MCP251XFD_SYSCLOCK_HZ_MAX / MCP251XFD_OSC_PLL_MULTIPLIER)= { Good point. > > I've send a v3 to fix this. >=20 > You mean I have to send v3? > Sure! I have send a v3, see: https://lore.kernel.org/r/20210531084444.1785397-1-mkl@pengutronix.de Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --empwam5wixyaduli Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmC0tGAACgkQqclaivrt 76nmjAf9HvS70rVRdi2fcQ81qkc6xLuLuF8T2LbFeMvO9fXnU78jcz1leWRjFJNB wkLzxUR93ZJ2OPvULVY4nzQ2wl10253zU2XFX49KcMZv7fsxCFaxmknf07mTmIRt /Zz0PkQWF38HT1csD1qzoDfPJq/TDnL8f7sIUOCzeQ3E+uT84JMJg+3x3Hndw9U2 fb+E+r2FhF6vj+Qp8Hzux/PdxowFtn8KGGD3c6VfUdUjw4VTw2RPshQoktlVhkAA 2mrFotq2f8zyUvKEMZSaAZivjV09SGq1cLpj1kOH9a1LHp5dVTO4Z7PVXqqgxVJa O6d81jNFSk2EpNGauXVC9ZAVLvfPOg== =Ctl7 -----END PGP SIGNATURE----- --empwam5wixyaduli--