Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10482792imu; Thu, 6 Dec 2018 01:44:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/VfioTs0qzKXY/66p8U6WIgsQN2ASUuSbZ6hhglSzRieIrdN8IWoO5soY56rE+jlzJqSIW6 X-Received: by 2002:a63:2315:: with SMTP id j21mr23732057pgj.297.1544089482079; Thu, 06 Dec 2018 01:44:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544089482; cv=none; d=google.com; s=arc-20160816; b=MCOjjkZGb4riZLcXGr5QQGXlG8qjiWQVidKATNWr/p9ooZC7CSuNX/rjrL3Ary0K8g 3TEh0wVruLtaDkH9/FYWuiD2fUVQ2XwFUKU7BfLSyiYn/ZcwJF+J8EIhyZ3cbGwg6ixt VkwgzD26r4IcEfqi3Y0fvkIwoXvS2fDYV3oowUbB6hS5oWl4fjlSJijaPM/oxD56th6F beGLum3mOjjL0+2dZtyR6XReaVc2agZYhKwUKm5kfDJR8L+ZrD9YSeDXatl4r8UB/OaX Z9eaJoFWqwnJlfoghwr1ooiyezvUGAp6Y7dq9UcYMymteJ22hmc5iCu+cm7P4IK5iS/U +p9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ZSk6hIsmK/zbcNqT53FU0KnRlMRG/z7GDbRCkUaGy7o=; b=LQ3Dt9KLypQSqjkQ1GEr+Tin2gZ3MAwZScgPiAt1JjbtsizM+oolKcAU7w6kzyNFDk 9tf8/FYLcg5EsPTTdFNzIr9sY/dsXGiYzZv7a4S6wx4ncOj7MlHJ8e+rlSHqyrHgXcUT xcsCy/9sKdjLr1jGbDEC5UhVJP1IUAuoJlWqst4DdmeOJn0yzgrDxUDfyl59Jvpf7hDE xrs+9Rxc4FiHH5OGTWTr9HG9CON5auLvlS8KFisTAjovI0L7Yp24CdTLdDD3BGvWIdvB FLaFJ7swrPmdycZ7UgvwdWbxRfuHIjPWEOgihKqv8WXV6Cisr7R9Pue0pr3FwitrjExm +lrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H+wup7CJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j132si23050536pfc.84.2018.12.06.01.44.25; Thu, 06 Dec 2018 01:44:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H+wup7CJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729163AbeLFJnf (ORCPT + 99 others); Thu, 6 Dec 2018 04:43:35 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37346 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727832AbeLFJne (ORCPT ); Thu, 6 Dec 2018 04:43:34 -0500 Received: by mail-wm1-f67.google.com with SMTP id g67so305496wmd.2 for ; Thu, 06 Dec 2018 01:43:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZSk6hIsmK/zbcNqT53FU0KnRlMRG/z7GDbRCkUaGy7o=; b=H+wup7CJxMxA4AwAggu9UNYtiUSodyYLJ/cxd9IoqnKnmQCAhXgyG17+Z90oxXd98K SN1f761WuLchXP9E0t3/TPWWDVXmnwyptszNS/8zxfg1YT+jdgOB1UCS0SiipGkzGMWF 11XIKiUsKUiGV1Pq4clyUO+WUf/qAYMPyK/vE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZSk6hIsmK/zbcNqT53FU0KnRlMRG/z7GDbRCkUaGy7o=; b=bIB7VtYFy2Luv0lYx0kisOqwov8jMCJOxsshazLfft+OHKmDea+9kFJPnyZGWF4Qz8 q/20qVPiDl4vqBkgfrpdoMV7x83A/wy0fgPmkal4fMcmY7jJFqKsrhtNfCQuO+pjz4vq FhYigsfHmKPN/aBzcq3KLqbsQJSde5+HUk3XmZjNfRfYDn4wKAWlAqNaniM8fV5W4LXe QugdbZ+3hx6e8hfl5ee41yzIApitDFiT4qzHFX/nIVsEsJ5UY9z8ynK+WalMOuiykTBD To3fA9+nr+1rW/eB9n0WS/OgFrUtbuekrWFQaTTlx9jsW9Hg8b9yj5wd3NFjr1GPdTvG pHvQ== X-Gm-Message-State: AA+aEWZ4V2ALE3zCnzEQR04ncSqWYUidTYqTPpn68c0HqYGwCTFb66kp JMhE15l8HqlZNHjj9rMhn66zHQ== X-Received: by 2002:a1c:9a4c:: with SMTP id c73mr19841697wme.35.1544089412593; Thu, 06 Dec 2018 01:43:32 -0800 (PST) Received: from [192.168.0.40] ([80.125.148.122]) by smtp.googlemail.com with ESMTPSA id q12sm353131wmf.2.2018.12.06.01.43.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 01:43:31 -0800 (PST) Subject: Re: [PATCH] thermal: stm32: read factory settings properly To: David HERNANDEZ SANCHEZ , Zhang Rui , Eduardo Valentin , Rob Herring , Mark Rutland , Maxime Coquelin , Alexandre TORGUE Cc: "linux-pm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" References: <1544087575-22242-1-git-send-email-david.hernandezsanchez@st.com> From: Daniel Lezcano Message-ID: Date: Thu, 6 Dec 2018 10:43:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1544087575-22242-1-git-send-email-david.hernandezsanchez@st.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On 06/12/2018 10:12, David HERNANDEZ SANCHEZ wrote: > Call stm_thermal_read_factory_settings once > internal peripheral is properly clocked. > > To avoid wrong initialization of fmt0 > (stm_thermal_sensor struct) member add > brackets properly. > > Change-Id: I150d00fd50e382df04bfad12f0653b1ed6a1db1b Please do a cleanup of the log: - line wrap at 72 characters - No Change-Id State the problem and then tell what you do to fix it. For example, it is unclear what happens if the factory settings are read before the clock is set. The bracket change is not directly related to the clock ordering and it should go in another patch. In addition each patch is fixing something, in this case it is the initial import, so each fixes should contain the tag: Fixes: 1d693155 (thermal: add stm32 thermal driver) > Signed-off-by: David Hernandez Sanchez > > diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c > index 47623da..bbd73c5 100644 > --- a/drivers/thermal/st/stm_thermal.c > +++ b/drivers/thermal/st/stm_thermal.c > @@ -241,8 +241,8 @@ static int stm_thermal_read_factory_settings(struct stm_thermal_sensor *sensor) > sensor->t0 = TS1_T0_VAL1; > > /* Retrieve fmt0 and put it on Hz */ > - sensor->fmt0 = ADJUST * readl_relaxed(sensor->base + DTS_T0VALR1_OFFSET) > - & TS1_FMT0_MASK; > + sensor->fmt0 = ADJUST * (readl_relaxed(sensor->base + > + DTS_T0VALR1_OFFSET) & TS1_FMT0_MASK); > > /* Retrieve ramp coefficient */ > sensor->ramp_coeff = readl_relaxed(sensor->base + DTS_RAMPVALR_OFFSET) & > @@ -532,6 +532,10 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor) > if (ret) > return ret; > > + ret = stm_thermal_read_factory_settings(sensor); > + if (ret) > + goto thermal_unprepare; > + > ret = stm_thermal_calibration(sensor); > if (ret) > goto thermal_unprepare; > @@ -636,10 +640,6 @@ static int stm_thermal_probe(struct platform_device *pdev) > /* Populate sensor */ > sensor->base = base; > > - ret = stm_thermal_read_factory_settings(sensor); > - if (ret) > - return ret; > - > sensor->clk = devm_clk_get(&pdev->dev, "pclk"); > if (IS_ERR(sensor->clk)) { > dev_err(&pdev->dev, "%s: failed to fetch PCLK clock\n", > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog