From patchwork Wed Aug 28 08:59:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 172353 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp453710ily; Wed, 28 Aug 2019 02:00:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaB9/pKZ/S2QxfpfFIcwS/I9TMDtB6mvn1iG45wmj63kRYZ06xTKF1Z/2XTXIV2Shu6YG6 X-Received: by 2002:a62:8688:: with SMTP id x130mr3543202pfd.162.1566982811068; Wed, 28 Aug 2019 02:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566982811; cv=none; d=google.com; s=arc-20160816; b=A14RmFaf4aVQf1BltNN5cXYJ2UFLmltKhd0lbkndR2d8BIFIRn6t+HyTw8u60JmSFK +bp1yyguBSAoh0KxvpuC6ZFTSXFjazadbtQHZY4KqFLla7WhLrJcF1gjXA8z4lHfkT2/ 5yQvm+Srlc3tJ2FHWZAILBjd1KVQ+yx9qTgImkyQ9hDnFJ+BhgNLQW78thJ1oPVTLBIN pDcOIVXPs/Xnsj0Gnk7+I1gyy0fbXuDRxlQ9g/0q5mKrC9/bzCng+9z0CCr9MyOzTM38 jCInZ9Hbf35kpV2AvPVeQkdZ5YAW3tRaUEKTNkSCZgUrLr3eda1LhDQAorNvdtZQRtcg P2/A== 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=kVhz1OO0ZxhBZubMddXQ3Emt8VJvFbqDjLyJ6vpWrIk=; b=lYJd5/7VFrceCC264cIOwdcKMFI0mR6NVx0ThBdKB5CSfRjW5i3+xvsmlH7g/fFlCJ YNlCUrSlpzMnuHGd4Pb6Z3o6fVAXX+u4iS8M4A8CUMUqVJDR+Mg6XzthS+ZaF07sKAJT UIgaFpM8e44Q2cNlhcdHRJZW9N0ppPyVhXZGTqjscaI6aaWRoUPs24nVhCADeM4fYY3t 8DF1gQaoYvnSYw/ckHLiqA3G9lWvLsRcG4WDXjObxnf+bR7lj6hsyowyeKjEi4e5CQHK 9J3FvQgwZQjhbqGAtSBOHdodQzJdh0R06Jq2ZQbxJ28Rg9wjtRjfjqBOBeveRHnD9duD R+yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mrE67/FA"; 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 q15si1434106pls.184.2019.08.28.02.00.10; Wed, 28 Aug 2019 02:00:11 -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="mrE67/FA"; 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 S1726368AbfH1JAK (ORCPT + 11 others); Wed, 28 Aug 2019 05:00:10 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:46240 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbfH1JAK (ORCPT ); Wed, 28 Aug 2019 05:00:10 -0400 Received: by mail-lf1-f65.google.com with SMTP id n19so1440287lfe.13 for ; Wed, 28 Aug 2019 02:00:08 -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=kVhz1OO0ZxhBZubMddXQ3Emt8VJvFbqDjLyJ6vpWrIk=; b=mrE67/FATNYTkbwcyvOftkVNn3ekurlAE7PcNkTdGSxnIKJGmd5expXHgSP26S1Uji jGOMyBAFVge4mBggchTNvfHVV1DCAgTVxuy6IFmSWlBOvLNNVtyPrb9CLvjEmYKQ9W1e RxQ5ZCr/6V9DxgNqi4A3Q2lhSeck7hYL0EIj9Iyz3L9t8U74SmzyxJ9ga5FFCfEEheT+ Nh6KHmW9BTTr5OD/IS+8brdfNNWQh8QFr2A2E1Te48GiaiP2VJsuzXi0PYXGGFeyiCRq tho0LDtXnTayP40aOs76mHj/hNYMXIe4gjcQpwlZFq9mmqvAJLiOO/O4ACRwqLbX7/L+ ufwg== 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=kVhz1OO0ZxhBZubMddXQ3Emt8VJvFbqDjLyJ6vpWrIk=; b=k3AMmFHZk1+FC0wr70c53mInfXkLPsfxLFoHr4qzS1wevxOLWwYmm6q9OpxMvgN4/Q D7XMI1oUoctKSi0DLL1jTHhB7w6wALNDsF/ascIT54NoQNMD72RNgEzLUTnKMzQnjmf3 dz0Fwv1rT4QoOKw/Xux7DSucAVm2BlVERUZHF2YKFAkaH+9lfyl5lu7YLj9vdfZf6eMi IQOZ7d70Jq56FowJRJaBlesEuisAAi/RARxBQRLbwv/IEFfcH7Yfhb61w+DWSE7IUK1b tm68SGUg6Ki73saWeMmWvDpTFPvAGfvlTBJQk5mnFjRmMxfl8cKivL6sG/ZNFwHrPds3 b3gg== X-Gm-Message-State: APjAAAX1KvbM0n5reXsP0SYMJRJASQ9RGyLVXP712W1NDk8LY8n2sr1d c9uzD4H/f+YwgKNSv3+L51r8dPtBk3U= X-Received: by 2002:a19:bed4:: with SMTP id o203mr1844927lff.110.1566982807463; Wed, 28 Aug 2019 02:00:07 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c23sm449653ljf.105.2019.08.28.02.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 02:00:06 -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 v2] thermal: db8500: Use dev helper variable Date: Wed, 28 Aug 2019 10:59:58 +0200 Message-Id: <20190828085959.11510-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190828085959.11510-1-linus.walleij@linaro.org> References: <20190828085959.11510-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 Signed-off-by: Linus Walleij --- 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 Reviewed-by: Daniel Lezcano 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;