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: 10613709 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31548112B for ; Tue, 25 Sep 2018 09:03:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2329E2908E for ; Tue, 25 Sep 2018 09:03:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1771F2931C; Tue, 25 Sep 2018 09:03:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B243F2908E for ; Tue, 25 Sep 2018 09:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728580AbeIYPKY (ORCPT ); Tue, 25 Sep 2018 11:10:24 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54173 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727678AbeIYPKY (ORCPT ); Tue, 25 Sep 2018 11:10:24 -0400 Received: by mail-wm1-f66.google.com with SMTP id b19-v6so12515691wme.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=o5qHGT5xvPgw7JafQoMgXOL28ZaGmSk+0y5dWD0unYUFJJpbDJgxQZD7Qkdv3aHYG0 dag3/TbdJkS/Ppu8icT6k/95XgWiUK+RHlxqMiObGKnZsFQvdDX0kL6mgeQLIDoca1U7 0E1O8ZOddI8CsPDhcP6cWhXK9agmLhmc87Qa4ysL4uCuKkyAgtxm10InxAydboUVu/RO Q1l43/TsEquJZ5YdYDphxx0oghGOvPU53AYdphSRvmz5bi8hFEUEIYYQCTNTPjpY1ZP9 2lacQORpAHyFC6aiBoD//jtXOMMCEPcZyhaxlhzMVXTD9QBOx6Nw2RayX2gomyTc+PYz 4d9g== X-Gm-Message-State: ABuFfoipFsfbfObcPM51FG5EOXhI2+bkwZgln+5W+bi734qk/QZ1tj+u FL74Z2zVNR/aF8OfXF9M86BgTg== X-Google-Smtp-Source: ACcGV63hg4yas5kJ0bADbIeAlHjupbj8mQHdod1EXaTVPHF6NcV4NRrB+/e4+/aCDSQzNkS6D+S2Iw== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);