From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D2D6CA9EAF for ; Mon, 21 Oct 2019 14:45:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1D3520640 for ; Mon, 21 Oct 2019 14:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571669153; bh=zSxr6boC9XHsm0JY6dQGUP4Y+pfXYhmlbUslvFJagHU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=CCDSD3x6jPMbfMKQcEiEJAHzo11zwxGojWNu9jJ2N0MKh78UT462GTh9vMctCzc5V GLnUis4+gZYRGnrcxN3LS49nP0O8pujRzVbgPskYQV0mh3UG6ToU3KXSt/MqSaVTfp QP5YYJolUNAvQQhU/9UeMRIYaofEg2wVz34o9JTI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728860AbfJUOpw (ORCPT ); Mon, 21 Oct 2019 10:45:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:41602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726987AbfJUOpw (ORCPT ); Mon, 21 Oct 2019 10:45:52 -0400 Received: from localhost (unknown [107.87.137.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A29D12053B; Mon, 21 Oct 2019 14:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571669151; bh=zSxr6boC9XHsm0JY6dQGUP4Y+pfXYhmlbUslvFJagHU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wzQU8e0ZUFNA8uAikS25qhU+PVVOE1nVLd8tB20kS4RhTnUBXXeHPWRWyrc6EfC/U 3MxufZMwym9OBnJTJHOyQO6DC35w13zixXNgT34vkVW+/WGisLaRsfWiKq9PCWqjMn eR5n3fRA7Hjg+DR0PEPA/XiaRHmax8grcGZk3iAs= Date: Mon, 21 Oct 2019 10:45:48 -0400 From: Greg Kroah-Hartman To: Geert Uytterhoeven Cc: Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/7] debugfs: Add debugfs_create_xul() for hexadecimal unsigned long Message-ID: <20191021144548.GA41107@kroah.com> References: <20191021143742.14487-1-geert+renesas@glider.be> <20191021143742.14487-2-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191021143742.14487-2-geert+renesas@glider.be> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 21, 2019 at 04:37:36PM +0200, Geert Uytterhoeven wrote: > The existing debugfs_create_ulong() function supports objects of > type "unsigned long", which are 32-bit or 64-bit depending on the > platform, in decimal form. To format objects in hexadecimal, various > debugfs_create_x*() functions exist, but all of them take fixed-size > types. > > Add a debugfs helper for "unsigned long" objects in hexadecimal format. > This avoids the need for users to open-code the same, or introduce > bugs when casting the value pointer to "u32 *" or "u64 *" to call > debugfs_create_x{32,64}(). > > Signed-off-by: Geert Uytterhoeven > --- > include/linux/debugfs.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h > index 33690949b45d6904..d7b2aebcc277d65e 100644 > --- a/include/linux/debugfs.h > +++ b/include/linux/debugfs.h > @@ -356,4 +356,14 @@ static inline ssize_t debugfs_write_file_bool(struct file *file, > > #endif > > +static inline void debugfs_create_xul(const char *name, umode_t mode, > + struct dentry *parent, > + unsigned long *value) > +{ > + if (sizeof(*value) == sizeof(u32)) > + debugfs_create_x32(name, mode, parent, (u32 *)value); > + else > + debugfs_create_x64(name, mode, parent, (u64 *)value); > +} Looks sane, but can you add some kernel-doc comments here so that we can pull it into the debugfs documentation? Also there is debugfs documentation in Documentation/filesystems/ so maybe also add this there? I am going to be overhauling the debugfs documentation "soon" but it's at the lower part of my todo list, so it will take a while, might as well keep it up to date with new stuff added like this so that people don't get lost. thanks, greg k-h