Received: by 10.192.165.148 with SMTP id m20csp1979911imm; Thu, 26 Apr 2018 04:59:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/VyNzyrfyh/0RvtY1mABTGql3Rmv/WpX3UieZxNnL2uNOn6z/A9SHrI35eWId9LaVYQEl3 X-Received: by 10.98.185.23 with SMTP id z23mr31702209pfe.180.1524743988164; Thu, 26 Apr 2018 04:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524743988; cv=none; d=google.com; s=arc-20160816; b=lyiGAVMTJRYtEZ4PfqMMQRFG44/IvklKlTR96/PhCoxwQs2MYhS1cqLP0fzIWmepkp 9PRt/7uci9Qkx6+50OArtwcdqwH8A+5oq2t7wcJXBrQybbWByGHUc3Ns4GX8NspIoGbN 3Q+E/SUP4oMh89wbXHvzK/NUE6q//3cCnMjoW6L/SQJB3W6YMPpLk9OjV7l0+UJJ7iEd nEiQiYb8oOhqoBgYrHxDikBbx3Cac7d060AB5HqJV7tjIH6dRg+DBjp+QENI4uHd4UN4 QPNldoER0K66VL/HLLEkeNB8RqiafelK9lZv7jhUq/ev2C8EDjFCugJyPdQFf2GAE/g1 Y/dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=5Z3ViOV2+xn0iR8VPbunM6R9l+lpOm61q2S8u6iCw3k=; b=ym8JFygUH/t0hDVlgRwWfxPMJvq3FgQX+6Q3vU/D4X8XOIoBSpY4LosCFtpg23ef9g 3rWnBvJxUfB8Sn6Vibi3YOHNCaOFmrYSmgtCuT5jelsJoB7q5bMj+MmLGjbqnyKwr9mA MUbA5FKUT3PR+lgcDW8FZRhXXhQTjzYz3m2JLgKvX5vzubjnjPo5nM9DuXgvZ8zwmB5A efFNDjIK5hm/m7VH/LWnftaBItTVOMchR4v1+6EJ4z4hjixd0Yag1qa9uuBh00XZOCz6 LDyf+FWRNvJKkRhb6AxLcRZMEuQwU20L7VXCyTkTiBirsNuLHJAxFgN6FDiI9ldTZVrB WscA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Evx6FRYR; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si15577848pgc.366.2018.04.26.04.59.33; Thu, 26 Apr 2018 04:59:48 -0700 (PDT) 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=@samsung.com header.s=mail20170921 header.b=Evx6FRYR; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756121AbeDZL5y (ORCPT + 99 others); Thu, 26 Apr 2018 07:57:54 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21222 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755561AbeDZLwH (ORCPT ); Thu, 26 Apr 2018 07:52:07 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180426115205epoutp0316efdd6e41453f124651621d89b9c4f3~o_ih27oUi2180121801epoutp03H; Thu, 26 Apr 2018 11:52:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180426115205epoutp0316efdd6e41453f124651621d89b9c4f3~o_ih27oUi2180121801epoutp03H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1524743525; bh=5Z3ViOV2+xn0iR8VPbunM6R9l+lpOm61q2S8u6iCw3k=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Evx6FRYRsGemAgGyRdD4P9CFr2j79Q65Zn0eQV7+tkWVBGpuCGQl4LgXp2wwMR2CF 0hqx8IBaF7O1iGKm9TGz1vNTBWkJHxfT/EdUit7y+qgkplp5P5JXQ0yQZA4gsXgI+X 2BewW80hgd5yv98dPPHwOVtdRGGV3c23dcv7qqYA= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20180426115205epcas2p1508ab66f90593624708bf50323bebb62~o_ihtkZ9m1909219092epcas2p1S; Thu, 26 Apr 2018 11:52:05 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id BE.66.04128.56DB1EA5; Thu, 26 Apr 2018 20:52:05 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180426115204epcas2p3a0b53d8b2bdd687b1acc19db98f30227~o_igngXRZ0036200362epcas2p3O; Thu, 26 Apr 2018 11:52:04 +0000 (GMT) X-AuditID: b6c32a45-8f3ff70000001020-37-5ae1bd65eb2d Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 4D.2B.03817.46DB1EA5; Thu, 26 Apr 2018 20:52:04 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P7S00GD7JMBQG00@mmp2.samsung.com>; Thu, 26 Apr 2018 20:52:03 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Zhang Rui , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH 02/18] thermal: exynos: always check for trips points existence Date: Thu, 26 Apr 2018 13:51:17 +0200 Message-id: <1524743493-28113-3-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1524743493-28113-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRmVeSWpSXmKPExsWy7bCmqW7q3odRBi2fRS02zljPajH/yjVW i8u75rBZfO49wmgx4/w+JosnD/vYHNg8ds66y+6xeM9LJo++LasYPT5vkgtgieKySUnNySxL LdK3S+DKuNn/mr3ggVDF7tVNzA2Ms/m7GDk5JARMJD71LmTvYuTiEBLYwSix4dRHZgjnO6PE mfOfWWGqTi2ZzgZiCwlsYJR42qoLYf9ilNg+gQvEZhOwkpjYvooRxBYR0JI4cWk7E8ggZoE5 jBKzGnazgCSEBQIl5s/9zwRiswioSnxbtIoZxOYV8JBonPQdapmcxMljk8FsTgFPiQtHmlhA BkkI/GSV2HfuHDNEkYvElzsdbBC2sMSr41vYIWxpiWerNjJCNDQzSnzbsQeqYQKjxJ71QhC2 tcTh4xfBNjAL8El0HP4L1MwBFOeV6GiDKvGQ6N36jwnCdpSY1LuLBRIsQN8cP7+CdQKj1AJG hlWMYqkFxbnpqcVGBYZ6xYm5xaV56XrJ+bmbGMExqOW6g3HGOZ9DjAIcjEo8vAELH0QJsSaW FVfmHmKU4GBWEuGNb30YJcSbklhZlVqUH19UmpNafIhRmoNFSZy3wfdMlJBAemJJanZqakFq EUyWiYNTqoFxv/EDkfB5CUXld3ifmGcp5dnrWc+PqjxjdHvL6qJKpvv5p5kuSn89ttZ0VsLM rIu3K86E/v/wYVqV3q9J4TWG1qpyi51DPoh8dmudG5y1s2VC6rnApJzvuudDUl7f092hvrjh 860szeQTMQ2zDZ1dHly7mCSQEN9xV1rO0jZRUGTfDZUPn/WUWIozEg21mIuKEwGC4v6SvQIA AA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmluLIzCtJLcpLzFFi42I5/e+xoG7K3odRBk+/sVtsnLGe1WL+lWus Fpd3zWGz+Nx7hNFixvl9TBZPHvaxObB57Jx1l91j8Z6XTB59W1YxenzeJBfAEsVlk5Kak1mW WqRvl8CVcbP/NXvBA6GK3aubmBsYZ/N3MXJySAiYSJxaMp2ti5GLQ0hgHaPE0z/LmSCcX4wS K1fcZwapYhOwkpjYvooRxBYR0JI4cWk7WBGzwBxGiecr5jCBJIQF/CVubJsJVsQioCrxbdEq sGZeAQ+JxknfWSHWyUmcPDYZzOYU8JS4cKSJBcQWAqq53/eebQIjzwJGhlWMkqkFxbnpucVG BUZ5qeV6xYm5xaV56XrJ+bmbGIFBs+2wVv8OxsdL4g8xCnAwKvHwBix8ECXEmlhWXJl7iFGC g1lJhDe+9WGUEG9KYmVValF+fFFpTmrxIUZpDhYlcV7+/GORQgLpiSWp2ampBalFMFkmDk6p Bkb5tSKvd7JPd2NnmPjsQlhC2k72zyJKU+WOTW0OSjm2yGiasr/2Ea/9+/842bGoP7ApTDK2 bvB/z8bLqyJmPLXKbELJFpMrnscFbZzPnOnu+x565Zaz0KOM7sqi7VYrzp13/xhk0pz1dnb2 b1/B5+xnvb7bHokr9QhwV9YIuH/lP4+cn1OpsxJLcUaioRZzUXEiAFXl4JYWAgAA X-CMS-MailID: 20180426115204epcas2p3a0b53d8b2bdd687b1acc19db98f30227 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20180426115204epcas2p3a0b53d8b2bdd687b1acc19db98f30227 X-RootMTR: 20180426115204epcas2p3a0b53d8b2bdd687b1acc19db98f30227 References: <1524743493-28113-1-git-send-email-b.zolnierkie@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Check for trip points existence in exynos_tmu_initialize() so it is checked on all SoCs. * Use dev_err() instead of pr_err(). * Fix dev_err() to reference "device tree" not "of-thermal.c". * Remove no longer needed checks from exynos4210_tmu_initialize() and get_th_reg(). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/samsung/exynos_tmu.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 523d26e..9e040eb 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -309,12 +309,6 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool falling) unsigned long temp; int i; - if (!trips) { - pr_err("%s: Cannot get trip points from of-thermal.c!\n", - __func__); - return 0; - } - for (i = 0; i < of_thermal_get_ntrips(tz); i++) { if (trips[i].type == THERMAL_TRIP_CRITICAL) continue; @@ -334,14 +328,23 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool falling) static int exynos_tmu_initialize(struct platform_device *pdev) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); + struct thermal_zone_device *tzd = data->tzd; + const struct thermal_trip * const trips = + of_thermal_get_trip_points(tzd); int ret; - if (of_thermal_get_ntrips(data->tzd) > data->ntrip) { + if (!trips) { + dev_err(&pdev->dev, + "Cannot get trip points from device tree!\n"); + return -ENODEV; + } + + if (of_thermal_get_ntrips(tzd) > data->ntrip) { dev_info(&pdev->dev, "More trip points than supported by this TMU.\n"); dev_info(&pdev->dev, "%d trip points should be configured in polling mode.\n", - (of_thermal_get_ntrips(data->tzd) - data->ntrip)); + (of_thermal_get_ntrips(tzd) - data->ntrip)); } mutex_lock(&data->lock); @@ -397,13 +400,6 @@ static int exynos4210_tmu_initialize(struct platform_device *pdev) unsigned long reference, temp; unsigned int status; - if (!trips) { - pr_err("%s: Cannot get trip points from of-thermal.c!\n", - __func__); - ret = -ENODEV; - goto out; - } - status = readb(data->base + EXYNOS_TMU_REG_STATUS); if (!status) { ret = -EBUSY; -- 1.9.1