[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210531100314.w4ydd3ozhbb7k6sv@pengutronix.de>
Date: Mon, 31 May 2021 12:03:14 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Manivannan Sadhasivam <mani@...nel.org>,
Thomas Kopp <thomas.kopp@...rochip.com>,
Wolfgang Grandegger <wg@...ndegger.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH v2 1/2] can: mcp251xfd: Try to get crystal clock rate
from property
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. Hence, try
> > > to get it from the property at last if no other providers are available.
>
> > > return dev_err_probe(&spi->dev, PTR_ERR(reg_xceiver),
> > > "Failed to get Transceiver regulator!\n");
> > >
> > > - clk = devm_clk_get(&spi->dev, NULL);
> > > + /* Always ask for fixed clock rate from a property. */
> > > + device_property_read_u32(&spi->dev, "clock-frequency", &rate);
> >
> > what about error handling....?
>
> Not needed, but rate should be assigned to 0, which is missed.
>
> > > + clk = 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 = clk_get_rate(clk);
> > > + if (freq == 0)
> > > + freq = rate;
> >
> > ... this means we don't fail if there is neither a clk nor a
> > clock-frequency property.
>
> The following will check for it (which is already in the code)
>
> if (freq <= MCP251XFD_SYSCLOCK_HZ_MAX / MCP251XFD_OSC_PLL_MULTIPLIER) {
Good point.
> > I've send a v3 to fix this.
>
> 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
--
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists