Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp550134pxk; Wed, 2 Sep 2020 08:32:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPBYggKs+U//Aj84vmL8u1E0kuP4/HTgMhZgQI7vL00nFKjy0MgBmmOwO3fXSw7ClnYhgj X-Received: by 2002:a05:6402:1d05:: with SMTP id dg5mr599839edb.67.1599060734212; Wed, 02 Sep 2020 08:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599060734; cv=none; d=google.com; s=arc-20160816; b=Jib0bq5jrqxOfCqCd/phDKX/kpd2awltRPvYfnF1OUe2bqWeHhRVeetL6e9R6QnxHb rGOpLAp/LaX7KnKQrf72GkF+ibya2L80lNxzU5KCz1wswbQ63WuVFD4qIu9zP7qzblvZ D6Mf28y1Ps61bIYEuyw2bJ/Arc+JM9+UsiE5BwIthOQxhiQZTjSHlm76XCX4wtIbq5Yb n+xScWkNlaE4yScsCyxjCNAb7OSfWwuKd7le0d9gCOzEX1Q65KflV8u881iwVXGu8Rat OUoTBO8DRZx1PPYKilV6jKtydRg+U4SWgAAgdADxTrTjs/SiEdsFljz1ZYiocOQThFix V5TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=jD0lwPUDPqJoqIP/rldiB6/kM7/2nzIIqQ1JR4uJSZ4=; b=ZUOehQdCaeh/IqnBBL/4AE6DZVj5b/FbG8k1GktnqER3vrcmSS7Ldk1tZE23L7zEr6 DOXm/PBCzFyjjxQ6VFL1PxReAhZ6zi7dfuyRaI0eLnm6vFfg+hqRCwKkYHbMMCw/kndA KyAhcg+ikDZ9OW1Ayk/djBy026Ff1GetVr41CAc77Lkq1BCph2npm6IYRqor9dlbWIIR DtXg7xhuNBdJWY9ZlBFIXwmZfAD7RLrApqnbkXh80UTA4shezOb4WVEnJrx+Xb0VE2Wd kGU2Q+NdqXf/nDKiq3vYkLETbEX9LtyLcpjYHD6vNDxJvV8l3YNWW7gCUm5LpoEh5gdJ Ed5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=goAr64A0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u7si2848826ejn.161.2020.09.02.08.31.51; Wed, 02 Sep 2020 08:32:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=goAr64A0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728314AbgIBPaW (ORCPT + 99 others); Wed, 2 Sep 2020 11:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728295AbgIBP3g (ORCPT ); Wed, 2 Sep 2020 11:29:36 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE8CFC061244 for ; Wed, 2 Sep 2020 08:29:34 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id e17so4830782wme.0 for ; Wed, 02 Sep 2020 08:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jD0lwPUDPqJoqIP/rldiB6/kM7/2nzIIqQ1JR4uJSZ4=; b=goAr64A0/objakxStXGU102b425PEBTJb988kX+Xua1JjIPCNHoE6zdJfzJ1tH2+mY IwPD2wkFcpTH5K9O9OwlD0dX6b+jHW/Dz/ODpLwon6huYezoaUoFUyUC2ZT4zKNMVFQ+ ywWe9HT0hJJPbid8kaQsSbLDP6vfcAhfjFA46+pUASi7bed38dyEVbW1PjvLglfEZZuh EyKrMmgIIEgZnqdu+W7XmURWrHyBPRbtVyh3GKtprzmllRSNqILIyGiUwR4U17XB7Xv5 ogvKJkDfojETV9KV6trm7WWcIKiFtXd0lnshlQLMwlzuXSF2L+7Q5H9epocaEAizZWAM 3miA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jD0lwPUDPqJoqIP/rldiB6/kM7/2nzIIqQ1JR4uJSZ4=; b=JnxNqBVIs747YjaLrM+/Ig+h8tc+j4YxvTQEfTZCA6Rxv0ICdevWlR91EpVjqeiKO9 BJlvlDkJwfwZYqkNa0rxPJ87PTldCrGlkIuu5VtTN9SVlht6aF+FTmE35glnWe6zyEo4 vDJM7tKCcgi0IzrBYYiswzIdWNyY3Wc/ZDNUIoGTnNsSCUBbQ8Ni1YMbUM1pxdwGHoio JzLJPwHsUdDRB39CE6tjRNAIaJHbp26OK4cdKkTeLHJuSq6a1qjoCg4+/6YiJet8LbdK wYVyKH4SdRlKHAUiGuahGxahNdpVLKXoff4CRKa4ozu9DqBc3A0+oKGdJfPiYJOmip3M Aefg== X-Gm-Message-State: AOAM530brOPoMZvC0GbanabyvIWUK1JMuuIbFrqYqdlIJfP+uMsCYn6g hZZ6bq+oRbchKMqMCSmMUes= X-Received: by 2002:a1c:9a57:: with SMTP id c84mr1218127wme.136.1599060573391; Wed, 02 Sep 2020 08:29:33 -0700 (PDT) Received: from medion (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id c14sm66193wrv.12.2020.09.02.08.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 08:29:32 -0700 (PDT) From: Alex Dewar X-Google-Original-From: Alex Dewar Date: Wed, 2 Sep 2020 16:29:30 +0100 To: Joe Perches Cc: Alex Dewar , Greg Kroah-Hartman , "Rafael J. Wysocki" , Christian Brauner , "David S. Miller" , Nayna Jain , Dan Williams , Sourabh Jain , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 0/2] simple sysfs wrappers for single values Message-ID: <20200902152930.mniirxa4iln2fqri@medion> References: <20200829233720.42640-1-alex.dewar90@gmail.com> <81c3499a5a09a82ddb4f3aa2bd9bfde1c0192b9e.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 29, 2020 at 06:23:13PM -0700, Joe Perches wrote: > On Sat, 2020-08-29 at 17:28 -0700, Joe Perches wrote: > > On Sun, 2020-08-30 at 00:37 +0100, Alex Dewar wrote: > > > Hi all, > > > > > > I've noticed there seems to have been a fair amount of discussion around > > > the subject of possible helper methods for use in the context of sysfs > > > show methods (which I haven't had a chance to go through in detail yet > > > -- sorry!), so I thought I'd send out a couple of patches I've been > > > working on for this, in case it's of any interest to anyone. > > > > If you really want to do this, I suggest you get use > > wrappers like sysfs_emit_string, sysfs_emit_int, sysfs_emit_u64 > > though I don't see _that_ much value. > > Just fyi: > > the treewide converted sysfs_emit uses > end up with these integer outputs: Thanks for looking at the code. It does look like my approach was a bit too simplistic! > > $ git grep -P -oh 'sysfs_emit\(buf, "%\d*[luixd]*\\n"' | \ > sort | uniq -c | sort -rn > 1482 sysfs_emit(buf, "%d\n" > 549 sysfs_emit(buf, "%u\n" > 118 sysfs_emit(buf, "%ld\n" > 100 sysfs_emit(buf, "%lu\n" > 78 sysfs_emit(buf, "%llu\n" > 62 sysfs_emit(buf, "%i\n" > 47 sysfs_emit(buf, "%x\n" > 24 sysfs_emit(buf, "%lld\n" > 12 sysfs_emit(buf, "%llx\n" > 12 sysfs_emit(buf, "%08x\n" > 12 sysfs_emit(buf, "%02x\n" > 10 sysfs_emit(buf, "%016llx\n" > 8 sysfs_emit(buf, "%04x\n" > 6 sysfs_emit(buf, "%lx\n" > 5 sysfs_emit(buf, "%02d\n" > 4 sysfs_emit(buf, "%04d\n" > 2 sysfs_emit(buf, "%08lx\n" > 1 sysfs_emit(buf, "%li\n" > 1 sysfs_emit(buf, "%4x\n" > 1 sysfs_emit(buf, "%0x\n" > 1 sysfs_emit(buf, "%06x\n" > 1 sysfs_emit(buf, "%03x\n" > 1 sysfs_emit(buf, "%01x\n" > > >