Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1174871rwb; Wed, 28 Sep 2022 14:26:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7SI/dLq1c99HuDsX8OYd3pvnZj+OA6/cLkKusO+2ka6eca7XwtIJW6P1rxC/wcCe5yIu86 X-Received: by 2002:a17:906:8463:b0:771:a3d2:7c3 with SMTP id hx3-20020a170906846300b00771a3d207c3mr27902372ejc.592.1664400375467; Wed, 28 Sep 2022 14:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664400375; cv=none; d=google.com; s=arc-20160816; b=x5fiPm7cYsDrxn2GjnoKiaVddjWGGVLs1ceTIoKdHpSf8J23q19yE4tblI6mjWGX+H oTZ15WwIjs/KXIwRZKFfLLc1m+kveJ7NouwIX5AzLprUW5bGJCRNy06Z9zi9fpGnqdi6 4+c1eVTEUt2DEtgLzfewx+heC8PDHZ/6hMWAF/z54jPEj+vL9JYbQFu1+1/KNK2CHBfp NT821xRQEyzSiKyFtCpG1Wqs/4IctYcQLViGQLtdyaSFJHDqXJMNAdMV9LZJPviL9OnH bcbZ9LcK5oFC9nfZZTJ6++cadGDo40wt5OiLcLl9Q/qdnmtzOQhulg2GtE4e9Q1QPzAP 5oCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kNTESOeVOVH9BHNMsa7BlHA2jeppHM3L2UNE800z/X4=; b=wgnRdYvPccMCEqEcHOAcaVUc9cAe+31aMiSZeznqUYbx83jQrx/30jGH6hJ40mvxS1 pfS1/AfiW90sbec1U5MTzQ5h9WnmLsZVLj3tQS9iqqOxENeeIxBJtEA3vfXjfxBVkMyT PqXOjXJRT/GGqsxT4l9TzHX6cSaoMs7cdURht4s9yX+DIjLtgvsYYREIT6P3KnDfo7TW VVyNBKV9AmZ10WoXGwDMO4rgv/W+HadxirawrOxlrpzzRNK9614HQ6pEwGSnHdQhr/Aj QnRsbxkvVrNKy2cHwIjkdDQkpIZq/7Y7GzG1RkmB/9Hd0RbPAKwszzQUN2SRIiZR6g+q aKVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=APVn4dXm; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020a50a68d000000b00453aa9656a3si5782081edc.466.2022.09.28.14.25.46; Wed, 28 Sep 2022 14:26:15 -0700 (PDT) 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=APVn4dXm; 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 S234718AbiI1VHM (ORCPT + 99 others); Wed, 28 Sep 2022 17:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbiI1VF6 (ORCPT ); Wed, 28 Sep 2022 17:05:58 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E20C4CDCD3 for ; Wed, 28 Sep 2022 14:02:28 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id ay36so9282084wmb.0 for ; Wed, 28 Sep 2022 14:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=kNTESOeVOVH9BHNMsa7BlHA2jeppHM3L2UNE800z/X4=; b=APVn4dXmHh0VL1bYW0D8A0gkQIgbVZICxuf7zzjzrolMiRMMu1FBMa0zeIuO6UTHvj iDBC7Au7/0lgy2BU7kDN33qQdY3BZq/D1lBjOVruEZfHF1kwqqFOE0TzUYsnubOZhXzX jB4N6CzVmqPpUMFPKiHFYd50lLXSIydlc+XNsES2DLp4Q+rGXylW0dVmcMISb6xbkl5t 3B6Pzk/499Yt++NyBHtCQfjS7fEiA1PTkPi//X8SL84EBgxC56M8yvygFFYWWClf03Cr gKcxVrwZwh9tZ09C8OxprnzQERe9UDWzhIvEvatFyLQfuA0qytpgTyA7KBQYxE0jKnDL lt5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=kNTESOeVOVH9BHNMsa7BlHA2jeppHM3L2UNE800z/X4=; b=oB0ozAOFuwHYScDk8o8FSY5QXfyHz6JrfjeUZ/hriOhaUVY3rc9JWfng11mU8l08LG eUa5Z3Wtg6cJIv/bhiYbXIYMlufn7swOmRlVk8ZUJ/v+Q69vm4eR1vD/+jvyy4yZ9Fce 9qvjFCc2wEX1gUVX53VfzW34yRzbmeivMaTM0+8wJPPN2UMcFPmqVIecZJYyqHm8o+cf ChJk5ho+YPfCN+xhBipZ9bDbntg13uVL84zsooru+6gBlfVoqr2gE8EiCkk6d76a9PwO EmFjzP36OczVVQJsdcgeXw0ZbuRctBL8hvCSWAxEQdWmI9HvhO5W+/VRm1O2eHgfK7SC Zseg== X-Gm-Message-State: ACrzQf12p7b4LU47LDDsrouuidzURmm3nBKTv8jK7g6VTtFyykJyRZ+H lteL3DNLyHxvq8Rqxt7e/WJ7TQ== X-Received: by 2002:a05:600c:34c2:b0:3b4:76f2:9c3b with SMTP id d2-20020a05600c34c200b003b476f29c3bmr8105576wmq.179.1664398948318; Wed, 28 Sep 2022 14:02:28 -0700 (PDT) Received: from mai.. ([2a05:6e02:1041:c10:48a2:39eb:9d1b:8b8d]) by smtp.gmail.com with ESMTPSA id g20-20020a05600c4ed400b003b4931eb435sm2874300wmq.26.2022.09.28.14.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 14:02:27 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rui.zhang@intel.com, Raju Rangoju , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Peter Kaestle , Hans de Goede , Mark Gross , Miquel Raynal , Amit Kucheria , Nicolas Saenz Julienne , Broadcom Kernel Team , Florian Fainelli , Ray Jui , Scott Branden , Support Opensource , Lukasz Luba , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thara Gopinath , Andy Gross , Bjorn Andersson , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , Eduardo Valentin , Keerthy , Kunihiko Hayashi , Masami Hiramatsu , Antoine Tenart , Srinivas Pandruvada , Dmitry Osipenko , netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, Adam Ward Subject: [PATCH v7 24/29] thermal/drivers/da9062: Use generic thermal_zone_get_trip() function Date: Wed, 28 Sep 2022 23:00:54 +0200 Message-Id: <20220928210059.891387-25-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220928210059.891387-1-daniel.lezcano@linaro.org> References: <20220928210059.891387-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 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 The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by: Daniel Lezcano Reviewed-by: Adam Ward --- drivers/thermal/da9062-thermal.c | 52 +++++--------------------------- 1 file changed, 8 insertions(+), 44 deletions(-) diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index 180edec34e07..1e163e90d6b6 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -120,44 +120,6 @@ static irqreturn_t da9062_thermal_irq_handler(int irq, void *data) return IRQ_HANDLED; } -static int da9062_thermal_get_trip_type(struct thermal_zone_device *z, - int trip, - enum thermal_trip_type *type) -{ - struct da9062_thermal *thermal = z->devdata; - - switch (trip) { - case 0: - *type = THERMAL_TRIP_HOT; - break; - default: - dev_err(thermal->dev, - "Driver does not support more than 1 trip-wire\n"); - return -EINVAL; - } - - return 0; -} - -static int da9062_thermal_get_trip_temp(struct thermal_zone_device *z, - int trip, - int *temp) -{ - struct da9062_thermal *thermal = z->devdata; - - switch (trip) { - case 0: - *temp = DA9062_MILLI_CELSIUS(125); - break; - default: - dev_err(thermal->dev, - "Driver does not support more than 1 trip-wire\n"); - return -EINVAL; - } - - return 0; -} - static int da9062_thermal_get_temp(struct thermal_zone_device *z, int *temp) { @@ -172,8 +134,10 @@ static int da9062_thermal_get_temp(struct thermal_zone_device *z, static struct thermal_zone_device_ops da9062_thermal_ops = { .get_temp = da9062_thermal_get_temp, - .get_trip_type = da9062_thermal_get_trip_type, - .get_trip_temp = da9062_thermal_get_trip_temp, +}; + +static struct thermal_trip trips[] = { + { .temperature = DA9062_MILLI_CELSIUS(125), .type = THERMAL_TRIP_HOT }, }; static const struct da9062_thermal_config da9062_config = { @@ -228,10 +192,10 @@ static int da9062_thermal_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on); mutex_init(&thermal->lock); - thermal->zone = thermal_zone_device_register(thermal->config->name, - 1, 0, thermal, - &da9062_thermal_ops, NULL, pp_tmp, - 0); + thermal->zone = thermal_zone_device_register_with_trips(thermal->config->name, + trips, ARRAY_SIZE(trips), 0, thermal, + &da9062_thermal_ops, NULL, pp_tmp, + 0); if (IS_ERR(thermal->zone)) { dev_err(&pdev->dev, "Cannot register thermal zone device\n"); ret = PTR_ERR(thermal->zone); -- 2.34.1