From patchwork Tue Jan 24 19:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 47878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2347399wrn; Tue, 24 Jan 2023 12:02:58 -0800 (PST) X-Google-Smtp-Source: AK7set9yMoQgYv0/Lv0a7Uucc20Yla6aKI+sDqGKRUiLDS3d9WPF/yVaYyph4IdJieJcxGdYexlP X-Received: by 2002:a17:90b:164a:b0:22b:f0b8:5862 with SMTP id il10-20020a17090b164a00b0022bf0b85862mr3136661pjb.38.1674590577560; Tue, 24 Jan 2023 12:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674590577; cv=none; d=google.com; s=arc-20160816; b=DDhqHuulkrlKsgk48nKmx1znhjIwmHTVC/Ov/6APeDGn8bQ8I+VpWdeSh6LkNbKZ+O GEQRz5DE1uVz7OTXihucRe9fz1LjWFJ0UywytvK8glEBz8rflQjt+TrlXNC4O8czZ2Y1 rRHrNmIHp0V38d5PQnKP6EmBLL0iSQjhZx5R5SxhI6LJ+GnMFRDf7jayLvbD7UU5tce7 mT5yOAJy2ig/mciccpNOqfFVplfaV9eHJAlJpT7fUm+d6T9E53PcGB2xHDMLVrTqQInQ 20PNGgxaCWzUBtYDUe3M9ZdJv8Xhb3aBhtGgTEgO6MiNoWUj0WAtMQelDBmDZPUDCnmF wbRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:subject:from:to :content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=uB9I+/Tk9kHQT8QPiB3II5sGODvwetZQhB7HX9QWOdE=; b=0Q1zc1a+tu5iyyXg8t5z4Xt8ghmYlVjG2OsggpRToLCH4daUGVwdmaLgOtfKaZHSvN WcYMWp3UJmxAQxRDrUQxcKVHxswuf9H1TQy/nuG47PGwOoDqx0BJEuj3/eL8g7aI0wMe irqRiI7Yza0LEKKlvP65kQzepTafQ+cskwo3G/+3pP9W2BzPF/GkpF633rQp9UR7QpwZ /JqEpwc5QdEjg0ZuZEwkBZOlFd22erbT7K/SvMWRNwg0+cQ4cqQJZn8/n5vMwU6bOqN7 0dcPyDmtX/iQvR5RRShvHx5k3D3ZRsT470JXNSgfcjnXpgpF32ZrxAHVezmBVnMMyRuP ukHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YiZbCsTk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a17090aca9700b0022955e2f7ccsi3266233pjt.21.2023.01.24.12.02.44; Tue, 24 Jan 2023 12:02:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YiZbCsTk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233586AbjAXT5a (ORCPT + 99 others); Tue, 24 Jan 2023 14:57:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233568AbjAXT53 (ORCPT ); Tue, 24 Jan 2023 14:57:29 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E25546D73 for ; Tue, 24 Jan 2023 11:57:26 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id b7so15010771wrt.3 for ; Tue, 24 Jan 2023 11:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:cc:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=uB9I+/Tk9kHQT8QPiB3II5sGODvwetZQhB7HX9QWOdE=; b=YiZbCsTkWX7qaBcx9slMjH6+effXtwjymWr3GN8IP7nGKDffEFwF+GniYQJGxRDdij ddxnoXiPHLtD1J2xu06stt50XG7TMZHlU4vUx1FUq5u1vVJ1iFg138K5ObVFl5VqTbij vgJu63fNHqpEAcA70RBCp7uEoqgSo8vC4mMsXr1eFSwwyt5n7FebqWFUxG22D15WSOLx rr65vwxKSRjpn0Q/Phw+MaIIrh5QNbS8PF3uygWX27Z16dxkYQc/uZt6NRcmIevTJ0To TDTM2yGHMo7TX+Uiq+7ajTJHTvsLOzLdPh7rrhMVO04WMLFrxkUZDic+0tnVmERM7//X EyTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=uB9I+/Tk9kHQT8QPiB3II5sGODvwetZQhB7HX9QWOdE=; b=sOpCmWvHARc2JMTReTPpAUTkT7txrNbswpFHtIS8BKcnlynRuyEdgmB7rfeL7A5Pia ZlGveL+BWYUmah4WVyg18tnsLQLJFDjKuEvRoNjuiLyHSaxeu8gKfqp+6VfXsfYCjx5L a6rn3LIOhGoua/osi3CW1hu0FMoCqt4aBXUJEmvf1d6F526PuJZdQLlyx7/tV1zm3zSc HFiJkUQ19SJPDVHiX+6F/w3FtiSWknaYA1kFFrHjAl6/Wh14pCPl+97HeM1/9T8NAEe1 gbVpbySJVfNQXgjorkXgYerGKJzxFXdqxxic8Qjh2ZRIMIYhc6FGdS5QgnrHfhThQDvb pfpg== X-Gm-Message-State: AFqh2kpgdkpaRCGUFaI5hSRn3Q26zr/Xm3Ad8O+witVPlIFriurC4NAG dT614Hvob10aWx0GKBj8W/mJhw== X-Received: by 2002:a5d:404c:0:b0:2be:1258:897d with SMTP id w12-20020a5d404c000000b002be1258897dmr25315390wrp.43.1674590245043; Tue, 24 Jan 2023 11:57:25 -0800 (PST) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id q3-20020adff943000000b002bfae43109fsm2473693wrr.93.2023.01.24.11.57.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Jan 2023 11:57:24 -0800 (PST) Message-ID: Date: Tue, 24 Jan 2023 20:57:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US To: Thierry Reding , Wei Ni From: Daniel Lezcano Subject: thermal/drivers/tegra: Getting rid of the get_thermal_instance() usage Cc: "Rafael J. Wysocki" , Jon Hunter , Johan Hovold , Philipp Zabel , Linux Kernel Mailing List , "linux-tegra@vger.kernel.org" , Linux PM mailing list X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755935489063036027?= X-GMAIL-MSGID: =?utf-8?q?1755935489063036027?= Hi, does anyone know what is the purpose of the get_thermal_instance() usage in this code: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/drivers/thermal/tegra/soctherm.c?h=thermal/linux-next#n623 The driver is using a function which is reserved for the thermal core. It should not. Is the following change ok ? return throttrip_program(dev, sg, stc, temp); @@ -768,9 +767,9 @@ static int tegra_soctherm_set_hwtrips(struct device *dev, continue; cdev = ts->throt_cfgs[i].cdev; - if (get_thermal_instance(tz, cdev, trip)) - stc = find_throttle_cfg_by_name(ts, cdev->type); - else + + stc = find_throttle_cfg_by_name(ts, cdev->type); + if (!stc) continue; ret = throttrip_program(dev, sg, stc, temperature); diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index 220873298d77..5f552402d987 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -620,9 +620,8 @@ static int tegra_thermctl_set_trip_temp(struct thermal_zone_device *tz, int trip continue; cdev = ts->throt_cfgs[i].cdev; - if (get_thermal_instance(tz, cdev, trip_id)) - stc = find_throttle_cfg_by_name(ts, cdev->type); - else + stc = find_throttle_cfg_by_name(ts, cdev->type); + if (!stc) continue;