Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2468663pxj; Mon, 31 May 2021 03:01:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7ws54tcr8L2FNWQnpYUZ5f4aomz5ljGcV4lUpJfm9lrCcX+v9bH6Dyg54dqtLvnCDHKcJ X-Received: by 2002:a6b:5c04:: with SMTP id z4mr3486854ioh.16.1622455313458; Mon, 31 May 2021 03:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622455313; cv=none; d=google.com; s=arc-20160816; b=e0C11CVboMYLS+wfrwZaAhiTRqmJvNXlmCrQdvgZwPhc18586ZrW95gedT7iFDJ9kb dKmWHkYWgHBrONgq/bPwI96VHGkaRxnoye5DIWY0Yf6XdeIoO8bQ1XbUxowvD2Vsn0nV Lh/DiHMpV1Vmy3B/4NiVqfMdX37wkvw3DlnYJSP6lNkqRsZeGOSRuq/f4Ubj4qpVXLJ+ Dn1Wvrw8iMKmUjrp18TI+mZk5eQl2Sgnzl/v5sMOPgS3ZMcjXK/yWAmdRUcam3WYi2cn BzcJ0wWY6qrFAcg4WrUVQoSLVBTfIVFwWBOi5DcQdqQCqVpHPaiTRf0LiiDsV+wgYDH/ 8ASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=L+Rep6g7ZRP2Yhn6vr0FNs76dQKRxGxn+st/Ow3Fr10=; b=OMA5o/mhS6d5eLJw7a4qwIEfd3St1yixanCL8JFLj5z5Y61A0YRjvrTVi69TGeC462 U96af7sZe07CIwLJfwxeqpRnMAFRiBRhKiVyVuBHU94XUjWsD81ie315rOhZtyojQKEY xNyNmKb/ler2v/248j0qj7NQb0NLbxmIFJg7DnswIsJZlbhoJCr6zRhUpbUZqfj+EqkZ CvubZOVNLAgXwUWi7cjtAAd5bRvazQMykqgSOdFazSWrpP6NN2MqBzEj8spD/mTgy0gF eo+s2HP4NjVB2OKg+EEfdRdqp+8Nn+aY4lNJTAsRMl+S9lqf0PYc6raeAyNKnKp7xtZe LYSA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si13476744ioi.0.2021.05.31.03.01.39; Mon, 31 May 2021 03:01:53 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbhEaKCK (ORCPT + 99 others); Mon, 31 May 2021 06:02:10 -0400 Received: from mga06.intel.com ([134.134.136.31]:3219 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbhEaKBt (ORCPT ); Mon, 31 May 2021 06:01:49 -0400 IronPort-SDR: kAm0TQu2P+GRsG59E1wd3S/aZ1i/l1eOQy7/lyHWbpR2F9mGZL1YI+tKzPLIqrZL1TmxaMYpjU t0AMVurKb1wQ== X-IronPort-AV: E=McAfee;i="6200,9189,10000"; a="264523054" X-IronPort-AV: E=Sophos;i="5.83,236,1616482800"; d="scan'208";a="264523054" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2021 02:58:34 -0700 IronPort-SDR: oFTtw+LeyZUQE5FA8J3xvQs+G01ya/918el9293q9EmcOFvWzuBuH83b8Spnm/+ueHniTZh7pQ xyo/bnvkWE7w== X-IronPort-AV: E=Sophos;i="5.83,236,1616482800"; d="scan'208";a="549368750" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2021 02:58:32 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lnegn-00G42P-Nk; Mon, 31 May 2021 12:58:29 +0300 Date: Mon, 31 May 2021 12:58:29 +0300 From: Andy Shevchenko To: Marc Kleine-Budde 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: References: <20210526193327.70468-1-andriy.shevchenko@linux.intel.com> <20210531084720.6xql2r4uhp6ruzl6@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210531084720.6xql2r4uhp6ruzl6@pengutronix.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { > I've send a v3 to fix this. You mean I have to send v3? Sure! -- With Best Regards, Andy Shevchenko