From patchwork Tue Sep 25 09:03:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 147408 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp472230lji; Tue, 25 Sep 2018 02:03:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV62tewwbjdTiWv3u98QOrqos4jvERga7tK1LD77HVLpryrOZocZrAF08zPL5BPHgn3KEYklW X-Received: by 2002:a63:4950:: with SMTP id y16-v6mr111308pgk.32.1537866234756; Tue, 25 Sep 2018 02:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537866234; cv=none; d=google.com; s=arc-20160816; b=xg8vm0pEfuhPCNnfSnrammvy2hWODr/qwE/m24r7t2wqKB6la8XGFmLPP1d/pJccbE ARLst1cgoMNmrWyaN358wGeAZoLSXrc5RBG7yW0MjfpfnzYOnM8OLeqr48pla8CJSkjl P6v7meKpRNgeLSxTCbexFA6zzUUE7jj8BotFLS7iu13ZUN4eJCPwS8h93E6XnskRIufB DGFXNNCJHYR/xo81sOaSO1HprF8XJDHOfkBc6Fg9AIzZNdaFfqp2X61mODoSIJSmWedz KtkZaH6qlCJosPDyQwzQiy2YbFlHqDx3yzsw39fVo0rStwUL4hAwVQ60j6XlOkY/++2i RhKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HwYZFcnFZ79mwFslZ96x0gM5YC++omWUey3iWIx22vk=; b=PjO9Nc1cEVHOvlcSG7QymDFkPhTzcHoVulxPlia35lVopnlmr09VjSb/xRMBQTVFMG XlBsNQehqxj6oe9vOxD39crnbrrIeRY+Oi57s2/tz89BpDGSWg+0IEZW5aC65No84tVG kfBUh9mCsMRsqUFITcGbiOM3bO2W95telh/J1loTSZicoJ6P5r4dw97p3VZBxuqTT9B8 eZxsqGbJxspZPs7m2knM1ah3K3s42Ehlho9nRQ4DWsV0rt0bvsoaycykWzTylnkoeQgQ jQ3qtjY9Tu5AAAzkJEZ+uZpzPH3oTUBvzCc03QXO5pHaA89oVTWL+PXEad+E9Pjc8672 FsLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZC9Ti9Kh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb8-v6si1602909plb.178.2018.09.25.02.03.53; Tue, 25 Sep 2018 02:03:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZC9Ti9Kh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728652AbeIYPKY (ORCPT + 32 others); Tue, 25 Sep 2018 11:10:24 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54174 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728580AbeIYPKX (ORCPT ); Tue, 25 Sep 2018 11:10:23 -0400 Received: by mail-wm1-f67.google.com with SMTP id b19-v6so12515693wme.3 for ; Tue, 25 Sep 2018 02:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HwYZFcnFZ79mwFslZ96x0gM5YC++omWUey3iWIx22vk=; b=ZC9Ti9KhOgRCMuao2UPV1SrhW3WxdLEqc3hqIXa9RS5QGznBokFYD8lvQLEELTz0gs GjJ3B2Z8QwPivFTCfPGj2YY0Ep1gT1MW+JftbeFy9zVidQbPIvUkKZX0kkJx0n45gTnJ 4I4UIcTGjhDE8IO12oWJ5XjdJeiTWbGp7TXcE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HwYZFcnFZ79mwFslZ96x0gM5YC++omWUey3iWIx22vk=; b=j6T4328sG0EM02LKUb1geVlCfuaVugxIFlaBGY7f7bNLgW5u4GaCGrKBBhh53pvuZz HabPr2EeVyZy7nEAZQuOFzT9u5r6ZOIop+WvtgIhhNt//X9dqo7+PwkQVrifUUnaJy1E fltDLXlEDDI7wmWsTu0dotTaC/ao8kFJ3V5F4LqkE25v/Aa0PHteQxEbuzo7TH9C4Rdf nckY5wi7EgEEOQQ8JDQ964FDTVQ5NtGfQAz3WBD1cn0+TBtD5Euud8OB/lZL+ggmHQyX T3FsiesEkzHbfUH3KywSwuW9w0XW/UWxK/mAto1tnBCQmZ3HcHnQOEFMkv4zBs/YgXmv PXEQ== X-Gm-Message-State: ABuFfojLLek55CB+eWkhKbflJzp4eHrleAjlg8pC8TIz7WoevZ2Hqfip eVvduVwmn1wOCyC19Yf9tqILM+b20+w= X-Received: by 2002:a1c:9355:: with SMTP id v82-v6mr60555wmd.128.1537866229953; Tue, 25 Sep 2018 02:03:49 -0700 (PDT) Received: from localhost.localdomain (251.150.136.77.rev.sfr.net. [77.136.150.251]) by smtp.gmail.com with ESMTPSA id y206-v6sm1523828wmg.14.2018.09.25.02.03.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 02:03:47 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, leo.yan@linaro.org, Zhang Rui Subject: [PATCH 03/14] thermal/drivers/hisi: Set the thermal zone private data to the sensor pointer Date: Tue, 25 Sep 2018 11:03:01 +0200 Message-Id: <1537866192-12320-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> References: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Store the sensor pointer in the thermal zone private data and use it in the callback functions. That allows to continue the conversion to sensor oriented code where the pointers are the sensors. Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 1fdda55..567fde6 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -442,8 +442,8 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) static int hisi_thermal_get_temp(void *__data, int *temp) { - struct hisi_thermal_data *data = __data; - struct hisi_thermal_sensor *sensor = &data->sensor; + struct hisi_thermal_sensor *sensor = __data; + struct hisi_thermal_data *data = sensor->data; *temp = data->ops->get_temp(sensor); @@ -465,7 +465,7 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int irq, void *dev) data->ops->irq_handler(sensor); - hisi_thermal_get_temp(data, &temp); + hisi_thermal_get_temp(sensor, &temp); if (temp >= sensor->thres_temp) { dev_crit(&data->pdev->dev, "THERMAL ALARM: %d > %d\n", @@ -486,11 +486,10 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, struct hisi_thermal_sensor *sensor) { int ret, i; - struct hisi_thermal_data *data = sensor->data; const struct thermal_trip *trip; sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->id, data, + sensor->id, sensor, &hisi_of_thermal_ops); if (IS_ERR(sensor->tzd)) { ret = PTR_ERR(sensor->tzd);