Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1841544rwb; Fri, 5 Aug 2022 08:39:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5svZi0/37toUVLhHHzVv7AjIi9tqNLSIwj0S1rJzig/eBqBjCTnwt7yihRqrgd9tmjRC7r X-Received: by 2002:a63:e241:0:b0:41b:b374:caf8 with SMTP id y1-20020a63e241000000b0041bb374caf8mr6368010pgj.310.1659713948151; Fri, 05 Aug 2022 08:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659713948; cv=none; d=google.com; s=arc-20160816; b=ubnkyTk7vIpKQVV+jJWvIZGzz0Li9XhL2o5hpd6+QK9HhSMTKzGug4Eh3DTMoWP85V FHBfmK2fCc7X9l+yOCs7ypJxTIJHgeNkNHirrEE7WZ0yrSYhl2MlAT/ezq36E+05SbjB Ic/3Vzmr8ZxeFwoWqf/8QMu4V+ynounjS1sAyPzMECaXW1+ABvd44AiifcpkfeJUikZV Fqc+f/HQ9FYRagwmaEU1+g3MZ/jLUuxTo3s1HEtn9hV9kWFdILY0X63N+fsROoC7v6wZ WnRMTTEe4hHqqXzShE5C5pm5pFTuwuE0LH19sIoYxRGdrttSTq6SLAPPVtRXtboUAxpk HSag== 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=ArVwRUUAruWAOrQZrGLPNrMDc/juTBJqw8A6bHO0IRc=; b=vNfGwuesKNu8U6n8IXenLMKoZF1uXNfaSNHdhgviF8Q7oyujIyRdQuaqWLvQWnTH5D 8NeMPEyxzSo8NTaGEVfsVWJcI/EHQ+j3XHip3ZFuIl165B7QTMCwy3dpNs+HndykM9uS 6qwIuGWHbfj2Hy42FdIUDJ3QWpeHwbsS6yG84bwtoSypOQkFfAxSdKf12CHkU4tGFkBI ci6s3WSSvg2E7Ojxwdzd762ssgFa6tquWWzuXkQCZy7Gn8mNguUzxiJ/t+L8GmK/qF9h HfVmZWl2+0Cu1KUAoRRNsZHRYFtsJ/cRxOvKM1aJbyhQ4yLFGiRxHN0XvfJEXJO6pHEy gONQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=svz2u3WR; 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 h36-20020a631224000000b0041ca8856b79si3637653pgl.75.2022.08.05.08.38.53; Fri, 05 Aug 2022 08:39:08 -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=svz2u3WR; 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 S241050AbiHEO6Q (ORCPT + 99 others); Fri, 5 Aug 2022 10:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240996AbiHEO5w (ORCPT ); Fri, 5 Aug 2022 10:57:52 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3314861D70 for ; Fri, 5 Aug 2022 07:57:50 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id l4so3500013wrm.13 for ; Fri, 05 Aug 2022 07:57:50 -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; bh=ArVwRUUAruWAOrQZrGLPNrMDc/juTBJqw8A6bHO0IRc=; b=svz2u3WR78WYhhyAR/zyX7pyBfht1GKnAbOAU6/XcwL0S6ANFKgRQp4vFUwJQVUoFb LX2p2ZwR6WavpukNsEOP/ZxUoi2Bbi8I5BkK3OZ06jC5DoOM0fZIKTaiW6cifdSyoK7z T7Vky7X516qWF/Ls6OkrjsYDIjSJVEdpgrgZOho15rpHwcz651X8yzK0bItq9K6LqOYs VVOYp0JsxHxvgGKxmG6Ink9Pg5cdeGocyFiZIrGVKFfC0UIGJZo7hmb+JiImB/0/Jthy UTIA2P2e22QQJbmc6bsB/xDaakW8dAkLuZjB7S4Z6dtfZ3g1ODetr/SmtifkXvAaJLTm cTKg== 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; bh=ArVwRUUAruWAOrQZrGLPNrMDc/juTBJqw8A6bHO0IRc=; b=5zSX+QAZQeaDmrJJ2DybwzG1q0ltDkgKXE1bsibQ7nCgZlSLLNWmLrnXi3hyZsh/Ij Bv3O28bDPU+8pxXvLAtplxnNG/gD7ny/4J4KjUuy3T8jHEBztcOzKX1kYTlgKWJ8Wtup M0ycJDZlPXS4smK7BgGSVnPn66LIlrY5mVDy1G5hxE4hIQrkpu9X2bMY/Xz4vcuzEf4x jAmYBq8Z6ASNDTlKP16MFZobmfa0KEjCFyHJw1rk4kzoa/Ccng54aj5Ap8IZ4kdTwtD0 croFqtUWh16+79qz4NzcvJfYVKXwmfP1bIcDcLvU+Mf+hFZJJv1FCy58H10P7o9BThvH i9cg== X-Gm-Message-State: ACgBeo2QFYCymoawq+4N1zGprKeBsmMUUHIFvncimK10BC7RXirP6/R3 hmM+hx5cT97ezt5nC6DPVhbzBVFh5crAYA== X-Received: by 2002:a05:6000:120a:b0:21f:dfb:ff12 with SMTP id e10-20020a056000120a00b0021f0dfbff12mr4405609wrx.215.1659711468096; Fri, 05 Aug 2022 07:57:48 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:aef0:8606:da6b:79ef]) by smtp.gmail.com with ESMTPSA id y1-20020adfd081000000b0022159d92004sm3102448wrh.82.2022.08.05.07.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 07:57:47 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria Subject: [PATCH v1 04/26] thermal/drivers/st: Use generic trip points Date: Fri, 5 Aug 2022 16:57:07 +0200 Message-Id: <20220805145729.2491611-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220805145729.2491611-1-daniel.lezcano@linaro.org> References: <20220805145729.2491611-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,T_SCC_BODY_TEXT_LINE 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 to the generic trip points Signed-off-by: Daniel Lezcano --- drivers/thermal/st/st_thermal.c | 47 +++++---------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 1276b95604fe..c0d45cdd1c2f 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -134,48 +134,12 @@ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) return 0; } -static int st_thermal_get_trip_type(struct thermal_zone_device *th, - int trip, enum thermal_trip_type *type) -{ - struct st_thermal_sensor *sensor = th->devdata; - struct device *dev = sensor->dev; - - switch (trip) { - case 0: - *type = THERMAL_TRIP_CRITICAL; - break; - default: - dev_err(dev, "invalid trip point\n"); - return -EINVAL; - } - - return 0; -} - -static int st_thermal_get_trip_temp(struct thermal_zone_device *th, - int trip, int *temp) -{ - struct st_thermal_sensor *sensor = th->devdata; - struct device *dev = sensor->dev; - - switch (trip) { - case 0: - *temp = mcelsius(sensor->cdata->crit_temp); - break; - default: - dev_err(dev, "Invalid trip point\n"); - return -EINVAL; - } - - return 0; -} - static struct thermal_zone_device_ops st_tz_ops = { .get_temp = st_thermal_get_temp, - .get_trip_type = st_thermal_get_trip_type, - .get_trip_temp = st_thermal_get_trip_temp, }; +static struct thermal_trip trip; + int st_thermal_register(struct platform_device *pdev, const struct of_device_id *st_thermal_of_match) { @@ -238,9 +202,12 @@ int st_thermal_register(struct platform_device *pdev, polling_delay = sensor->ops->register_enable_irq ? 0 : 1000; + trip.temperature = sensor->cdata->crit_temp; + trip.type = THERMAL_TRIP_CRITICAL; + sensor->thermal_dev = - thermal_zone_device_register(dev_name(dev), 1, 0, sensor, - &st_tz_ops, NULL, 0, polling_delay); + thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, 0, sensor, + &st_tz_ops, NULL, 0, polling_delay); if (IS_ERR(sensor->thermal_dev)) { dev_err(dev, "failed to register thermal zone device\n"); ret = PTR_ERR(sensor->thermal_dev); -- 2.25.1