Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp418641lqe; Sat, 6 Apr 2024 06:52:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX/yu4DE61TCnHYQphJdmDafldvyuO1DCLcRMjuy6+/jQUvl9EHgS5jLqa3l6qv7Iu8vErAgwJ7kCtkBYKkaDH7Kviwg/ggTz/7ty7lTQ== X-Google-Smtp-Source: AGHT+IFWMLosV3E2LvR9fNvUdTuHbaE1YdpKiGvCtI+6Zv7rjX0eeS5Lyl8bkx3rBUdHuSUT88tY X-Received: by 2002:a05:6870:968a:b0:22e:bdf5:137b with SMTP id o10-20020a056870968a00b0022ebdf5137bmr4845613oaq.42.1712411541444; Sat, 06 Apr 2024 06:52:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712411541; cv=pass; d=google.com; s=arc-20160816; b=qnaZCe+Z/JgMjfJ43ViO/5i2itRl01CGVqICCwvHI5IDOhiJm6qJuRxbyGViPqvqFE qN4Lcxopt+mpLGVXyD/giCmLvo7nlX99DYUKgucsH+sfMlnabNloU8kqrKcNfFlj3ycL uKJ4o1L0wWPvpTjW6ZXiJFMFCocX3mZvY50c0Uk5xmmx4wvxZ4DnbkAXHFWCjFAL9DOG modJvPG7HadyBgJS14ehJZFqWpHl/KXVdLrE3EZX6Be4nG1UW6n/TqoxCBQnvGefENmi x/VIVcLkQ3/NWvH8idFvkhzFOorRRdvbmEyENTHrnj/FuP52czX68gorKrjfM9T16fQs RtLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:cc:to:subject :date:from:message-id; bh=L6ujCWQ1KpGA4vyYN1aXob90CKY1C8dBb1evxLzut/A=; fh=EqOm9cRo6+qAXZTH5ssyIveIaJ28u8AZjWrPGmeRPNo=; b=n9wdA7TbsgDXNm1Rr66bN+XtyNUHQmeU1T40U+FY4yTtJFUSbSYrsd6kEAYME7oul2 Sf2hm3Z81+yrYtUa2xUNQ8oRypkc1y11WsMSNsMuWu0P6cOAiof6WRdJLUxJkpVG7hNn jKHs0tkbRPJdsD66oUWbOhZKGwUv3vHaL2E7QO97qoQkn9fMtkFXRLumYwlNaqZBj3Cd QQV/7gTQ8oDsk5xusoQ/9nd20Nlj+4BKf0oY2dOdujVYKZNXT5tkRj1jH9tubmEzWZOQ yLUPLtjAP/9jIz9XcpO2JfsevaDvVcLLCTO6Oir8iIgH+4hXx2kb21yAaB19Yau1PtsR Y5rA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=wunner.de); spf=pass (google.com: domain of linux-kernel+bounces-133938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133938-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o6-20020a056a00214600b006e635eab42fsi3112893pfk.137.2024.04.06.06.52.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 06:52:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=wunner.de); spf=pass (google.com: domain of linux-kernel+bounces-133938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133938-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 73121282521 for ; Sat, 6 Apr 2024 13:52:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2727E374F9; Sat, 6 Apr 2024 13:52:13 +0000 (UTC) Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) (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 33CC213ACC; Sat, 6 Apr 2024 13:52:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.9.242.62 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712411532; cv=none; b=Q33Yu3yflhIdnRXeHSsLWGVTmN+pTiAyCsMO9QWRtyglEfytxZNDLVKeoVXJGUhdWmbeU/eErFjcMdihw1UJAaHIZ2UEGA4Lld1uqMIOy8tHOuYy06aS1RLlVKn12JLNXgpeqcdx1o5iVha9UJIl67WpySVgtg3S7SXul/5XqYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712411532; c=relaxed/simple; bh=c4P6XCqXe/1/PyNm0hEV/fhObLttlXBUccidgoz+KNA=; h=Message-Id:From:Date:Subject:To:Cc; b=mMlODrFL13/cWyvrkYkx65xwMpCoVHsmPZGNQd/w/SVmm3Z9wc5V/f9w9+vV3bds3ENFFIaq/pn8E5nfsdbO1aUPhZgIcBoM8//qjW5aPJ03Kf8XTuspVnsIJFB3d6OVfWNxfVvIy8Q21Zpw2VAQiWcOTw3AaMltZ2Lq+HagSxw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de; spf=pass smtp.mailfrom=wunner.de; arc=none smtp.client-ip=176.9.242.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wunner.de Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 94813100D943C; Sat, 6 Apr 2024 15:51:59 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 3B10F233389; Sat, 6 Apr 2024 15:51:59 +0200 (CEST) Message-Id: From: Lukas Wunner Date: Sat, 6 Apr 2024 15:52:00 +0200 Subject: [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, Jean Delvare , Ard Biesheuvel , linux-efi@vger.kernel.org, Zhenyu Wang , Zhi Wang , intel-gvt-dev@lists.freedesktop.org, Daniel Lezcano , linux-pm@vger.kernel.org, Luis Chamberlain , linux-modules@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: For my upcoming PCI device authentication v2 patches, I have the need to expose a simple buffer in virtual memory as a bin_attribute. It turns out we've duplicated the ->read() callback for such simple buffers a fair number of times across the tree. So instead of reinventing the wheel, I decided to introduce a common helper and eliminate all duplications I could find. I'm open to a bikeshedding discussion on the sysfs_bin_attr_simple_read() name. ;) Lukas Wunner (2): sysfs: Add sysfs_bin_attr_simple_read() helper treewide: Use sysfs_bin_attr_simple_read() helper arch/powerpc/platforms/powernv/opal.c | 10 +------- drivers/acpi/bgrt.c | 9 +------- drivers/firmware/dmi_scan.c | 12 ++-------- drivers/firmware/efi/rci2-table.c | 10 +------- drivers/gpu/drm/i915/gvt/firmware.c | 26 +++++---------------- .../intel/int340x_thermal/int3400_thermal.c | 9 +------- fs/sysfs/file.c | 27 ++++++++++++++++++++++ include/linux/sysfs.h | 15 ++++++++++++ init/initramfs.c | 10 +------- kernel/module/sysfs.c | 13 +---------- 10 files changed, 56 insertions(+), 85 deletions(-) -- 2.43.0