From patchwork Tue Feb 28 11:22:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13154748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12F43C64ED6 for ; Tue, 28 Feb 2023 11:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gNKZqTSfik6kbKLTg6DAWWxGUvdMh+G/qh4G7aDUg+w=; b=krh4izdmFBOoRAXyPY9frkDzVD hUIKiLOsEnqViEuFejGktU15CWJ2XQruoS2Nl0+SJEn3mXk+6e7QH1LL/Twz9QHUvcYEERT/nHqMP 4bf+kCi8pyNQC79elWP7W1s1nI5K6NkbrzczDKsiGWpFPlv6yMPoORtYlnY4c+28pdTESPfxySs3q vq2PjCrXJGVdeSrMqxVDGJqdlCroqboxTvGVJr57F41K+xeiAkMumadMyw+U2g9jEnR6DcD3eYsye 3fcqmXzlQa30mqM6yr3Sog5G7CBfS4Rcal6QhH0ebZhhSi6mjFhq3e5hxD9YGalbnoqZWo9WtG1vr 9KSOwsUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWy5W-00CxMD-Ec; Tue, 28 Feb 2023 11:24:06 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWy4v-00Cwqf-6V for linux-mediatek@lists.infradead.org; Tue, 28 Feb 2023 11:23:31 +0000 Received: by mail-wr1-x433.google.com with SMTP id r18so9356359wrx.1 for ; Tue, 28 Feb 2023 03:23:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583408; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gNKZqTSfik6kbKLTg6DAWWxGUvdMh+G/qh4G7aDUg+w=; b=wV/L9wxmkG0QFszeQY1rP/fmvWNtWBgOWQ20k9R2NIz3qAgL1Z4s5U/m2fUhZvZiJ2 LjJ+RiJ45DjHzwzE1kV7pc2FAdY2sC2YY9b4xzu8w/WOwX8vsh+e5Br7OcC/XiVBTiEq uTdyoRJq75pO8YU5osAVYSdkJzIBvJI2QJOclFm6K0nT9vCARArHdfhyAJ1o8dERlvn8 QSZ079y3ywulzSBvnFrMvkIKKPKiVZY5yq8KPPI0RzzdtyMbwFf9rFMCVMBVJrFsxwF4 C+3672ei+T1SK+whbLakvxiA9AR/QVGlhNMKoqGJ45lzPsGwnDt3op3yGk4bJZTWOPpK VFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583408; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gNKZqTSfik6kbKLTg6DAWWxGUvdMh+G/qh4G7aDUg+w=; b=uCUY0C+qxCIrJ8Qb2fobKWEakUb3ORCfb1WYOuzEfYjvv8lpO2cE8+nZWo0lG9CdDz wDJpyCt/D9PnKIdeqeF6uOZbftKyKm8IkbCspJgoAonsUZ5NaMREHO7PCDwJuSvEqEqj 7nK5SgNd7hcmezgnsuBOks/UgKoIdWTpAZhVsNK4e7S80j7sli79t5UvsPZVF5srfdv0 cTJ7cM78fcPR8MuKYinLyne6gx/QUH0Y4R2YtYjTKa6W4s3Pj216jbWRhPo1wjOC7qQH l+jpFEBPOomuOki/R5G6F2UBjO5v8bNsn2u6WCf93gayPnFy66oIuqDbtfBDwcM0BF47 WHYA== X-Gm-Message-State: AO0yUKWqResKUYy4nsoLDHUMThzaWEaWkbl68vu/erXFCV+0zW0t0ijy qNebDhy5iw/+ZOTQLW2bIcqqNw== X-Google-Smtp-Source: AK7set/frF01WULXg9I0nglY7Ek7yOFBLqMBxaJCvHt6wq+wuarFgVeWlk7YGgeHzmgRPlA1x4bEsw== X-Received: by 2002:a5d:4a44:0:b0:2c9:9b81:11de with SMTP id v4-20020a5d4a44000000b002c99b8111demr1679350wrs.20.1677583408590; Tue, 28 Feb 2023 03:23:28 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:28 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Balsam CHIHI , AngeloGioacchino Del Regno , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Eduardo Valentin , Keerthy , Matthias Brugger , Baolin Wang , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v4 09/19] thermal: Don't use 'device' internal thermal zone structure field Date: Tue, 28 Feb 2023 12:22:28 +0100 Message-Id: <20230228112238.2312273-10-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230228_032329_312391_89775B5C X-CRM114-Status: GOOD ( 15.64 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Some drivers are directly using the thermal zone's 'device' structure field. Use the driver device pointer instead of the thermal zone device when it is available. Remove the traces when they are duplicate with the traces in the core code. Signed-off-by: Daniel Lezcano Reviewed-by: Balsam CHIHI #Mediatek LVTS Reviewed-by: AngeloGioacchino Del Regno #MediaTek LVTS --- drivers/thermal/imx_thermal.c | 37 ++++--------------- drivers/thermal/mediatek/lvts_thermal.c | 4 +- drivers/thermal/thermal_hwmon.c | 4 +- .../ti-soc-thermal/ti-thermal-common.c | 2 +- 4 files changed, 13 insertions(+), 34 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a0b8de269986..c3136978adee 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -285,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp) if (data->alarm_temp == trips[IMX_TRIP_CRITICAL].temperature && *temp < trips[IMX_TRIP_PASSIVE].temperature) { imx_set_alarm_temp(data, trips[IMX_TRIP_PASSIVE].temperature); - dev_dbg(&tz->device, "thermal alarm off: T < %d\n", + dev_dbg(data->dev, "thermal alarm off: T < %d\n", data->alarm_temp / 1000); } } if (*temp != data->last_temp) { - dev_dbg(&tz->device, "millicelsius: %d\n", *temp); + dev_dbg(data->dev, "millicelsius: %d\n", *temp); data->last_temp = *temp; } @@ -367,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, static int imx_bind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, - THERMAL_NO_LIMIT, - THERMAL_NO_LIMIT, - THERMAL_WEIGHT_DEFAULT); - if (ret) { - dev_err(&tz->device, - "binding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); - return ret; - } - - return 0; + return thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, + THERMAL_NO_LIMIT, + THERMAL_NO_LIMIT, + THERMAL_WEIGHT_DEFAULT); } static int imx_unbind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); - if (ret) { - dev_err(&tz->device, - "unbinding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); - return ret; - } - - return 0; + return thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); } static struct thermal_zone_device_ops imx_tz_ops = { @@ -558,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev) { struct imx_thermal_data *data = dev; - dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n", - data->alarm_temp / 1000); + dev_dbg(data->dev, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000); thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED); diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index fb4b1b4db245..beb835d644e2 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -305,7 +305,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * 14-0 : Raw temperature for threshold */ if (low != -INT_MAX) { - dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", low); + pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, low); writel(raw_low, LVTS_H2NTHRE(base)); } @@ -318,7 +318,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * * 14-0 : Raw temperature for threshold */ - dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", high); + pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, high); writel(raw_high, LVTS_HTHRE(base)); return 0; diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 964db7941e31..bc02095b314c 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -228,14 +228,14 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) hwmon = thermal_hwmon_lookup_by_type(tz); if (unlikely(!hwmon)) { /* Should never happen... */ - dev_dbg(&tz->device, "hwmon device lookup failed!\n"); + dev_dbg(hwmon->device, "hwmon device lookup failed!\n"); return; } temp = thermal_hwmon_lookup_temp(hwmon, tz); if (unlikely(!temp)) { /* Should never happen... */ - dev_dbg(&tz->device, "temperature input lookup failed!\n"); + dev_dbg(hwmon->device, "temperature input lookup failed!\n"); return; } diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 216b29068b08..060f46cea5ff 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -43,7 +43,7 @@ static void ti_thermal_work(struct work_struct *work) thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); - dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n", + dev_dbg(data->bgp->dev, "updated thermal zone %s\n", data->ti_thermal->type); }