From patchwork Thu Nov 29 18:26:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 10705197 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 141761057 for ; Thu, 29 Nov 2018 18:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00D092F135 for ; Thu, 29 Nov 2018 18:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E75FA2F1D5; Thu, 29 Nov 2018 18:27:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CAB22F135 for ; Thu, 29 Nov 2018 18:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbeK3Fdd (ORCPT ); Fri, 30 Nov 2018 00:33:33 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:36345 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728360AbeK3Fdd (ORCPT ); Fri, 30 Nov 2018 00:33:33 -0500 Received: by mail-wm1-f68.google.com with SMTP id a18so3274155wmj.1 for ; Thu, 29 Nov 2018 10:27:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ZTpH/PWWAjrgAf66IMtXg3FL+HSUGQrMTer36R8djEg=; b=TFdfcl9fiMpLW+d2mLqNhUampoXJ99wZoOXtIYcERSTAQaZTF8IJUj48IoWVx0ezwa xzdomsJRFRAbsrs2fIUSEMKE1JpqTRj9LaM00ukUk96CNgx/hrkAkbkzEBJZmL460qOA pl4w3IZpBBCqIahZfKdKgZBEsOsF6GBBgUgdM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZTpH/PWWAjrgAf66IMtXg3FL+HSUGQrMTer36R8djEg=; b=N0Go5wIB6RHT7v4QWrBc6nA/QkHZDm3EkKl8byVWrsVJUOzMRaMSUJc/b2m704CeMX uLmHbS80UtYSk/d85ja9hNiJRf/7I+OjPoKvsuDow4UMGe9GZ/FTsHgFPg/RhlE9Mi3I J9W5zCMaE9jUuWzMSBGyZnGmBGS8HhmTTos6JB0QxHoBYushQoHH17pOffeiokpunAYx 1tBKX4ftO+iw8k5u2KzwLY7ztIsVNSiTuwi2rIK2QhvzK3W3D66t9EbLoBC7BfK+Rq07 Gr1OFkqY55lzGeu7hisa+SY4gNbt3UJyssFaZAub5yxnoYWMCjlLYglhrs5wMBmJnO/G yY1g== X-Gm-Message-State: AA+aEWYUKbEvhlSPNUOQtf8Kcj369Wc1hs/3ETkZF6/L42GIeOhr6Vnd ybF1UWv7+2cxFAhDfSRqGUI2dlQk+A8= X-Google-Smtp-Source: AFSGD/VTgxeFc8Mz8d9Zj2QRcJIjGbt5/Z4qPrs+JcwiA0SpxzWfp54YNgV0hm0FSV1Uvcsuxzbq8g== X-Received: by 2002:a1c:400b:: with SMTP id n11mr2787679wma.85.1543516034254; Thu, 29 Nov 2018 10:27:14 -0800 (PST) Received: from localhost.localdomain (183.250.136.77.rev.sfr.net. [77.136.250.183]) by smtp.gmail.com with ESMTPSA id e8-v6sm5670788wmf.22.2018.11.29.10.27.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Nov 2018 10:27:13 -0800 (PST) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: vincent.guittot@linarol.org, john.stultz@linaro.org, linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] thermal/drivers/hisi: Fix bad initialization Date: Thu, 29 Nov 2018 19:26:56 +0100 Message-Id: <1543516016-28186-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Without this patch, the thermal driver on hi6220 and hi3660 is broken. That is due because part of the posted patchset was merged but a small change in the DT was dropped. The hi6220 and hi3660 do not have an interrupt name in the DT, so finding interrupt by name fails. In addition, the hi3660 only defines one thermal zone in the DT and we are trying to register two sensors assuming we have two thermal zones in the DT. Fix this by adding a couple of line of code to add back compatibility with older DT and change the sensors number to 1 for the hi3660. Fixes: 2cffaeff083f (thermal/drivers/hisi: Use platform_get_irq_byname) Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index c4111a9..3ab0e63 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -424,7 +424,7 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) struct platform_device *pdev = data->pdev; struct device *dev = &pdev->dev; - data->nr_sensors = 2; + data->nr_sensors = 1; data->sensor = devm_kzalloc(dev, sizeof(*data->sensor) * data->nr_sensors, GFP_KERNEL); @@ -590,8 +590,13 @@ static int hisi_thermal_probe(struct platform_device *pdev) } ret = platform_get_irq_byname(pdev, sensor->irq_name); - if (ret < 0) - return ret; + if (ret <= 0) { + ret = platform_get_irq(pdev, 0); + if (ret <= 0) { + dev_err(dev, "Failed get interrupt: %d\n", ret); + return ret; + } + } ret = devm_request_threaded_irq(dev, ret, NULL, hisi_thermal_alarm_irq_thread,