From patchwork Tue Sep 4 21:27:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 966093 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 424g5g4lMyz9s5c for ; Wed, 5 Sep 2018 07:32:07 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Received: from lists.ozlabs.org (unknown [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 424g5g3Z8bzF38x for ; Wed, 5 Sep 2018 07:32:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=209.85.218.65; helo=mail-oi0-f65.google.com; envelope-from=robherring2@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Received: from mail-oi0-f65.google.com (mail-oi0-f65.google.com [209.85.218.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 424g0j0kCqzF35y for ; Wed, 5 Sep 2018 07:27:48 +1000 (AEST) Received: by mail-oi0-f65.google.com with SMTP id m11-v6so9668210oic.2 for ; Tue, 04 Sep 2018 14:27:48 -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; bh=ineBaMr8aRnuD6xE4Q5jjIDHv3rtrjxktihB8OIznkc=; b=C6n8UhVffiwvt99Zv5bYd2WihY8UuQcN4rmzyQGM/mysiXuvv1uiRkPwURYssMtnCx SMVDmd4NPt8icJFwxed9fkNkjPgfEksNNJ8KlbBfYBnHwxCrLWaBTib0S50cHAvpp50y BouS5qhuyhCAua13SbIdDOuuxj1MOOhyNO+sOVEEgARKl/wzo+Kwuxo2SXeBOyan9IpW xnGuqU23+LAsjHJmJqbqine39M9VGk+mI/N8i8vXMeQoz4lCR+hU+EFS+nAiVE6M7M9S FPEU+i2HWS01IGrIUxH8gslVotCW1jpeh0O5P0qByW+/MvZeJ8v4UTm2I9Hbde0D71EV 41Bw== X-Gm-Message-State: APzg51A5kpDx43T3mFQYpBahQjyfIIoENIwFTyYL8OOqqvICRJov2AnE dOJRoM9oeEcpfmfXGVsc/A== X-Google-Smtp-Source: ANB0Vdbgid+xtheyJvENinK3Qu3td/pPTQxzHrDTqYI5veLYsPOSvQ6wDc1lBelX1PruRnD1MquZfQ== X-Received: by 2002:aca:abc3:: with SMTP id u186-v6mr27758961oie.316.1536096465647; Tue, 04 Sep 2018 14:27:45 -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 i132-v6sm28982541oif.20.2018.09.04.14.27.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 14:27:45 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org Subject: [PATCH v3] macintosh: Convert to using %pOFn instead of device_node.name Date: Tue, 4 Sep 2018 16:27:44 -0500 Message-Id: <20180904212744.16747-1-robh@kernel.org> X-Mailer: git-send-email 2.17.1 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Benjamin Herrenschmidt Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Rob Herring --- v3: - Fix dev_name handling. Using "%.*p" syntax throws a warning (and probably doesn't work). drivers/macintosh/macio_asic.c | 8 +++++--- drivers/macintosh/macio_sysfs.c | 8 +++++++- drivers/macintosh/windfarm_smu_controls.c | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 07074820a167..58e676ca9622 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -362,7 +362,8 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, { struct macio_dev *dev; const u32 *reg; - + char name[MAX_NODE_NAME_SIZE + 1]; + if (np == NULL) return NULL; @@ -402,6 +403,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, #endif /* MacIO itself has a different reg, we use it's PCI base */ + snprintf(name, sizeof(name), "%pOFn", np); if (np == chip->of_node) { dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", chip->lbus.index, @@ -410,12 +412,12 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, #else 0, /* NuBus may want to do something better here */ #endif - MAX_NODE_NAME_SIZE, np->name); + MAX_NODE_NAME_SIZE, name); } else { reg = of_get_property(np, "reg", NULL); dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", chip->lbus.index, - reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); + reg ? *reg : 0, MAX_NODE_NAME_SIZE, name); } /* Setup interrupts & resources */ diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index ca4fcffe454b..d2451e58acb9 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c @@ -58,7 +58,13 @@ static ssize_t devspec_show(struct device *dev, static DEVICE_ATTR_RO(modalias); static DEVICE_ATTR_RO(devspec); -macio_config_of_attr (name, "%s\n"); +static ssize_t name_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%pOFn\n", dev->of_node); +} +static DEVICE_ATTR_RO(name); + macio_config_of_attr (type, "%s\n"); static struct attribute *macio_dev_attrs[] = { diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c index d174c7437337..86d65462a61c 100644 --- a/drivers/macintosh/windfarm_smu_controls.c +++ b/drivers/macintosh/windfarm_smu_controls.c @@ -277,7 +277,7 @@ static int __init smu_controls_init(void) fct = smu_fan_create(fan, 0); if (fct == NULL) { printk(KERN_WARNING "windfarm: Failed to create SMU " - "RPM fan %s\n", fan->name); + "RPM fan %pOFn\n", fan); continue; } list_add(&fct->link, &smu_fans); @@ -296,7 +296,7 @@ static int __init smu_controls_init(void) fct = smu_fan_create(fan, 1); if (fct == NULL) { printk(KERN_WARNING "windfarm: Failed to create SMU " - "PWM fan %s\n", fan->name); + "PWM fan %pOFn\n", fan); continue; } list_add(&fct->link, &smu_fans);