Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1972614ybl; Thu, 30 Jan 2020 09:11:20 -0800 (PST) X-Google-Smtp-Source: APXvYqy5tyYk72HwSAPPh9iIwAGMSsi/OdBbI0NMzkkvFAGnavCtzLCmkqyHqQfU6mTFBzPVhBnK X-Received: by 2002:a54:480c:: with SMTP id j12mr3509293oij.130.1580404280068; Thu, 30 Jan 2020 09:11:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580404280; cv=none; d=google.com; s=arc-20160816; b=OnLsKZgm+Yo9WylPmyGOexSKFiAmZ/A8e7lvHMAlPqX/XG1Q1h18CMnd2K0LDen2d1 Mu4W/brFrxQQkJV7y1/+uglLvPlRGE2iNV2fTpJbHPUPk3p0PY0R/ugPDsqTAOFeW4fr ogLMDdj6P/JAFwHW58E9i3ZIw37o29QVhLsEWK5pWTCdZBOz1GYTB68DE588z70+Kk9T W38412zL5iu1zatCtBGpEVvi1ZVXbLsc7LDKsAy1Xk9PxKqqBszicE1NOPU2CBnCsBoQ zeh7UCu8glUS4Sx6vf4nPXY30FXHJxh0uan71AWPIlurFlEnpygfG9cOpR3Md7zvQqka 0oQA== 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; bh=zCnXxzU/EUyxz2StGAYBKDJKmkVjS0wWM+yswum6tEc=; b=b7M9axb6By5qjtmOREAl4rQhVoC8HKlw0iEW99WhO/FB88NrqqhEYvwpkB8KGBq5NE e9LqfYvGXfVXG2NZWGdfjb7DEz+19lElxC4AX8KDQqcB9fl39MxeHjmVeIPGJNl7CyH2 jcugxfx4rdfvC7GopFqqop3Fjt+1AAzK8/tCXxLCchgMOH1KA37bm57h/A21FqnEgSm5 lk591X+5hp/sGZobez4s70qCZh/ssnfGb2A4DpXYQ0zRmCo8BaQV6oFagerL8OQTkYpf zFStlzFfwqv5FyvDkMA3wWVZ3bp0PAHirVwNpB8y6/578byUSnyrG0N2tIf7DLjqWrk1 v01w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=G39DJeW9; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z73si3120241oia.40.2020.01.30.09.11.06; Thu, 30 Jan 2020 09:11:20 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=G39DJeW9; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727446AbgA3RJz (ORCPT + 99 others); Thu, 30 Jan 2020 12:09:55 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:35078 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727417AbgA3RJz (ORCPT ); Thu, 30 Jan 2020 12:09:55 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 00UH8sTu120578; Thu, 30 Jan 2020 11:08:54 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1580404134; bh=zCnXxzU/EUyxz2StGAYBKDJKmkVjS0wWM+yswum6tEc=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=G39DJeW9wpm9C/7pNqXSda95uaioGn1Ihy5r/RUiX0c+l58jt9GtlfYrZ95LFcKMw 9+h3vai439QcZ6jcMzv2NnByN4gaI/JerdlZMNDzipRa5I0EiNxXxm9DEA3t9hs2hP A/ylH5/pLGwg2/PYQYczua4RutEdnmo+sOk08g3A= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 00UH8sdK126653 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 Jan 2020 11:08:54 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 30 Jan 2020 11:08:54 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 30 Jan 2020 11:08:54 -0600 Received: from [128.247.58.153] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 00UH8rQO026105; Thu, 30 Jan 2020 11:08:53 -0600 Subject: Re: [PATCH v2] mfd: syscon: Use a unique name with regmap_config To: Andy Shevchenko CC: Lee Jones , Arnd Bergmann , David Lechner , Tony Lindgren , Roger Quadros , Linux Kernel Mailing List , linux-arm Mailing List , Linux OMAP Mailing List References: <20200127231208.1443-1-s-anna@ti.com> From: Suman Anna Message-ID: <99a04c52-1ff6-1611-5cf6-2c71b810ba43@ti.com> Date: Thu, 30 Jan 2020 11:08:53 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On 1/30/20 9:34 AM, Andy Shevchenko wrote: > On Tue, Jan 28, 2020 at 1:14 AM Suman Anna wrote: >> >> The DT node full name is currently being used in regmap_config >> which in turn is used to create the regmap debugfs directories. >> This name however is not guaranteed to be unique and the regmap >> debugfs registration can fail in the cases where the syscon nodes >> have the same unit-address but are present in different DT node >> hierarchies. Replace this logic using the syscon reg resource >> address instead (inspired from logic used while creating platform >> devices) to ensure a unique name is given for each syscon. > >> - syscon_config.name = of_node_full_name(np); >> + syscon_config.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", np, >> + (u64)res.start); > > Explicit castings in printf() usually tell us that something is not okay. Yes, I agree in general. > Yes, for resource_size_t we have %pa. And that was the first thing I tried when doing v2, before moving away from it. This is not for a console printf statement, but is rather for the regmap debugfs name. Using a %pa adds the 0x and leading zeros in the debugfs name, when compared to the name before this patch. The typecast retains the current format, and replaces the unit-address without the leading 0s either. Introducing a local-variable to avoid the typecast is overkill. > > On top of that, I would rather see %pfwn to avoid modification for > other fwnode types. Did you mean %pfwP? That can probably be handled when syscon code is updated to use fwnode API. regards Suman