Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2821206imu; Thu, 29 Nov 2018 10:45:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/X95rQ4yCuj3nB69uG/yNasKRD8aXo+za4tppX9YpQTG6DJHyxGHEmijHYflPK/fCvCUnS4 X-Received: by 2002:a62:19d5:: with SMTP id 204mr2493502pfz.33.1543517146934; Thu, 29 Nov 2018 10:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543517146; cv=none; d=google.com; s=arc-20160816; b=nCmo5J5Ax9hfG1fGYKt7XzBwBjAa0Zl33jkg353N6/fA2br7UTsXtIkx9kn0PEZQ9o yIzOTDpsE8uauyUszCH9hDMIzSBmJXr0KoxGDdDEibB8I0horGFjCprdfEom97QgOzXk v6VIyJzOLome8Z/KPedGoSOO0+1aECJSeRzpdPmtekM1SuuZS2MsdP1lYw8gbF1Vbhl5 Q/o+uBBkFY4jIbHSfn+JIMXtX6yLytY3LFbrDriOQPZzcVg4BZ4/zHpQT5xu4SH9c5+t AFMHYGsAMRcEtGuXCWR4/GP5p18Dmb3oP7jBWU2W+EHE54jPpJMrx6UnuOq5IhRYu5OX TsZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=ZTpH/PWWAjrgAf66IMtXg3FL+HSUGQrMTer36R8djEg=; b=VAKu3sEgtIMJFcDgacv75FjJBzQvKFmEmKBUsXH9h7pHGB0At0zVVGOouK8A5M1uWw RtnKZFQy7xR9ZTS5Xlm8pAJD3GGF3mFjUAd2/QdLS7mLgfOVDJ5z0z4oDYGzyuu83t8S bsnX6cN4hI/jnBS8/T7ct8BeihKJbuDfyHG2wa7i+Sz67x/GlB12HfW5tbkekgUpTvf/ U4cUZlUbw6gJ3kkdBdQCywsCbEg7NR5R60oYtr+N5x3hqYfBPYf3P1K7fBijd/gA7BZV buJ9C24i3M5Ay2seFPv/A0Abe6NGRGZYp8EksYeQJHSfUTp5dhn9jcnIEl+XJWx9WaPC gslw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TFdfcl9f; 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 c37si2589691pgm.156.2018.11.29.10.45.32; Thu, 29 Nov 2018 10:45:46 -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=TFdfcl9f; 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 S1728397AbeK3Fdd (ORCPT + 99 others); Fri, 30 Nov 2018 00:33:33 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37241 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbeK3Fdc (ORCPT ); Fri, 30 Nov 2018 00:33:32 -0500 Received: by mail-wm1-f67.google.com with SMTP id g67so3249723wmd.2 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=VhvAGS5au25uI84kT1VhAlVqynxAoCyvqK6rYyW86/Q58KCBVzkfIar0lncfiVAj1k skor9CRP2X06df3vAo/9YxnOK9NlVkZ95q6t4WryHQHgxzyCuP3tVn7JStez8epYgEHw 01i+qtm9CGDfJ2fDDSWEcUz+FU68pdA0MK9IbKDJqfR5rLr3ZWKD73bOzFGuztVKbjK+ SWW+GH+rgvM0+cMX41jlMwR8yPnCmf1UwgryqXfFEKlH/bhmWXf2YD++nJBjf2l2vu4X ahQpyligzm/ehjSOZ8/HRIDH259765wrCUu+n4J4yF/RxgIfNqPLjWuEhizWmOjUF4ta CzDw== X-Gm-Message-State: AA+aEWZ2gjo6e9QuwIJS1YiMFw6GkBDVoqDZLkvn63DyF7e/hbUYa6Ra EPAFJGr0K5qMP76N/11eoOeRmA== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- 2.7.4