From patchwork Wed Jul 17 06:32:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 169104 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp545541ilk; Tue, 16 Jul 2019 23:34:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyABryZKerBlNNCzBxIWUTp/zELFmKXC7a7zDCZD7/zdZOdn3vNtOdj+tsilcuNQMu2JuIJ X-Received: by 2002:a63:608c:: with SMTP id u134mr37791240pgb.274.1563345273566; Tue, 16 Jul 2019 23:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563345273; cv=none; d=google.com; s=arc-20160816; b=S+0lfbcQzKhL08YCCZO+1DVVkQTNJ76CpinhkzQM9MJJH/SLxWD43wUWu5wW8xmGth IGO43yEh4ivsp9r/EfGm7vqxR/vlF41BEd1mZf+UzIYATPTdBh/W6A/kbtHK5vNdwXwZ 5p7sLm4lBDrreGMt6dxAUDrqh3FVCOFF74x5l0R8CsFfvmuOQA3AKOxuRtqCpX3OsNBW H/FhSlwp00yqQ6ApfjH3FIw3D1XJa9/C8iTf/+Z6w+zGx6Qsn9tzr+3oNyZD4FNaBHNJ bTuNfhQtW7qRt7izrowz0ABHavNxr/tUbjQUhhXAI+0iCgOCRWDUqYkVE1pfmB89Zzyz nczw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rdTuAwcR0u0VlWAQfuFI6gqYTICpVN50inAUBoWJs68=; b=JIWHGLjiGbWuR/0EA4FcZ+o7pVLViHepPJGtZUF332N4gHRcBqLFEts5V1szDKj+aY 9yjWb4d76aDpws67pjta1ZtSZVdKHlQCB9NOP/uBn79sWlw+p28x9HcRnDKMfY8znIMJ JJFM4u+7IGe+4M7BGTEYiPoH0xKde+tU16X30T1jTDff/3tfk7MaiAiGUtRedHoovyc/ f8vC1gzX97w1eqEXEPQ4+XKotUxDqN32IHTraWxuzp5XUhahKP5ikVfCeLBUlY+ZV93v w3VcAUtYJCSZP8VvrMyhdjUyG2of/jVHz+/Iaz+GyrrT+U5OjlwTASh7n9SxcKnsxggk TmWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t6c8a36Q; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 v1si22124171pjn.79.2019.07.16.23.34.33; Tue, 16 Jul 2019 23:34:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=t6c8a36Q; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1725992AbfGQGec (ORCPT + 11 others); Wed, 17 Jul 2019 02:34:32 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45856 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbfGQGec (ORCPT ); Wed, 17 Jul 2019 02:34:32 -0400 Received: by mail-lj1-f195.google.com with SMTP id m23so22371614lje.12 for ; Tue, 16 Jul 2019 23:34:30 -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:mime-version :content-transfer-encoding; bh=rdTuAwcR0u0VlWAQfuFI6gqYTICpVN50inAUBoWJs68=; b=t6c8a36Q2Ba+G930npkP6KlAS1fHxoQy3qlfmFzOx2BpouOAwM/BIh6c+YH/LYD0zd oMccTQGiIanWYORFTXUlRKHQKmYImqZWcsSVcxYBeMg4MPzSeF0yF8j0TeykS8pFn0zQ VJqejOhWjQfF2Llj8jB50THjsZeZ9g8OYJDrjuoZydM4PipKwrl1AYICZFeKjaeXF8ZC QrZPC9WFcAcZBmqx717R2WcbzimVdABK22JLakj21sk7335yEKlhLInNcoxqMmVShMP0 QgSsAICHoN3bK1M0otupn0R1gFcBQgsrEkYo/pyNIuB5SlzkPumSbs91A86e3IsTE+m1 +9NQ== 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:mime-version :content-transfer-encoding; bh=rdTuAwcR0u0VlWAQfuFI6gqYTICpVN50inAUBoWJs68=; b=VM98CydZT6Gx2hm4+2FnICY4FLmTxP+RRZf/hs8lkLHHQcts/pqlbOskxDgmXNvRZE 5MQbsJw4Vxx+kw8tzO5aC0lVWpeeX/MYjNiVdVYOY6YJHDVrTcwVMfb9MW4ROrTv3KNG WmSK3Gx86zhhxwHGQOoGPDTSV7/dU7AF4ugJmbQqKkj7Bgrvz651wXgW/eCRsYVm4cmr 7Ym1UMzPn0VzxbP3bx7jjdKZ66OJSh5eZKj9HVjvQy8zubGGAcQlBM1ifiAGIFX2w8tW QQFoeUVH4xNYV+rSzzTlUJrIp6/V4uG5Cq+YMM/hc8Jv0Z0Cz32lEoiKKG+N9pR30TMM mCJA== X-Gm-Message-State: APjAAAWOJGEAkfgzlG5Ltz8tOA+TGWTPQOVLi4xQ9z0BO5SEDptM28wl ZWLeb0CmUz0s9DcgXyzo6rB+jJLgFJE= X-Received: by 2002:a2e:8801:: with SMTP id x1mr19635239ljh.1.1563345269573; Tue, 16 Jul 2019 23:34:29 -0700 (PDT) Received: from localhost.localdomain (c-22cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.34]) by smtp.gmail.com with ESMTPSA id z22sm4277827ljz.20.2019.07.16.23.34.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 23:34:28 -0700 (PDT) From: Linus Walleij To: Zhang Rui , Eduardo Valentin , Daniel Lezcano Cc: linux-pm@vger.kernel.org, Linus Walleij , Lee Jones Subject: [PATCH 1/2] thermal: db8500: Finalize device tree conversion Date: Wed, 17 Jul 2019 08:32:21 +0200 Message-Id: <20190717063222.5902-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org At some point there was an attempt to convert the DB8500 thermal sensor to device tree: a probe path was added and the device tree was augmented for the Snowball board. The switchover was never completed: instead the thermal devices came from from the PRCMU MFD device and the probe on the Snowball was confused as another set of configuration appeared from the device tree. Move over to a device-tree only approach, as we fixed up the device trees. Cc: Lee Jones Signed-off-by: Linus Walleij --- Lee: it'd be great if you could ACK this, it is a file with low change rate so we should likely not see any collisions. --- drivers/mfd/db8500-prcmu.c | 53 +------------------- drivers/thermal/Kconfig | 2 +- drivers/thermal/db8500_thermal.c | 30 +++++------ include/linux/platform_data/db8500_thermal.h | 29 ----------- 4 files changed, 17 insertions(+), 97 deletions(-) delete mode 100644 include/linux/platform_data/db8500_thermal.h -- 2.21.0 Acked-by: Lee Jones diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 3f21e26b8d36..a1e09bf06977 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -36,7 +36,6 @@ #include #include #include -#include #include "dbx500-prcmu-regs.h" /* Index of different voltages to be used when accessing AVSData */ @@ -2982,53 +2981,6 @@ static struct ux500_wdt_data db8500_wdt_pdata = { .timeout = 600, /* 10 minutes */ .has_28_bits_resolution = true, }; -/* - * Thermal Sensor - */ - -static struct resource db8500_thsens_resources[] = { - { - .name = "IRQ_HOTMON_LOW", - .start = IRQ_PRCMU_HOTMON_LOW, - .end = IRQ_PRCMU_HOTMON_LOW, - .flags = IORESOURCE_IRQ, - }, - { - .name = "IRQ_HOTMON_HIGH", - .start = IRQ_PRCMU_HOTMON_HIGH, - .end = IRQ_PRCMU_HOTMON_HIGH, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct db8500_thsens_platform_data db8500_thsens_data = { - .trip_points[0] = { - .temp = 70000, - .type = THERMAL_TRIP_ACTIVE, - .cdev_name = { - [0] = "thermal-cpufreq-0", - }, - }, - .trip_points[1] = { - .temp = 75000, - .type = THERMAL_TRIP_ACTIVE, - .cdev_name = { - [0] = "thermal-cpufreq-0", - }, - }, - .trip_points[2] = { - .temp = 80000, - .type = THERMAL_TRIP_ACTIVE, - .cdev_name = { - [0] = "thermal-cpufreq-0", - }, - }, - .trip_points[3] = { - .temp = 85000, - .type = THERMAL_TRIP_CRITICAL, - }, - .num_trips = 4, -}; static const struct mfd_cell common_prcmu_devs[] = { { @@ -3052,10 +3004,7 @@ static const struct mfd_cell db8500_prcmu_devs[] = { }, { .name = "db8500-thermal", - .num_resources = ARRAY_SIZE(db8500_thsens_resources), - .resources = db8500_thsens_resources, - .platform_data = &db8500_thsens_data, - .pdata_size = sizeof(db8500_thsens_data), + .of_compatible = "stericsson,db8500-thermal", }, }; diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 9966364a6deb..001a21abcc28 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -310,7 +310,7 @@ config DOVE_THERMAL config DB8500_THERMAL tristate "DB8500 thermal management" - depends on MFD_DB8500_PRCMU + depends on MFD_DB8500_PRCMU && OF default y help Adds DB8500 thermal management implementation according to the thermal diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index b71a999d17d6..d650ae5fdf2a 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -13,13 +13,24 @@ #include #include #include -#include #include #include #include #define PRCMU_DEFAULT_MEASURE_TIME 0xFFF #define PRCMU_DEFAULT_LOW_TEMP 0 +#define COOLING_DEV_MAX 8 + +struct db8500_trip_point { + unsigned long temp; + enum thermal_trip_type type; + char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH]; +}; + +struct db8500_thsens_platform_data { + struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS]; + int num_trips; +}; struct db8500_thermal_zone { struct thermal_zone_device *therm_dev; @@ -301,7 +312,6 @@ static void db8500_thermal_work(struct work_struct *work) dev_dbg(&pzone->therm_dev->device, "thermal work finished.\n"); } -#ifdef CONFIG_OF static struct db8500_thsens_platform_data* db8500_thermal_parse_dt(struct platform_device *pdev) { @@ -370,13 +380,6 @@ static struct db8500_thsens_platform_data* dev_err(&pdev->dev, "Parsing device tree data error.\n"); return NULL; } -#else -static inline struct db8500_thsens_platform_data* - db8500_thermal_parse_dt(struct platform_device *pdev) -{ - return NULL; -} -#endif static int db8500_thermal_probe(struct platform_device *pdev) { @@ -386,11 +389,10 @@ static int db8500_thermal_probe(struct platform_device *pdev) int low_irq, high_irq, ret = 0; unsigned long dft_low, dft_high; - if (np) - ptrips = db8500_thermal_parse_dt(pdev); - else - ptrips = dev_get_platdata(&pdev->dev); + if (!np) + return -EINVAL; + ptrips = db8500_thermal_parse_dt(pdev); if (!ptrips) return -EINVAL; @@ -498,13 +500,11 @@ static int db8500_thermal_resume(struct platform_device *pdev) return 0; } -#ifdef CONFIG_OF static const struct of_device_id db8500_thermal_match[] = { { .compatible = "stericsson,db8500-thermal" }, {}, }; MODULE_DEVICE_TABLE(of, db8500_thermal_match); -#endif static struct platform_driver db8500_thermal_driver = { .driver = { diff --git a/include/linux/platform_data/db8500_thermal.h b/include/linux/platform_data/db8500_thermal.h deleted file mode 100644 index 55e55750a165..000000000000 --- a/include/linux/platform_data/db8500_thermal.h +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * db8500_thermal.h - DB8500 Thermal Management Implementation - * - * Copyright (C) 2012 ST-Ericsson - * Copyright (C) 2012 Linaro Ltd. - * - * Author: Hongbo Zhang - */ - -#ifndef _DB8500_THERMAL_H_ -#define _DB8500_THERMAL_H_ - -#include - -#define COOLING_DEV_MAX 8 - -struct db8500_trip_point { - unsigned long temp; - enum thermal_trip_type type; - char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH]; -}; - -struct db8500_thsens_platform_data { - struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS]; - int num_trips; -}; - -#endif /* _DB8500_THERMAL_H_ */ From patchwork Wed Jul 17 06:32:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 169105 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp545806ilk; Tue, 16 Jul 2019 23:34:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFNh2DGnnTsXezRf33nQ4bKGVkiL8pnlQJm8xZJNvdSBW7R74bhU14gVL4z/DjcGHmEFVV X-Received: by 2002:a65:64c6:: with SMTP id t6mr39885849pgv.323.1563345288649; Tue, 16 Jul 2019 23:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563345288; cv=none; d=google.com; s=arc-20160816; b=O+VlvoPtp7+FpwuhKCVc4Bly6Xewvq8aCmYXoXnJvbGxAzpIPjzJcq7pynmDE19ugq pzMB2v/6qLVft/yLGpDj699tu2vhnHmDQaWlkPtc5bENV4Q8mJo5oioMVFVrl2+7PZO7 rqKlbadfcPULFHrMvuamVKIxJGHiHw3+5G5xFqxCAhq+ZJpvGsShegBYcqOsp0Wzayan kHOxdepS5pfVK+stV9AyQROjVufGUcuXG1O+ob3DTLrA9EcbCE2SYeqepOZJM6GiBSNe 8UTpgQsAyQrbAq9T1yO/ZsGb6t9tl0bb4JT9RB51bNzASiWBl2gB+rd4LV4HrIv7A7Um nCdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RneXg/3PcSiBdiN1Yij+yIhb511n0iX+fkkd6qMaq/c=; b=L/bzxjAa7vbT6Im0ac6qW4WURJFwBZ0b33b4txY6L7FcFgdo/avhdWPqoeSSr/exRu Pb5UVUCWiI4K59oOtetaxY8aAkUBIfUKQ4qAQkIeyoveEyEMz158/MxLxJtAeXBYjBAm zrLzRaRAfC57HTZm6NXOHS4HqVxNa79UKuMnHEtLwTdDe8g0/h2OMROw4ZwPrqKU0vyT oL1q6sG3KL7XZzi/9s4GjpjOPONvcmR7i4C0r+FXMdf9VUt0i7xxdHTSXsVVDjJAbphk 8YD1O8HkLKqZFBFeAlzDUbQlP7I8Q8AiF3Ea11ewFPKXE3N+q9KcC0uAoHhMt+OTNkP6 rwvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GaXmGqUc; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 v1si22124171pjn.79.2019.07.16.23.34.48; Tue, 16 Jul 2019 23:34:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=GaXmGqUc; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1725856AbfGQGes (ORCPT + 11 others); Wed, 17 Jul 2019 02:34:48 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:32769 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbfGQGer (ORCPT ); Wed, 17 Jul 2019 02:34:47 -0400 Received: by mail-lf1-f66.google.com with SMTP id x3so15619737lfc.0 for ; Tue, 16 Jul 2019 23:34:45 -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 :mime-version:content-transfer-encoding; bh=RneXg/3PcSiBdiN1Yij+yIhb511n0iX+fkkd6qMaq/c=; b=GaXmGqUcaeItB1qbHommjcNkWXhHLsbY8+iv9qwigbYeYhFjrKbnC4TM7f9XOsGkgu /urZAsaE/V051u+boHI+IV1BAtXoE9SB71R7lT8ZZdRJKPAmPlrWodDq7YZ6Ujw/epcm KzfPxLFGEMQZcs2hybydZc3jEeYLVw/RLjLqE/DSiCa+Z3YsIuNXpwcY+fUaMmHp3p2V N66Kz12XPE1aKM3WgWgjFtSW+2u2cxvRjuwVE+97FK8vnrxSCss3jjCnQpQhiupUhOI9 AGvOL7dyuKOsbeahrIO3KkdXB8EIIDXkTuvwpRBm8k/PkKnY+AnTsmACxJPBK6jEDtC0 aneg== 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:mime-version:content-transfer-encoding; bh=RneXg/3PcSiBdiN1Yij+yIhb511n0iX+fkkd6qMaq/c=; b=LXaGcx5QWhNDwDsurXbBxuy23Hyc00lKWWT3LiACc9/pkHwttKSjEduO+pNV3Jk5N3 Ng0QOaa4hGl6q+K340UDyoLITgtNB2yl6GjXX9hed21DzfCdfd/tJ/WYFhqinTLSvM/W LnpVzxOu6O/CDtbzoQtTRlm32qbvyu9fwTD4DU54CkdcminbTWsAchpf3kAAOOOteX+B NZkVzoxiKwBOBcE1F4QxP8lqPJjyYKPUQAMJfCKTVNI+I/s+2FYDHf9H4PwVaTyJd2bL OXk0cc/ztrLShKrMDmkacGXjVbWUnQUU3cA+UQbmwXiOzdd6VEgzgnB6ttMIqdf4pc+5 oLzg== X-Gm-Message-State: APjAAAVvZGR4vHtenLvfQjiZ54JCHPkepq5Cv7gTYpFHQrRXRTpvCztq WxG0OHMbeADXMA3V70QGNTJCChiQGeI= X-Received: by 2002:a19:f806:: with SMTP id a6mr3365442lff.102.1563345285056; Tue, 16 Jul 2019 23:34:45 -0700 (PDT) Received: from localhost.localdomain (c-22cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.34]) by smtp.gmail.com with ESMTPSA id z22sm4277827ljz.20.2019.07.16.23.34.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 23:34:44 -0700 (PDT) From: Linus Walleij To: Zhang Rui , Eduardo Valentin , Daniel Lezcano Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 2/2] thermal: db8500: Use dev helper variable Date: Wed, 17 Jul 2019 08:32:22 +0200 Message-Id: <20190717063222.5902-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190717063222.5902-1-linus.walleij@linaro.org> References: <20190717063222.5902-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The code gets easier to read like this. Signed-off-by: Linus Walleij --- drivers/thermal/db8500_thermal.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) -- 2.21.0 diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index d650ae5fdf2a..d250bcf3c10c 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -313,16 +313,16 @@ static void db8500_thermal_work(struct work_struct *work) } static struct db8500_thsens_platform_data* - db8500_thermal_parse_dt(struct platform_device *pdev) + db8500_thermal_parse_dt(struct device *dev) { struct db8500_thsens_platform_data *ptrips; - struct device_node *np = pdev->dev.of_node; + struct device_node *np = dev->of_node; char prop_name[32]; const char *tmp_str; u32 tmp_data; int i, j; - ptrips = devm_kzalloc(&pdev->dev, sizeof(*ptrips), GFP_KERNEL); + ptrips = devm_kzalloc(dev, sizeof(*ptrips), GFP_KERNEL); if (!ptrips) return NULL; @@ -377,7 +377,7 @@ static struct db8500_thsens_platform_data* return ptrips; err_parse_dt: - dev_err(&pdev->dev, "Parsing device tree data error.\n"); + dev_err(dev, "Parsing device tree data error.\n"); return NULL; } @@ -385,18 +385,19 @@ static int db8500_thermal_probe(struct platform_device *pdev) { struct db8500_thermal_zone *pzone = NULL; struct db8500_thsens_platform_data *ptrips = NULL; - struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; int low_irq, high_irq, ret = 0; unsigned long dft_low, dft_high; if (!np) return -EINVAL; - ptrips = db8500_thermal_parse_dt(pdev); + ptrips = db8500_thermal_parse_dt(dev); if (!ptrips) return -EINVAL; - pzone = devm_kzalloc(&pdev->dev, sizeof(*pzone), GFP_KERNEL); + pzone = devm_kzalloc(dev, sizeof(*pzone), GFP_KERNEL); if (!pzone) return -ENOMEM; @@ -410,31 +411,31 @@ static int db8500_thermal_probe(struct platform_device *pdev) low_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_LOW"); if (low_irq < 0) { - dev_err(&pdev->dev, "Get IRQ_HOTMON_LOW failed.\n"); + dev_err(dev, "Get IRQ_HOTMON_LOW failed.\n"); ret = low_irq; goto out_unlock; } - ret = devm_request_threaded_irq(&pdev->dev, low_irq, NULL, + ret = devm_request_threaded_irq(dev, low_irq, NULL, prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, "dbx500_temp_low", pzone); if (ret < 0) { - dev_err(&pdev->dev, "Failed to allocate temp low irq.\n"); + dev_err(dev, "Failed to allocate temp low irq.\n"); goto out_unlock; } high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH"); if (high_irq < 0) { - dev_err(&pdev->dev, "Get IRQ_HOTMON_HIGH failed.\n"); + dev_err(dev, "Get IRQ_HOTMON_HIGH failed.\n"); ret = high_irq; goto out_unlock; } - ret = devm_request_threaded_irq(&pdev->dev, high_irq, NULL, + ret = devm_request_threaded_irq(dev, high_irq, NULL, prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, "dbx500_temp_high", pzone); if (ret < 0) { - dev_err(&pdev->dev, "Failed to allocate temp high irq.\n"); + dev_err(dev, "Failed to allocate temp high irq.\n"); goto out_unlock; } @@ -442,11 +443,11 @@ static int db8500_thermal_probe(struct platform_device *pdev) ptrips->num_trips, 0, pzone, &thdev_ops, NULL, 0, 0); if (IS_ERR(pzone->therm_dev)) { - dev_err(&pdev->dev, "Register thermal zone device failed.\n"); + dev_err(dev, "Register thermal zone device failed.\n"); ret = PTR_ERR(pzone->therm_dev); goto out_unlock; } - dev_info(&pdev->dev, "Thermal zone device registered.\n"); + dev_info(dev, "Thermal zone device registered.\n"); dft_low = PRCMU_DEFAULT_LOW_TEMP; dft_high = ptrips->trip_points[0].temp;