Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7131050imm; Tue, 28 Aug 2018 06:58:23 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdai/rGgqlFDTcHe4bZFX8Y2mqDlUlgQI/0k1gSbwN3XBBKH0nMwsNbdxiVVzDKy94k+aJbQ X-Received: by 2002:a17:902:b28:: with SMTP id 37-v6mr1695556plq.337.1535464703312; Tue, 28 Aug 2018 06:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535464703; cv=none; d=google.com; s=arc-20160816; b=HQhNhcAiv0abJKTAym3nV2zRUHracm5vh2KlbdEsh5Q0PVoz+Z8/BdFUPST/CfMMdj ux8C3tGoJBackrWIE3OaZGwxIIy+qYbT2nAryBylAGs+p2YYM1WyLM88RSzbLK8rAYAE YCP5l6v5j8jWqK7iCQm1rm+SSXVqS0urI6OqiyU0f5rk0mGhaJiXBEi14npR7OplwVa2 KkuS9/X8eI0fqV6xSKNQHqpXm7US66IE565+4spUyVExf9TdsGIE/HduxPduWRwMuf85 SyFlVcWTw7v+fCplzoQDvNN2eLr3zY9npJ8KYeoqaHhu0EnehhX67/AXCa5tlgxhLpbn Zu4A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=nMojAtRwudJSj7DiGIyX0w3/gxVENvX68gtXBn6PaQI=; b=xMLYmCM2nFC7vs71VPbb4IeIzY86+9aH+iE72wKSn6jtnTLuQ56aPYB4puyI+GaOv/ 6Y57aRrVNMxHf6uhrnF2zru8nNO6tj6KWBWv+ph2feauvmaLLjVdmpvvQQ5LEEyU0rfm oAWhof+CKNZDc0dtJwOFK79OofJr31J+CnzW7yaAwPD1oo8JcoDr8/osJ+3gCuZBt4uP DqyzvzfzZ0TSd9NNBUXmuNef8yVOQIdnQV2dPns/H22J5U9slAunCDU5RueCUhDTz8vS GS2V4kJGJHdokJrX7HyFLgBCSI+aJ0eaOq0Yo3bAamwcjoKXChsqs0a1fLr6vJ2Xfic8 om/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=G+nXpiqF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17-v6si1094890pge.273.2018.08.28.06.58.07; Tue, 28 Aug 2018 06:58:23 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=G+nXpiqF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728045AbeH1Rsx (ORCPT + 99 others); Tue, 28 Aug 2018 13:48:53 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36798 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727201AbeH1Rsx (ORCPT ); Tue, 28 Aug 2018 13:48:53 -0400 Received: by mail-pg1-f196.google.com with SMTP id d1-v6so794984pgo.3; Tue, 28 Aug 2018 06:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nMojAtRwudJSj7DiGIyX0w3/gxVENvX68gtXBn6PaQI=; b=G+nXpiqFb9bKepy9Hr7knocjMIdYAkzcbk5RGJ8xifwu8G3Jt3xAfRfHh6rHojhiK+ 0apbRRUHVJrusZXgyxElTXEOfP9NmtIT5biFEdjqprrGiNUGzIqwsrtVtxVtn7baFg1b dszYDpKdoHl+Gban08QNIJy9nhxoeB75Dce7xvLrz/FMx6EwjgiZ7qXN8ymi79raiJK9 1E2WnUZm5GglSxDcv4BQna5uT8w0ffRnZh+WD+PJ6XB9sQeASVp/TxzQJv0GKHm4t6bB TrEX8gpeexzsPoVJ8q7LBZjr+qWwa7E2jaifZDycV+xi911XTgf5lwUInN77GvF7updu lREg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nMojAtRwudJSj7DiGIyX0w3/gxVENvX68gtXBn6PaQI=; b=iACkY3XqKnWpAYJzegR3eFqqdTH8sGWGCyRGgCvX/GC1Pmtc8VWYDVng0vYx1UanTE ssY+noA0Uqh04PTg1EsIDp9K0yKXLUGcKMtuicrjE7GIN0KY0YdGKROArmZgBHOJ6vpL +CZGX3gZnx3Aw4Px9dZkZJcAey9bI2BVhoxodb7zmyvy14JP9wMDtD1mrKjHZ2lPpu0u d9+jjEyf+P3+RIpe1N95aiG13afTAiDxlnyp6No5hvQkJ4xb1pI6ZRQzTEjMbTwKonpr 5Lo3u2Px1MIdSDioINKLz6WmqyXImi2HFeIZ1uh0GGUS6MZ4xTEbh7yO7BiRszrRL6id xRvw== X-Gm-Message-State: APzg51B6xKcZeQfkICyDlzS69cYxXp7QXOEnV1ROfegEKiiLVNC8PmzY p/Oiccg2PhLlY/JN7x9Euhi+kLze X-Received: by 2002:a63:5d4b:: with SMTP id o11-v6mr1643493pgm.349.1535464624655; Tue, 28 Aug 2018 06:57:04 -0700 (PDT) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id c1-v6sm5407460pfg.25.2018.08.28.06.57.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 06:57:03 -0700 (PDT) Subject: Re: [PATCH] hwmon: Convert to using %pOFn instead of device_node.name To: Rob Herring , linux-kernel@vger.kernel.org Cc: Jean Delvare , linux-hwmon@vger.kernel.org References: <20180828015252.28511-1-robh@kernel.org> <20180828015252.28511-20-robh@kernel.org> From: Guenter Roeck Message-ID: Date: Tue, 28 Aug 2018 06:57:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180828015252.28511-20-robh@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/27/2018 06:52 PM, Rob Herring wrote: > 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 The devm_kstrdup((..., "iio_hwmon") is getting a bit ridiculous and is asking for a rewrite, but that can be done in a separate patch. Other than that, do you want this taken through hwmon or as a series on its own ? For the latter case, Acked-by: Guenter Roeck otherwise please let me know. Guenter > --- > 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(-) > > 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, >