From patchwork Wed Aug 28 13:03:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 172381 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp720751ily; Wed, 28 Aug 2019 06:03:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMLI3wHqhl1EYL0/RZgOUQz6PXunSN1hLdzrhgVhyvW2c70+/FhmUQ1ppzvCqta4aurT+D X-Received: by 2002:a17:902:ff02:: with SMTP id f2mr3898962plj.99.1566997409707; Wed, 28 Aug 2019 06:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566997409; cv=none; d=google.com; s=arc-20160816; b=mOoyrlBXUkRwe9cfmFXbVzhKSz3hKDcnbPQyo8V9AG3UBwyKYU/HO8RGiU3WBsfe9T R0CsnaepL5fL3NWKktN3lcGTpnK8lZE4tN8AAfcdX/VD24tmUgA7706+E56M8aQ0gaTi 9xobnCi8hyc9WOiEcMMw00yNzRf1A+IgRDRM/PI0lLaUbEPmns0/X5ExrTxw6WvPG+1Q 9JnXYizztalgem9wP9EpSr2LgbqOC3gHvQmsJtDnySBIVNcC4Z5lR00KDO5aEAmLm4Ws GdKOhkS9I67Qgckfgr0BUhAdfhHpf/4k1EnYmiELLTvEPbb4thMZzTOeyezhMFaIlk6Q grDA== 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=qM8fl4wYquSBdbAEZPeEK0+d/HM25Lv2u5CqIuUyAuE=; b=SiAtmMhIljf6EaPd2QQyRc+k2IKtoHkhtywA/C6IWmy08sE0E4rIlbeQJD7ZUeA8iF 2Kn2oHREXDyAi20Nb3JuR5p+5c/LtcNKwn1Wk4hkZ3jViM1ed+1XgOx2dc4qPZqhIxVK +s+fo4fs7bOXLSoHZALfixkNaiPkUEV+jbRXpT54qyDI5IioGGTJAvJs6tzdBs4hB1qk catQokaOdwB/MMvQ8BXrM1rkayAErILaTvdy5yU9gMAVYnI8AB30tWezeJuQRjsybbIx ZphRKseb78wULom7NjlNdEMHLHYiBpodhD40n2OyasbVNoxe3klF5V+Dt0T5USA7AAaV 8PCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rJvYwGkE; 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 c127si2110200pga.569.2019.08.28.06.03.29; Wed, 28 Aug 2019 06:03:29 -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=rJvYwGkE; 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 S1726454AbfH1ND3 (ORCPT + 11 others); Wed, 28 Aug 2019 09:03:29 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:32806 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbfH1ND2 (ORCPT ); Wed, 28 Aug 2019 09:03:28 -0400 Received: by mail-lf1-f67.google.com with SMTP id g9so2125287lfb.0 for ; Wed, 28 Aug 2019 06:03:26 -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=qM8fl4wYquSBdbAEZPeEK0+d/HM25Lv2u5CqIuUyAuE=; b=rJvYwGkEvCHbRVRMcMoR1pxMyU8eb2WZAdZn29CM9d/7OegJgY+W9qZa9U2NjZvWBT 7Ww+e1c9ShfWhfRlaf8W70MghIzFrrb7mqq5AQV1dDJHdP5bEpexa8TCb1DGeyMptVy3 Pul82hBFV488VAaJnnPmXLwlr6YLOm1HSuKgbcYPjW1EVVXfXWdlGJ7nM3YXtlhXnuTy fj6f7ENP5mI3YbYwd/Biej4SQQ5IvlK3sNNkhc+0WmE7slaEQvWN/nLJe3YfOBYz4kCE Tqvm9PD1sjB4UXT1jcyOCDcFbm/JcpApxT7ni79Fho7JUduodk4lvxUMXTHMqvR6TYwE Kogw== 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=qM8fl4wYquSBdbAEZPeEK0+d/HM25Lv2u5CqIuUyAuE=; b=M3r4L6yX91JPFcuOhK98xmGoqL9goI/cXt99eJvIG8UsnBxNTrF1NHMaJU79iZcZJ1 nCtmRlKdzAYhL4J/DHjbQ47aQUKGP6lw6v+7F1NPH1XD74rZ7TTYeXQaRmZsUwd9/i8h rp6CWGyCRCiRjVYJHEdjT67c1ePerHLz55W4d6KA6ab47ft+zSlYfHu+3Ev/o5H6liUE jd1Z5m7DxigmugL8mglFXynGh4TrFEhtgvqdmBKz/ukvKPpVyYZYl4iRS5ptJBk3ULHH VE5QpBdAxFLrtGG/fPHm2VHpOsxzZrjdM2ugC13tltPucfaU8780rbcIoPegLSavmlak +qUg== X-Gm-Message-State: APjAAAUL+2vrmmefMqLk7XOWdQ8DCOEBooRLmK39mk/q5JQ3oH/i6QL0 kwZ5atJWI0s3AOWIHJ5eN+5/lQ== X-Received: by 2002:ac2:4c2f:: with SMTP id u15mr2531508lfq.174.1566997406084; Wed, 28 Aug 2019 06:03:26 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 18sm843611lfy.26.2019.08.28.06.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 06:03:24 -0700 (PDT) From: Linus Walleij To: Zhang Rui , Eduardo Valentin , Daniel Lezcano Cc: linux-pm@vger.kernel.org, Linus Walleij , Vincent Guittot Subject: [PATCH 2/3 v4] thermal: db8500: Use dev helper variable Date: Wed, 28 Aug 2019 15:03:19 +0200 Message-Id: <20190828130320.6174-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190828130320.6174-1-linus.walleij@linaro.org> References: <20190828130320.6174-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. Cc: Vincent Guittot Reviewed-by: Daniel Lezcano Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - No change, resending with the rest of the patches ChangeLog v2->v3: - Collected Daniel's ACK ChangeLog v1->v2: - No change, resending with the rest of the patches --- 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;