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: 152454 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2713469ljp; Thu, 29 Nov 2018 10:27:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/X9ZcoAdZfT63SIctN6jAZkLm5odKIfGH7o6oVXLAKbR6r6QldlDvaH2diD51cRRC/TvE1q X-Received: by 2002:a17:902:2ec1:: with SMTP id r59-v6mr2522370plb.61.1543516038561; Thu, 29 Nov 2018 10:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543516038; cv=none; d=google.com; s=arc-20160816; b=cm6jo1067VEPdPYO67XRasju8oHAg9DTtTAEW5PKWmazjaloac4ax3SGUOti03eeOH XqqHsL8v4/3yOu0nIhIn0j2JEwz3blPSo+t88gck6qFBEchDHA78Y/ARMcu5ubY/G0Vd yKZrMvOTjmnweO23i8lhu3l2W2h08o9TaKSfUj+v5RB7SuqF35ZkynEoWR7ReX2wPon1 gerKAzsErcrLMDwqDQGAMQJhGekPjXU1LWPmW7ylqRe85TUHLs824p1l6ODXMdNry49X 3NZNywHyrgnLQTggwkdDR01fY3JnwM6fP2e2Drs9l0v9HXkErHwEn6aRhJ+OmGDv4TaD r8RQ== 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 o8si2566926plk.28.2018.11.29.10.27.18; Thu, 29 Nov 2018 10:27:18 -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 S1728410AbeK3Fdd (ORCPT + 32 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(-) -- 2.7.4 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,