From patchwork Tue Aug 28 01:52:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 145244 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp608390ljw; Mon, 27 Aug 2018 18:53:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZesVrExUOhwQdqpv9hYVNFQzP565/JBxifEPhyYv+TQna31sPXzCdCCpML5uw/zgPIunQw X-Received: by 2002:a17:902:704c:: with SMTP id h12-v6mr15373908plt.237.1535421196764; Mon, 27 Aug 2018 18:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535421196; cv=none; d=google.com; s=arc-20160816; b=O0F33L6lN7Jm2iwbGliovDy540p6pSX55t3abeJgm5sRtCKyjmjclPF/r92dSQ0t/e vLvisEfqHFJckVoBVzySoLYF/bvKiZldsnyEBnAgPL7LYouLt8KcNYdyN0Be4exL0Z74 rAmyTq4YHy/jrEyIDzuR/GgwycheQozAt6xZkIl9FpOrVdmUOU4kpfgfLVbxcK+zcFqb KtQhItQeXMlAsIvO6E0Jr2TKczVcnLkFR1aQBO50pMdA6hJ+DTkq+wFXnhy8f687ZU7Q QxS0WWQB9LosAaL4ExfqVMFbYDBKITYlcStQiU/bopXNsWGTPn5lomCX7Ye0tlwTgZdC k7PQ== 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:arc-authentication-results; bh=wuRpGge/NMC2oy1JXZyquK/m5VcBihkhIPmX9fI4eX8=; b=0tHQGlHqPsqmnLeL21vT17y4Bf6UZRH5utZoFDyueZIpcYYmZYasn/IF4AF5C3pg8u RhmOC3aTK3aDC7ZKJv9UcZCg7dVMXDp6i4vqqcRbmEfhsqp8DUyLyo0TJO+6qnVkHqv8 ODTVdyPo7pqNUL66QjQuciQdboa+wld5HhDXWNgcxpvpTrS6rW2PZh7CPjHs/D4CiKqB EE+gdSkVYG+0+jGfPxujZgurUgCTsTBwExljGxRYRAF6EFcrYIvF/QLnj35K6tD0m6cb Xl5cpcBhOkdIR4heToWEoycFftE1s4LaNkxrN6F90ylCLtnje6q2jj6d69RjrznPHUZu zOww== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m28-v6si774423pgd.358.2018.08.27.18.53.16; Mon, 27 Aug 2018 18:53:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727577AbeH1Fm3 (ORCPT + 32 others); Tue, 28 Aug 2018 01:42:29 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:35496 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727530AbeH1Fm3 (ORCPT ); Tue, 28 Aug 2018 01:42:29 -0400 Received: by mail-oi0-f68.google.com with SMTP id m11-v6so34302oic.2; Mon, 27 Aug 2018 18:53:14 -0700 (PDT) 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=wuRpGge/NMC2oy1JXZyquK/m5VcBihkhIPmX9fI4eX8=; b=KXALkJtZBOXDLWYwW0taqsXwbZRlnNpU1+1atGIdCxZjBAPzY8cwQ4uKzG3p9jzSRJ UStHvL76pOG8ZxA+SG/L7Mx76tQHSQG38A5QI1T+LtI0k2/f7GkIc6hmNWMCPZMmJRE+ MHMjwokhtp0eUNJE8/miuNKm2jdfO52EhM7PgaA1+9S3j1wP6DlbUerbVzZxqaYkwFYl srhegM3F1pjwm2U7ODhHj/2QxSOOQ2Ru7bfyy52elUZ5R6mkTGZHUiL4sf2EkG9xR8Qs ANBf01CqwyKWleO0Nnclp8sKrTP/fR+WbO5T6ezEwa3I6oEFBciKxoFUrCGfwJbFbxhB o9Sw== X-Gm-Message-State: APzg51D1EoQVlQ7RheNAXtRV/A7+Sbzlj+zdvX7hwb34R98D0M/9B/5n QqCBbnmAUHlyeCcN/3Qfilymvpw= X-Received: by 2002:aca:6ac8:: with SMTP id f191-v6mr1128477oic.223.1535421193632; Mon, 27 Aug 2018 18:53:13 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id n71-v6sm1652696oig.48.2018.08.27.18.53.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 18:53:13 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org Cc: Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org Subject: [PATCH] hwmon: Convert to using %pOFn instead of device_node.name Date: Mon, 27 Aug 2018 20:52:21 -0500 Message-Id: <20180828015252.28511-20-robh@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180828015252.28511-1-robh@kernel.org> References: <20180828015252.28511-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Jean Delvare Cc: Guenter Roeck Cc: linux-hwmon@vger.kernel.org Signed-off-by: Rob Herring --- drivers/hwmon/aspeed-pwm-tacho.c | 2 +- drivers/hwmon/ibmpowernv.c | 4 ++-- drivers/hwmon/iio_hwmon.c | 9 ++++----- drivers/hwmon/npcm750-pwm-fan.c | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) -- 2.17.1 Acked-by: Guenter Roeck diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index 5e449eac788a..92de8139d398 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -852,7 +852,7 @@ static int aspeed_create_pwm_cooling(struct device *dev, dev_err(dev, "Property 'cooling-levels' cannot be read.\n"); return ret; } - snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%s%d", child->name, pwm_port); + snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port); cdev->tcdev = thermal_of_cooling_device_register(child, cdev->name, diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c index 83472808c816..4935897f1527 100644 --- a/drivers/hwmon/ibmpowernv.c +++ b/drivers/hwmon/ibmpowernv.c @@ -603,8 +603,8 @@ static int create_device_attrs(struct platform_device *pdev) if (of_property_read_u32(np, "sensor-id", &sensor_id) && of_property_read_u32(np, "sensor-data", &sensor_id)) { dev_info(&pdev->dev, - "'sensor-id' missing in the node '%s'\n", - np->name); + "'sensor-id' missing in the node '%pOFn'\n", + np); continue; } diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c index 2f3f875c06ac..7566991f1c04 100644 --- a/drivers/hwmon/iio_hwmon.c +++ b/drivers/hwmon/iio_hwmon.c @@ -65,13 +65,9 @@ static int iio_hwmon_probe(struct platform_device *pdev) int in_i = 1, temp_i = 1, curr_i = 1, humidity_i = 1; enum iio_chan_type type; struct iio_channel *channels; - const char *name = "iio_hwmon"; struct device *hwmon_dev; char *sname; - if (dev->of_node && dev->of_node->name) - name = dev->of_node->name; - channels = devm_iio_channel_get_all(dev); if (IS_ERR(channels)) { if (PTR_ERR(channels) == -ENODEV) @@ -141,7 +137,10 @@ static int iio_hwmon_probe(struct platform_device *pdev) st->attr_group.attrs = st->attrs; st->groups[0] = &st->attr_group; - sname = devm_kstrdup(dev, name, GFP_KERNEL); + if (dev->of_node) + sname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node); + else + sname = devm_kstrdup(dev, "iio_hwmon", GFP_KERNEL); if (!sname) return -ENOMEM; diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index 8474d601aa63..96634fd54e0b 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -861,7 +861,7 @@ static int npcm7xx_create_pwm_cooling(struct device *dev, dev_err(dev, "Property 'cooling-levels' cannot be read.\n"); return ret; } - snprintf(cdev->name, THERMAL_NAME_LENGTH, "%s%d", child->name, + snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child, pwm_port); cdev->tcdev = thermal_of_cooling_device_register(child,