Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1391556lqt; Sat, 20 Apr 2024 13:01:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9dOg5s+zkEd6rNctSyi+ISwuejkU3vzyTbUeKoXXMQwa9dhBh/vUga6s819rxzE09qFsMmLUTBJjFqFS0vDWsatRcRYWnAjICL82gnA== X-Google-Smtp-Source: AGHT+IEVDBInugAZUEz2fUWqqxUUCeEk88caFI0jaPP80HgxRp9aopue8G/zkV2LX73ld/rhlDo2 X-Received: by 2002:a05:6358:d39f:b0:17f:565c:8db2 with SMTP id mp31-20020a056358d39f00b0017f565c8db2mr7444574rwb.12.1713643317155; Sat, 20 Apr 2024 13:01:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713643317; cv=pass; d=google.com; s=arc-20160816; b=TYC84bv/K216MLcR/OInu++NCRJa090ZWqqaV0C291VZ+16yAw48fcQ7qlSpS6jJxP BvcdyaX7hrgFsA4l8yCXSCIItnp7qUicyTnCPXpb66QwRLdiQXJL9ZxZ4gvpR+QjxNUy t059QgKlz+ySsXfxEGyMNYUptkjCSBDj+XiL/NlOqqbOdF4OcSTB8fJNyhourFzp4Rlo GNGTQW/3G8obWphtW9VJBHjhh/AWBrsp/JpZoEmoYPvWGepZDFEBV0l/B6WzIhBroujZ SsstnbTToMs8Msv7Guvj+d8N+QnMORoqZ4+JBWkBbxQpNsYQMwZ2il6bFrcxoUF6QeSj 8jGQ== 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=9XidGRdwzUsFGYBlt3UC3rV1THaS/QTew+a0+wKSSEg=; fh=C+uaT9rWhyC7ynKlI6Wt/XKOkqeBlk/c4M1HO4Slffg=; b=FOXZ0ee8D4kGYeVwWOcCk+RCavoR4dUAjrUlJfNvZXJFkJ0cI5XFXKwn/yzdBfjLvA DXFiShhW9ZkodAjw9NEMFZZGzjp77Qvas38yH9FZaHL2Y2lOFUs+oZlQPRbhkPasV+Nj R6sUDh0ZFXQdiMccLqrUSF7PfQtSQimC06WVBbb7UVjiTrwGLiyJbqQMsC4YCpR7vCVD yMHn3kemSbrbVef68S83fywp7kxLkjIZU6RO7t360e25SmLhs3yZ4WK5CeJLO8tmgDpG bzb/3v3w9x4WwEpnNeGKXKPa8hMauU+K8DSy+3RFz2h/LRSnpRhxLbW3+u8gaclcafs1 5NHw==; 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-152364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152364-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pi25-20020a05620a379900b0078e487d0a25si6556059qkn.208.2024.04.20.13.01.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 13:01:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=wunner.de); spf=pass (google.com: domain of linux-kernel+bounces-152364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152364-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 79B931C20617 for ; Sat, 20 Apr 2024 20:01:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CE824655F; Sat, 20 Apr 2024 20:01:39 +0000 (UTC) Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) (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 49C953B299; Sat, 20 Apr 2024 20:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.78.240 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643298; cv=none; b=HXR3zDGrOv3dBoHOO5eTsEe4aRLednpV1cWsPTxM/WYySkVaL74TccRtxDPPk/RItSJ9TbfLmuYC1HAydjvw2+VatgYiEg2Zat9MGkctpTqXXiKwtEbdAybdywM5TsxsdgMDFk6uSlnyc3XCyAbq1DOVGC0tw8gvDJNFIxAercs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643298; c=relaxed/simple; bh=4xgw46KEtZnT9GMEWjwss10m249evoF6JijhofbNk+0=; h=Message-ID:From:Date:Subject:To:Cc; b=Z67eGNr4eGMEm2K2tzbuyzNSULCpORmXH9hP3d34hP/8JpRkd7dJ66N63V9BhRYin6Kj5TgE54h+veOjif/Fq/qREs3Fw96R9AgsRXO07cuu6Soy45HSk2ZnT/5RqCISFI5wag39h+ZNs6yVACzCV8oBQ0YhnfY6zo+HoDZh2LI= 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=83.223.78.240 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 bmailout2.hostsharing.net (Postfix) with ESMTPS id C6E382800C99F; Sat, 20 Apr 2024 22:01:24 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id BF393CC625; Sat, 20 Apr 2024 22:01:24 +0200 (CEST) Message-ID: From: Lukas Wunner Date: Sat, 20 Apr 2024 22:00:00 +0200 Subject: [PATCH 0/6] Deduplicate string exposure in sysfs To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org, Dennis Dalessandro , linux-rdma@vger.kernel.org, Shuai Xue , Will Deacon , Mark Rutland , Jonathan Cameron , Yicong Yang , Jijie Shao , Bjorn Andersson , Konrad Dybcio , Khuong Dinh , linux-arm-kernel@lists.infradead.org, Corentin Chary , "Luke D. Jones" , "Henrique de Moraes Holschuh" , ibm-acpi-devel@lists.sourceforge.net, Azael Avalos , Hans de Goede , "Ilpo Jaervinen" , platform-driver-x86@vger.kernel.org, Anil Gurumur thy , Sudarsana Kalluru , Tyrel Datwyler , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Don Brace , storagedev@microchip.com, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Introduce a generic ->show() callback to expose a string as a device attribute in sysfs. Deduplicate various identical callbacks across the tree. Result: Minus 216 LoC, minus 1576 bytes vmlinux size (x86_64 allyesconfig). This is a byproduct of my upcoming PCI device authentication v2 patches. Lukas Wunner (6): driver core: Add device_show_string() helper for sysfs attributes hwmon: Use device_show_string() helper for sysfs attributes IB/qib: Use device_show_string() helper for sysfs attributes perf: Use device_show_string() helper for sysfs attributes platform/x86: Use device_show_string() helper for sysfs attributes scsi: Use device_show_string() helper for sysfs attributes arch/powerpc/perf/hv-24x7.c | 10 ---- arch/x86/events/intel/core.c | 13 ++--- drivers/base/core.c | 9 ++++ drivers/hwmon/i5k_amb.c | 15 ++---- drivers/hwmon/ibmpex.c | 14 ++---- drivers/infiniband/hw/qib/qib.h | 1 - drivers/infiniband/hw/qib/qib_driver.c | 6 --- drivers/infiniband/hw/qib/qib_sysfs.c | 10 +--- drivers/perf/alibaba_uncore_drw_pmu.c | 12 +---- drivers/perf/arm-cci.c | 12 +---- drivers/perf/arm-ccn.c | 11 +---- drivers/perf/arm_cspmu/arm_cspmu.c | 10 ---- drivers/perf/arm_cspmu/arm_cspmu.h | 7 +-- drivers/perf/arm_dsu_pmu.c | 11 +---- drivers/perf/cxl_pmu.c | 13 +---- drivers/perf/hisilicon/hisi_pcie_pmu.c | 13 +---- drivers/perf/hisilicon/hisi_uncore_pmu.c | 14 ------ drivers/perf/hisilicon/hisi_uncore_pmu.h | 4 +- drivers/perf/hisilicon/hns3_pmu.c | 12 +---- drivers/perf/qcom_l3_pmu.c | 11 +---- drivers/perf/xgene_pmu.c | 11 +---- drivers/platform/x86/asus-wmi.c | 62 ++++++------------------ drivers/platform/x86/thinkpad_acpi.c | 10 +--- drivers/platform/x86/toshiba_acpi.c | 9 +--- drivers/scsi/bfa/bfad_attr.c | 28 +++-------- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 11 +---- drivers/scsi/mvsas/mv_init.c | 10 +--- drivers/scsi/qla2xxx/qla_attr.c | 11 +---- drivers/scsi/smartpqi/smartpqi_init.c | 11 ++--- include/linux/device.h | 15 ++++++ 30 files changed, 85 insertions(+), 301 deletions(-) -- 2.43.0