Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp110040imm; Fri, 7 Sep 2018 17:34:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbyQvVcHDWb78pupBT0k1bl4Ral9ZObqBs0ehQlMMAu3FyH+dVPD8J0nZmmb9CkviXdMhTi X-Received: by 2002:a63:5025:: with SMTP id e37-v6mr10776044pgb.341.1536366882143; Fri, 07 Sep 2018 17:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536366882; cv=none; d=google.com; s=arc-20160816; b=fDgogM+rDL4cYmx6byrD0eEGRIkfa8PhiBsKpswDTSBXdzgnWPOBjHkmgmr1TiAuUR eVX7ixClyKSRL2WL+SaxAzGSkYA/FTfdeT3foPCQOGrwlUUwcaXpTBTGHbEu6XQZ+6aF J5/qvmzTMYVG05B1vZop5GdpK30sNu3w1Q05awU3TH2sYMXH+asJa9Q0hPC5RKJozYW4 U/7XTTpcFXvXe4crcPHq57E8lPXWKMa8c/wC5UuE9VeBGgBYY3pOimVujMaUttX5BmK3 kay4AQcZXxrqVazcRoHdUiolf4TPnUHKqFt5nJhRBOl7gx9siP2F/C4/vbAFFf/GXYn2 WaPw== 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:date:cc:to:from:subject:message-id; bh=6srNEcePFXxNBkoxfQ63FUVclgp8LVklRqAkx92yJnE=; b=u7i+tcxBembh5PBJ/U83JhvJavnS62ukqq2HzdBGJoaZDSmkFbZpiRwXs9bhc8ht9g wpdrVmfNjHRRWLMX3thlGrnmqbHAXLG/oMNYRyDc6uqeudVSQSbg3het/kRdHr4nDVSk GgCg+z40i9SwVmWC6ZI4iPBa95HQdQYxqEjWgofR8txFXKjmlKdr6Y0TUEzTIlRYBVyn TdYDfJJhhSGmlskcMokcpkkpddJk+/7JTum+icr/Eicu8UI7+QnLXSimeuui89/Opha+ yJ/b5HML6EvqfRe0M9IYzSHjk05TQOt0wXjpsmS51xaAioQW9WPbhaAvWdKzL40xRV46 rOxA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si9192641pgp.256.2018.09.07.17.33.59; Fri, 07 Sep 2018 17:34:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726394AbeIHFN4 (ORCPT + 99 others); Sat, 8 Sep 2018 01:13:56 -0400 Received: from smtprelay0153.hostedemail.com ([216.40.44.153]:48318 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725731AbeIHFN4 (ORCPT ); Sat, 8 Sep 2018 01:13:56 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 9165F182CED28; Sat, 8 Sep 2018 00:30:26 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1394:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2553:2559:2562:2693:2828:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:6119:7514:7550:7875:7903:8660:9010:9108:10004:10400:10848:11026:11232:11658:11914:12043:12438:12555:12740:12760:12895:12986:13148:13230:13439:14181:14659:14721:21080:21433:21451:21627:30029:30054:30075:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:31,LUA_SUMMARY:none X-HE-Tag: crown99_5afa21c4fb04d X-Filterd-Recvd-Size: 3866 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Sat, 8 Sep 2018 00:30:25 +0000 (UTC) Message-ID: <0999919005219fa94ccc69ff57659d47911d3abd.camel@perches.com> Subject: Re: [PATCH 3/4] of: Convert to using %pOFn instead of device_node.name From: Joe Perches To: Thierry Reding , Rob Herring Cc: Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org Date: Fri, 07 Sep 2018 17:30:23 -0700 In-Reply-To: <20180907122928.GA5821@ulmo> References: <20180828155254.10709-1-robh@kernel.org> <20180828155254.10709-4-robh@kernel.org> <20180907122928.GA5821@ulmo> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-09-07 at 14:29 +0200, Thierry Reding wrote: > On Tue, Aug 28, 2018 at 10:52:53AM -0500, 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: Frank Rowand > > Cc: Andrew Lunn > > Cc: Florian Fainelli > > Cc: devicetree@vger.kernel.org > > Cc: netdev@vger.kernel.org > > Signed-off-by: Rob Herring > > --- > > drivers/of/device.c | 4 ++-- > > drivers/of/of_mdio.c | 12 ++++++------ > > drivers/of/of_numa.c | 4 ++-- > > drivers/of/overlay.c | 4 ++-- > > drivers/of/platform.c | 8 ++++---- > > drivers/of/unittest.c | 12 ++++++------ > > 6 files changed, 22 insertions(+), 22 deletions(-) > > > > diff --git a/drivers/of/device.c b/drivers/of/device.c > > index 5957cd4fa262..daa075d87317 100644 > > --- a/drivers/of/device.c > > +++ b/drivers/of/device.c > > @@ -219,7 +219,7 @@ static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len > > return -ENODEV; > > > > /* Name & Type */ > > - csize = snprintf(str, len, "of:N%sT%s", dev->of_node->name, > > + csize = snprintf(str, len, "of:N%pOFnT%s", dev->of_node, > > dev->of_node->type); > > tsize = csize; > > len -= csize; > > This seems to cause the modalias to be improperly constructed. As a > consequence, automatic module loading at boot time is now broken. I > think the reason why this fails is because vsnprintf() will skip all > alpha-numeric characters after a call to pointer(). Presumably this > is meant to be a generic way of skipping whatever specifiers we throw > at it. > > Unfortunately for the case of OF modaliases, this means that the 'T' > character gets eaten, so we end up with something like this: > > # udevadm info /sys/bus/platform/devices/54200000.dc > [...] > E: MODALIAS=of:NdcCnvidia,tegra124-dc > [...] > > instead of this: > > # udevadm info /sys/bus/platform/devices/54200000.dc > [...] > E: MODALIAS=of:NdcTCnvidia,tegra124-dc > [...] > > Everything is back to normal if I revert this patch. However, since > that's obviously not what we want, I think perhaps what we need is a > way for pointer() (and its implementations) to report back how many > characters in the format string it consumed so that we can support > these kinds of back-to-back strings. > > If nobody else has the time I can look into coding up a fix, but in the > meantime it might be best to back this one out until we can handle the > OF modalias format string. Or just use 2 consecutive snprintf calls csize = snprintf(str, len, "of:N%pOFn", dev->of_node); csize += snprintf(str + csize, len - csize, "T%s", dev->of_node->type);