Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1970568imm; Fri, 7 Sep 2018 08:52:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaUy6fCut0ZnPW0o0ES6i/vzNATwD1jVKHD6CMxx43K0zazvsNoxdscwbKt0E2e1vxi3+a1 X-Received: by 2002:a62:2a48:: with SMTP id q69-v6mr9268989pfq.86.1536335567877; Fri, 07 Sep 2018 08:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536335567; cv=none; d=google.com; s=arc-20160816; b=jIANSrXpqxJdAt1ldouRqPkSe0RsXtn10LbkeVKKXXCz0FcCbFdwXFu2/AL55gDZsA T7tkTGcJ+BXU0E3mhIU/Qz0AH0wBcKBJ0+fjehzBopf4Hhcn0R5Mw/BBC8p9HkPfkMD7 FNg9OzQXCMK0n+X8NemIP4YSQXxnsPZn1Ej/KwVLwkhT1Ue1B+f/vTsLtIAZWPXIGGML fC96C9fZbfYoC+t9mXqPYqv77nJU3nphDp3k6nFBNEhPbb9ZoDDZpBS4nmcEwi/9ygLH KF9h/fY6PHpnYWy1K6wh/DlyLAx+mRIi8WSIOXdxEATRKR8Rpyzajo3CzYWw9Vs0xZUJ tNGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=V4dcIMVMigiMFZc5IPjhymxknvRvn87KnHE+FO5kKP0=; b=H++E4D3SZvBm+hhLinL2B5R+2q0/UVf54wvpFZpoN+AoEGBZNOGvHqhOhO16/tuFqf E9jzIjGT/Zil9sPcmL3/7EgIERdG1CUxzrh25GnH5RNTul7TZFMq8qb6w26HeUTc/xCd 0dGrQ713e+I6VnCaRpJTFCq+6Han8z1Ypb+L071fizREv64BkCXS5ABZ0Set99Sqz86M bALzmoyV1JgTVNrqiEB5JOt71+yw2QBb0IjmNct+ydwvz5ylx/9HZmWUFC9v9FzjF1wE Jy7JsaLtHL55+jmGgNkKc/MGQyfXMYCvafjoQHdKtL+1FORb5OoMfUWMkP5NT8UAzBMZ cEoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PIM29BjI; 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=pass (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 l64-v6si8119778pge.420.2018.09.07.08.52.32; Fri, 07 Sep 2018 08:52:47 -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=pass header.i=@kernel.org header.s=default header.b=PIM29BjI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730085AbeIGTjc (ORCPT + 99 others); Fri, 7 Sep 2018 15:39:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:58062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbeIGTjc (ORCPT ); Fri, 7 Sep 2018 15:39:32 -0400 Received: from mail-qt0-f172.google.com (mail-qt0-f172.google.com [209.85.216.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E2382077C; Fri, 7 Sep 2018 14:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536332294; bh=rjxB2sKnuYU0IGxZeuR58sYl6DzuKOHfmfnT+pGSEpo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PIM29BjIgnTUphXzRI5wRBq2HhCDJqtIHJUzeT9YJErZkVqjXgggIUvLqWxiN3FOK SNBYZGCBILCObChVfjIbx1F3A7qW38mmwSF+E20iOJDpH2VxXM/nYWNWe7/8u4Zxtx bMUhLZuh5qYDHHcK0vu+DvA8UFG3QSYDsC6QVZXQ= Received: by mail-qt0-f172.google.com with SMTP id n6-v6so16502726qtl.4; Fri, 07 Sep 2018 07:58:14 -0700 (PDT) X-Gm-Message-State: APzg51DJkF/hA0ZSdBqIcWszFqJ3dGLmSu7lmz0RtnYza8nc96jzXzol ADoUAEuaSjUSqjofJzi8CpHfDznUxgZq/CAfKw== X-Received: by 2002:ac8:46d3:: with SMTP id h19-v6mr6381907qto.188.1536332293258; Fri, 07 Sep 2018 07:58:13 -0700 (PDT) MIME-Version: 1.0 References: <20180828155254.10709-1-robh@kernel.org> <20180828155254.10709-4-robh@kernel.org> <20180907122928.GA5821@ulmo> In-Reply-To: <20180907122928.GA5821@ulmo> From: Rob Herring Date: Fri, 7 Sep 2018 09:58:01 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/4] of: Convert to using %pOFn instead of device_node.name To: Thierry Reding Cc: Frank Rowand , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Andrew Lunn , Florian Fainelli , netdev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 7, 2018 at 7:29 AM 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 > [...] Oops. Thanks for finding this. > 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. I don't think we can change it because if I have something like %pOFMoreWords and then later on want to add 'M' as a new modifier we'd break any existing cases with 'M'. Of course, I could search the tree for that case and find unused characters, but that seems fragile (though silently throwing away the characters does too). > 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. There's an easy fix though. Just replace the 'T' with a '%c'. I found one other case in the clock code and one in soundbus (which I haven't posted yet). Rob