Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp29950rwb; Mon, 26 Sep 2022 08:55:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IarWZneVhbwW7+42h3VGheN13jY1puz8FNQ1gr3Xdg4LyR1vNmLt2dDsRozbruurVA3Kd X-Received: by 2002:a05:6a00:d4b:b0:53f:4690:d31 with SMTP id n11-20020a056a000d4b00b0053f46900d31mr24410771pfv.73.1664207757153; Mon, 26 Sep 2022 08:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664207757; cv=none; d=google.com; s=arc-20160816; b=hs7Q5X/ETjBnz1aTKTu3/s0j7NO3WIaIKlUcLnfDd88HFN8Dx6+H8moEELhxfNqK7w FYOA+GS68uf6DnXy6RrAVAliwwwowDLtXhgNKhmUNciociSPMrem6Akrf0R2X7sCSw3X cIx/uwzHIZ6Mv5v8+YejoPz2c7aEVzkgauT9Ys+FQG5tu/Vv6Q6amgEgR81mutJ/m1jv W2/R4dCzcayq6txzLyTyZc+dXtqvDRfVhYBqdDlXlezSjgLWWN5B494Xoptoqms4V8kK 3EKxczvx/nYiQVaNeGlkBucb2PaySvkjFKC3R2SibIWQykAohwZyr8moYv6HkHrzKrYQ QGpw== 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=T35lN899Iz/pBm3wsfaSibpc4kphyH1ysK6DWhO4IsdqaBS5Gnhbajk2P1V78iLhcc Z0e9eV74VfYWclJMpjcpcCuHsb2XcVvGtN6I0gv8TrZCx/MU0Uhg49vLOfD9V+yeQwsb n2Wj7ludwd9p2xM62FO5mU70PdE4KyPPogKgS5PWNCJ/rIZ4Ey4bfa7MjFeoEa7D0k9V Io+5M/U3yyVnnhembYS0+lg0d54nwji2JrHbEfV2UAPBOvdl0p7ZT59a7WB0+xkYLQR6 9zMQRlomUZ5DD//HXweJsYjVuIbuGk5nuV+dZXGNZ2ljj2hOUJhGzsDQbFAsCIXlXSx+ R34Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fe8kj3lS; 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 m9-20020a056a00080900b0053e5ac66c3csi21747574pfk.38.2022.09.26.08.55.43; Mon, 26 Sep 2022 08:55:57 -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=Fe8kj3lS; 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 S236383AbiIZPVe (ORCPT + 99 others); Mon, 26 Sep 2022 11:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236156AbiIZPTs (ORCPT ); Mon, 26 Sep 2022 11:19:48 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96C09832E3 for ; Mon, 26 Sep 2022 07:06:55 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id l8so4591916wmi.2 for ; Mon, 26 Sep 2022 07:06:55 -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=Fe8kj3lSLJbpH2Bjue8Xpkt9j8RTQPfTKlf2Tav3s6oYchj4vsu6qnavhzm/mlzVJn xf6J4fINPX2xnNrEjEStWEkmiVNCpxyL8D9mT8w8q9dMRa9q6zQqWHUo90TAA1JSG0aU bRs9NY9+DbYR2OP8bmzVevSh1QTLN+vWx6uqNMSk9pNwa9O5QRsScX5/vc6wdr6bBdt3 jyl0LAyNPdqIaZf8XlYaCL1b6BAweLJhUf2E9Qx9UyuFuf7ZLB44cm8MzMNi3wdbnyGN /zQL0qnRSp83ZSag8Kw9u3Jbp52xi1ZY4G0+uHTU8WRzSzJgxnxo1+gNR0IGFO/GjtIO s0nQ== 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=J+kHMRATplk/Tcs/vzW5Ak8Nvftld0vcIZlHV090DQwogsxGK1ZNyE/OG6Ez1ShRYl pr42yk/J4uaPahxx7t1dKA2/ChDKkk0FnUrumstGGIhegDL+VbFXiowuokjz+mdX3eX4 oPqsIPUicspmgc+D2eDLNzXCy9E1GpOuvC7ciwn/86g6sMCeonqkgZpxaIb/9NImtvhX OQ6arb5qw/bZWUXpA8tmzlqsOjHbgMtLvqXiZDL++A6oryk6QQdQ8+tAsehnJW7aLvw0 PrV/ZcmQCmYQqaJl/Kt+0pOsXFjEXQKcbb+ebApk/2RLtIOXRHKDg4z0L394KFg+rL5g u2QA== X-Gm-Message-State: ACrzQf0h5MUXNAZpQj/FvgYKOPsnHz85mSpvUfFP/xpTAQUVWdfy+EgR TbZahZ60jII+rzoH59Nk7qYhXw== X-Received: by 2002:a05:600c:3c89:b0:3b5:e3:bd0f with SMTP id bg9-20020a05600c3c8900b003b500e3bd0fmr15668009wmb.199.1664201215081; Mon, 26 Sep 2022 07:06:55 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id v3-20020adfebc3000000b0022adf321d22sm14310731wrn.92.2022.09.26.07.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 07:06:54 -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, Adam Ward , Support Opensource , Amit Kucheria Subject: [PATCH v5 25/30] thermal/drivers/da9062: Use generic thermal_zone_get_trip() function Date: Mon, 26 Sep 2022 16:05:59 +0200 Message-Id: <20220926140604.4173723-26-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220926140604.4173723-1-daniel.lezcano@linaro.org> References: <20220926140604.4173723-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