Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2050322lqt; Sun, 21 Apr 2024 22:47:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCORmVhntDghMEMV9jIDShKqTlzrlVjuOg6RdcrD7Ob1PnMJDQLtWhX7Yqj4yLQm5XIOybulknP21V4j2cUGWV1OcV0qRE8P2EETVxaA== X-Google-Smtp-Source: AGHT+IEx6DKazlhaI5Jll+5lXMkr/E8cYzriir5+8XyNuXqIENdo81EXFyvYizzDzDQeciNAcB5t X-Received: by 2002:a17:906:2786:b0:a55:75ff:ea12 with SMTP id j6-20020a170906278600b00a5575ffea12mr8318595ejc.4.1713764871794; Sun, 21 Apr 2024 22:47:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713764871; cv=pass; d=google.com; s=arc-20160816; b=1GVP7vnkHkywDaHd+M5P8FWM1gbbmrwm7VSGxEohd7uyPQeCw1w79S3R7+DlVjCp6a 3J8f3qOVwoXWNPVLuUOlCiwMXe/Dnsb19Hiavizg5iY2WkovLZnfvgOyqvIqfZxEVvTS 2iV1zwlsP48eZ7e2rO1Eh6BzPB1zWVT73SbJq3/NyypId5z5nxUou3BKKj/TGUQVkZwY 07THBwGQZk+W1pPL53CxDvWVqWox6kH9LrbPUDakLph+WBe1eVZaCnY96gWiwN+5gK0w ogy7adOiPT6tWj9yglLE4jhd37oRh3gi5NNIK08pUgA/JDo/f4DRnG1qX6/6AdlqU+YA VLeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=G/aHh5doH7tvZjPRnwTkrCGV4ORMj01WDY46RGpRjdE=; fh=RxpxbQWCDK8OT7tXCN4i93jgzpRYksWatjl5X84bLq8=; b=JlIKlhZbO3grnCZkA7k/Fo1RwduUBi3kBKpxH2ZWL8AoeucdKsiyAEOYOavsf1sMY8 wmUfBmMv+sdPqFP0PsE90dOJA07TrqLnl0nvI13OUu2cmWJm8sUL1dUCWEtXnH4/8Q7u JpCEGmXCS30NM1lpyeOPdOmKZ9nZrrg14iK0ebTypSrFhzIKGuDo/gjsjgdU1bk16045 25Om1jTcHbCX1kC442UmXdtGvs3xEOAL87emrepdbtvCeQQYs1o5qKJbH4iPBelSJaLA HRm13PmAonWgkNboEpWBv+5s3LqjXYxnzs30NUt4S/VZZ0+ugyOn7Bq/qLDBG+B9ZFuA yFhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Jl4rwGSv; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-152750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152750-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h20-20020a170906591400b00a521be3afe4si5656730ejq.637.2024.04.21.22.47.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 22:47:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Jl4rwGSv; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-152750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152750-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3491C1F22EA0 for ; Mon, 22 Apr 2024 05:39:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92C99182D8; Mon, 22 Apr 2024 05:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="Jl4rwGSv" Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BEAE1802B for ; Mon, 22 Apr 2024 05:38:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713764340; cv=none; b=ki6qw2d8R0z74laFko+g1cyn7IzC8Gou42OYvUJusIFSX4pRz/1HbbbCp03JP+5p3dzwWFl7px2J0/tc60UlvEU6n92OHlUQs612PzcOus29+fIze7LuWA5LEyTWuMvtTFatvBEMiqEFGp/ab9a92XqRZH8j0/6PUepWmR3Bvqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713764340; c=relaxed/simple; bh=OhPq8lW0Gy2yU8/iRbyTPAJ8uG7regcnybwN/4U2CJE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ZjAMtMrFJthpUWnYrXU1zz6Mtko2Bphdz2eyJ52HKNfSyIwZhPEy6E6DpCW5VcMEYFMb3Gc6n/zvh5chjoplOKVSAtkgHNiAQo/6jGA9dE0Cm4gFKJE2qEghzGyNyjbwWgqaxwPNT9+Cdo0iwi46kGWeRWq8oaB/f57toenh2ao= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=Jl4rwGSv; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1713764336; bh=G/aHh5doH7tvZjPRnwTkrCGV4ORMj01WDY46RGpRjdE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Jl4rwGSvyYZEL8vfNo6LWVlEY2KvjdbmHOClU3kUBuViu8mtWo9RUUDt7mloAKoCj 5lwpD1aEytFxTHdZhJ4rp0bNm+W1n1fHVvaCcpwH1z/A7dWahoxuvTWuKPpAL3Drwx 7bcuYrQkBedulrsAseLBI5/LHE1AgaCkOjWoj+SW2LsTWStm/+gN/EogiAIGIBLpva ov0sgF8nbfDr3MF46MSUtq2PATHC86BTpHRB4e3FRgSf4yGikPYVbozIa41KSgSw/5 +L8he12z7SSKpxn5avmyQzrlYQ/b3W6n2HbyKLlfOz/zgIwwaLXsaaBAixc70UJMeD 4NnpMqPSy0aaQ== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4VNDZS1QCmz4wyj; Mon, 22 Apr 2024 15:38:55 +1000 (AEST) From: Michael Ellerman To: Lukas Wunner , Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 1/6] driver core: Add device_show_string() helper for sysfs attributes In-Reply-To: <2e3eaaf2600bb55c0415c23ba301e809403a7aa2.1713608122.git.lukas@wunner.de> References: <2e3eaaf2600bb55c0415c23ba301e809403a7aa2.1713608122.git.lukas@wunner.de> Date: Mon, 22 Apr 2024 15:38:54 +1000 Message-ID: <87zftmj6s1.fsf@mail.lhotse> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Lukas Wunner writes: > For drivers wishing to expose an unsigned long, int or bool at a static > memory location in sysfs, the driver core provides ready-made helpers > such as device_show_ulong() to be used as ->show() callback. > > Some drivers need to expose a string and so far they all provide their > own ->show() implementation. arch/powerpc/perf/hv-24x7.c went so far > as to create a device_show_string() helper but kept it private. > > Make it public for reuse by other drivers. The pattern seems to be > sufficiently frequent to merit a public helper. > > Add a DEVICE_STRING_ATTR_RO() macro in line with the existing > DEVICE_ULONG_ATTR() and similar macros to ease declaration of string > attributes. > > Signed-off-by: Lukas Wunner > --- > arch/powerpc/perf/hv-24x7.c | 10 ---------- > drivers/base/core.c | 9 +++++++++ > include/linux/device.h | 15 +++++++++++++++ > 3 files changed, 24 insertions(+), 10 deletions(-) Acked-by: Michael Ellerman (powerpc) cheers