From nobody Wed Feb 11 04:18:06 2026 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [83.223.95.100]) (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 D716C8F6C for ; Sat, 20 Apr 2024 20:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.95.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643377; cv=none; b=Iukrm6OoU37BKkZeddeM088T+x+BCgXZGsmbWTttKarb50NF3HeIzU/+4ghbeOmeut1+8Y0DC4NftuIpBT1haYIx95cJWmMSU/DOxs3O/y26ReOpmlSn3sZjMeYMRW0GLoiPU41qRRr2TFYddCFrURHJhj+Qh+tCq37xFH+qeGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643377; c=relaxed/simple; bh=+JxH8dFXAsGZnl1VN1Unl6FLp+2yGtti2ERqBLuV1AQ=; h=Message-ID:In-Reply-To:References:From:Date:Subject:To:Cc; b=k7ymzgtz0WEVa+p/a9O6C5K5TP+OcOSoV2SUyuGuzN+3YE5HRZpNJ7VZ7BH22p1cQ+qyOHRjApqdyW+F093N6Kwv9z6dZO1eRi/eF5LpqNXegRVGckfDI8x5Z20h/y4Bfw+YXZq6gNVYNWM0X+pbw2bW3BSVRgzLsgnYepApAxY= 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.95.100 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 [83.223.95.28]) (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 bmailout1.hostsharing.net (Postfix) with ESMTPS id A1B9C30008F1A; Sat, 20 Apr 2024 22:02:46 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 9AB0ACC66D; Sat, 20 Apr 2024 22:02:46 +0200 (CEST) Message-ID: <2e3eaaf2600bb55c0415c23ba301e809403a7aa2.1713608122.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sat, 20 Apr 2024 22:00:01 +0200 Subject: [PATCH 1/6] driver core: Add device_show_string() helper for sysfs attributes To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: Michael Ellerman , linuxppc-dev@lists.ozlabs.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Michael Ellerman (powerpc) --- arch/powerpc/perf/hv-24x7.c | 10 ---------- drivers/base/core.c | 9 +++++++++ include/linux/device.h | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 057ec2e3451d..d400fa391c27 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -425,16 +425,6 @@ static char *memdup_to_str(char *maybe_str, int max_le= n, gfp_t gfp) return kasprintf(gfp, "%.*s", max_len, maybe_str); } =20 -static ssize_t device_show_string(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *d; - - d =3D container_of(attr, struct dev_ext_attribute, attr); - - return sprintf(buf, "%s\n", (char *)d->var); -} - static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/drivers/base/core.c b/drivers/base/core.c index 78dfa74ee18b..190d4a39c6a8 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2523,6 +2523,15 @@ ssize_t device_show_bool(struct device *dev, struct = device_attribute *attr, } EXPORT_SYMBOL_GPL(device_show_bool); =20 +ssize_t device_show_string(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct dev_ext_attribute *ea =3D to_ext_attr(attr); + + return sysfs_emit(buf, "%s\n", (char *)ea->var); +} +EXPORT_SYMBOL_GPL(device_show_string); + /** * device_release - free device structure. * @kobj: device's kobject. diff --git a/include/linux/device.h b/include/linux/device.h index c515ba5756e4..63ac65db3ecb 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -132,6 +132,8 @@ ssize_t device_show_bool(struct device *dev, struct dev= ice_attribute *attr, char *buf); ssize_t device_store_bool(struct device *dev, struct device_attribute *att= r, const char *buf, size_t count); +ssize_t device_show_string(struct device *dev, struct device_attribute *at= tr, + char *buf); =20 /** * DEVICE_ATTR - Define a device attribute. @@ -251,6 +253,19 @@ ssize_t device_store_bool(struct device *dev, struct d= evice_attribute *attr, struct dev_ext_attribute dev_attr_##_name =3D \ { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) } =20 +/** + * DEVICE_STRING_ATTR_RO - Define a device attribute backed by a r/o strin= g. + * @_name: Attribute name. + * @_mode: File mode. + * @_var: Identifier of string. + * + * Like DEVICE_ULONG_ATTR(), but @_var is a string. Because the length of = the + * string allocation is unknown, the attribute must be read-only. + */ +#define DEVICE_STRING_ATTR_RO(_name, _mode, _var) \ + struct dev_ext_attribute dev_attr_##_name =3D \ + { __ATTR(_name, (_mode) & ~0222, device_show_string, NULL), (_var) } + #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ struct device_attribute dev_attr_##_name =3D \ __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) --=20 2.43.0 From nobody Wed Feb 11 04:18:06 2026 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 CE16547F41; Sat, 20 Apr 2024 20:04:05 +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=1713643447; cv=none; b=LzDwkP+kzujEA2gFec0PfKYuriwPsnEnD5mH3U2ZezktVGTiqollw7Cjqio2fvrgOd37XxV3bdta1u9fG31N2f+EuC6znplF5WoxesqNCyTc9WLaconojStXcGrR0zQhaIWqzN7w0Qzupc+mB1mnARZLHCYu5orKQ6PfjDcfmeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643447; c=relaxed/simple; bh=7otAGZc9k9MKc/6B4+yMK3GVBxObnZ7gLnUmDP9hJug=; h=Message-ID:In-Reply-To:References:From:Date:Subject:To:Cc; b=fOGHHe6HUqFiQUT3QyN68Wn5laV0YCl15WziYN0wfjYq6BPDKV0tdzXfOQOEDL40lasaiMAsOh6HAX/jVHugGLeQzOyEVzxZNLAUArrswx55/bdYXKbJNXyNhbKapwrA8uQubJym0XV8XvGJ0WpehmGuYjcAe5BA6p4NdVyHTxU= 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 [83.223.95.28]) (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 246B71003D027; Sat, 20 Apr 2024 22:03:58 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id D4A3610C1A8; Sat, 20 Apr 2024 22:03:57 +0200 (CEST) Message-ID: <23c2031acaa64f1c02f00e817c3f7e4466d17ab2.1713608122.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sat, 20 Apr 2024 22:00:02 +0200 Subject: [PATCH 2/6] hwmon: Use device_show_string() helper for sysfs attributes To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Deduplicate sysfs ->show() callbacks which expose a string at a static memory location. Use the newly introduced device_show_string() helper in the driver core instead by declaring those sysfs attributes with DEVICE_STRING_ATTR_RO(). No functional change intended. Signed-off-by: Lukas Wunner Acked-by: Guenter Roeck --- drivers/hwmon/i5k_amb.c | 15 ++++----------- drivers/hwmon/ibmpex.c | 14 ++++---------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index ff48913fe6bf..02f5d35dd319 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c @@ -101,14 +101,7 @@ struct i5k_amb_data { unsigned int num_attrs; }; =20 -static ssize_t name_show(struct device *dev, struct device_attribute *deva= ttr, - char *buf) -{ - return sprintf(buf, "%s\n", DRVNAME); -} - - -static DEVICE_ATTR_RO(name); +static DEVICE_STRING_ATTR_RO(name, 0444, DRVNAME); =20 static struct platform_device *amb_pdev; =20 @@ -373,7 +366,7 @@ static int i5k_amb_hwmon_init(struct platform_device *p= dev) } } =20 - res =3D device_create_file(&pdev->dev, &dev_attr_name); + res =3D device_create_file(&pdev->dev, &dev_attr_name.attr); if (res) goto exit_remove; =20 @@ -386,7 +379,7 @@ static int i5k_amb_hwmon_init(struct platform_device *p= dev) return res; =20 exit_remove: - device_remove_file(&pdev->dev, &dev_attr_name); + device_remove_file(&pdev->dev, &dev_attr_name.attr); for (i =3D 0; i < data->num_attrs; i++) device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr); kfree(data->attrs); @@ -561,7 +554,7 @@ static void i5k_amb_remove(struct platform_device *pdev) struct i5k_amb_data *data =3D platform_get_drvdata(pdev); =20 hwmon_device_unregister(data->hwmon_dev); - device_remove_file(&pdev->dev, &dev_attr_name); + device_remove_file(&pdev->dev, &dev_attr_name.attr); for (i =3D 0; i < data->num_attrs; i++) device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr); kfree(data->attrs); diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index db066b368918..228c5f6c6f38 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c @@ -256,12 +256,7 @@ static struct ibmpex_bmc_data *get_bmc_data(int iface) return NULL; } =20 -static ssize_t name_show(struct device *dev, struct device_attribute *deva= ttr, - char *buf) -{ - return sprintf(buf, "%s\n", DRVNAME); -} -static SENSOR_DEVICE_ATTR_RO(name, name, 0); +static DEVICE_STRING_ATTR_RO(name, 0444, DRVNAME); =20 static ssize_t ibmpex_show_sensor(struct device *dev, struct device_attribute *devattr, @@ -415,8 +410,7 @@ static int ibmpex_find_sensors(struct ibmpex_bmc_data *= data) if (err) goto exit_remove; =20 - err =3D device_create_file(data->bmc_device, - &sensor_dev_attr_name.dev_attr); + err =3D device_create_file(data->bmc_device, &dev_attr_name.attr); if (err) goto exit_remove; =20 @@ -425,7 +419,7 @@ static int ibmpex_find_sensors(struct ibmpex_bmc_data *= data) exit_remove: device_remove_file(data->bmc_device, &sensor_dev_attr_reset_high_low.dev_attr); - device_remove_file(data->bmc_device, &sensor_dev_attr_name.dev_attr); + device_remove_file(data->bmc_device, &dev_attr_name.attr); for (i =3D 0; i < data->num_sensors; i++) for (j =3D 0; j < PEX_NUM_SENSOR_FUNCS; j++) { if (!data->sensors[i].attr[j].dev_attr.attr.name) @@ -516,7 +510,7 @@ static void ibmpex_bmc_delete(struct ibmpex_bmc_data *d= ata) =20 device_remove_file(data->bmc_device, &sensor_dev_attr_reset_high_low.dev_attr); - device_remove_file(data->bmc_device, &sensor_dev_attr_name.dev_attr); + device_remove_file(data->bmc_device, &dev_attr_name.attr); for (i =3D 0; i < data->num_sensors; i++) for (j =3D 0; j < PEX_NUM_SENSOR_FUNCS; j++) { if (!data->sensors[i].attr[j].dev_attr.attr.name) --=20 2.43.0 From nobody Wed Feb 11 04:18:06 2026 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [83.223.95.100]) (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 BF421E552; Sat, 20 Apr 2024 20:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.95.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643506; cv=none; b=KFNzOnLqeU3WHpwgRYuIQFdJyyyWTkgjRP/Nrn7BOq7vOkYj0rSv2A0TuuGCnl7YhaFfefu9Fa//tFrySSgenI2FtqXPxt3f3xFQRZkwlyg77VlENB+pHGwocz4SIKVByevVvhMT4taNwoLuhwmQIEFOIy6ZUgyexh/1nbWIM9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643506; c=relaxed/simple; bh=tZW+d2o3rJTJsOwQCingLnGoWaHIDq1joNIfMmZASPg=; h=Message-ID:In-Reply-To:References:From:Date:Subject:To:Cc; b=CxjYB3ln7bF1FtmKVYYrG+njAK2Q12FhJ3/kztAoh8CFoB2Qtm3U/6q9F6eiJ/1wqv62Hewnf1zFcNUeEycM1MsJn4mokGuRmATFI7Ca6Q8M3/ypxsk84nvhVRsycYRMjJqLWy/vLXiec6HigYPuK/1IGT9IXiLVPgwjjNrHFiY= 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.95.100 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 [83.223.95.28]) (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 bmailout1.hostsharing.net (Postfix) with ESMTPS id 6075330008CA3; Sat, 20 Apr 2024 22:05:02 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 59FA8120701; Sat, 20 Apr 2024 22:05:02 +0200 (CEST) Message-ID: <185a88dd3e6e18bf508a875d87c95ea2a5c3fa13.1713608122.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sat, 20 Apr 2024 22:00:03 +0200 Subject: [PATCH 3/6] IB/qib: Use device_show_string() helper for sysfs attributes To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: Dennis Dalessandro , linux-rdma@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Deduplicate sysfs ->show() callbacks which expose a string at a static memory location. Use the newly introduced device_show_string() helper in the driver core instead by declaring those sysfs attributes with DEVICE_STRING_ATTR_RO(). No functional change intended. Signed-off-by: Lukas Wunner --- drivers/infiniband/hw/qib/qib.h | 1 - drivers/infiniband/hw/qib/qib_driver.c | 6 ------ drivers/infiniband/hw/qib/qib_sysfs.c | 10 ++-------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qi= b.h index 26c615772be3..8ee4edd7883c 100644 --- a/drivers/infiniband/hw/qib/qib.h +++ b/drivers/infiniband/hw/qib/qib.h @@ -1359,7 +1359,6 @@ static inline u32 qib_get_rcvhdrtail(const struct qib= _ctxtdata *rcd) * sysfs interface. */ =20 -extern const char ib_qib_version[]; extern const struct attribute_group qib_attr_group; extern const struct attribute_group *qib_attr_port_groups[]; =20 diff --git a/drivers/infiniband/hw/qib/qib_driver.c b/drivers/infiniband/hw= /qib/qib_driver.c index bf3fa12fe935..4fcbef99e400 100644 --- a/drivers/infiniband/hw/qib/qib_driver.c +++ b/drivers/infiniband/hw/qib/qib_driver.c @@ -44,12 +44,6 @@ =20 #include "qib.h" =20 -/* - * The size has to be longer than this string, so we can append - * board/chip information to it in the init code. - */ -const char ib_qib_version[] =3D QIB_DRIVER_VERSION "\n"; - DEFINE_MUTEX(qib_mutex); /* general driver use */ =20 unsigned qib_ibmtu; diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/= qib/qib_sysfs.c index 41c272980f91..53ec7510e4eb 100644 --- a/drivers/infiniband/hw/qib/qib_sysfs.c +++ b/drivers/infiniband/hw/qib/qib_sysfs.c @@ -585,13 +585,7 @@ static ssize_t hca_type_show(struct device *device, static DEVICE_ATTR_RO(hca_type); static DEVICE_ATTR(board_id, 0444, hca_type_show, NULL); =20 -static ssize_t version_show(struct device *device, - struct device_attribute *attr, char *buf) -{ - /* The string printed here is already newline-terminated. */ - return sysfs_emit(buf, "%s", (char *)ib_qib_version); -} -static DEVICE_ATTR_RO(version); +static DEVICE_STRING_ATTR_RO(version, 0444, QIB_DRIVER_VERSION); =20 static ssize_t boardversion_show(struct device *device, struct device_attribute *attr, char *buf) @@ -721,7 +715,7 @@ static struct attribute *qib_attributes[] =3D { &dev_attr_hw_rev.attr, &dev_attr_hca_type.attr, &dev_attr_board_id.attr, - &dev_attr_version.attr, + &dev_attr_version.attr.attr, &dev_attr_nctxts.attr, &dev_attr_nfreectxts.attr, &dev_attr_serial.attr, --=20 2.43.0 From nobody Wed Feb 11 04:18:06 2026 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [83.223.95.100]) (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 442D6374F7 for ; Sat, 20 Apr 2024 20:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.95.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643576; cv=none; b=K8R1kn7Dc8b4F+mhY53NUN+SelNxdUXjqgd/K40+sAeqO+FqLZFBuV7oF4GIRw9xGgRvSouOFiam43JXNxV233+Z/sPhoUFHQhgvld3KedspQdX8jyo97X3YgxY9PLbzJexmB+mK5NSrw8tjWiDVR/kPyjasR6yLzS7BXCnmuK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643576; c=relaxed/simple; bh=SJLsBVmhwlj1yVLisqQ5YBDEm+4Aq95LOI1Ys1f7Uug=; h=Message-ID:In-Reply-To:References:From:Date:Subject:To:Cc; b=Gsj/k42PbHb2M0mVUtAPaf40rrUJMllMlDYqhlZNd0xaW0T6VyVGatUt8mWWb9cr9bno2u3cLCUyeGQM+InhpwkJghxZEJKbYyQjK9Rvv1MCNAqZe/qI9dqKQluMmPjPTlUf9F0JAuPD/tw4xb3jB6rRFWYR6DtN194EgTA31xU= 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.95.100 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 [83.223.95.28]) (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 bmailout1.hostsharing.net (Postfix) with ESMTPS id 6E8F330008F1C; Sat, 20 Apr 2024 22:06:12 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 6895E120701; Sat, 20 Apr 2024 22:06:12 +0200 (CEST) Message-ID: <3a297850312b4ecb62d6872121de04496900f502.1713608122.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sat, 20 Apr 2024 22:00:04 +0200 Subject: [PATCH 4/6] perf: Use device_show_string() helper for sysfs attributes To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: Shuai Xue , Will Deacon , Mark Rutland , Jonathan Cameron , Yicong Yang , Jijie Shao , Bjorn Andersson , Konrad Dybcio , Khuong Dinh , linux-arm-kernel@lists.infradead.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Deduplicate sysfs ->show() callbacks which expose a string at a static memory location. Use the newly introduced device_show_string() helper in the driver core instead by declaring those sysfs attributes with DEVICE_STRING_ATTR_RO(). No functional change intended. Signed-off-by: Lukas Wunner --- arch/x86/events/intel/core.c | 13 +++---------- 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 +---------- 14 files changed, 15 insertions(+), 139 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 768d1414897f..38c1b1f1deaa 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -5645,18 +5645,11 @@ lbr_is_visible(struct kobject *kobj, struct attribu= te *attr, int i) =20 static char pmu_name_str[30]; =20 -static ssize_t pmu_name_show(struct device *cdev, - struct device_attribute *attr, - char *buf) -{ - return snprintf(buf, PAGE_SIZE, "%s\n", pmu_name_str); -} - -static DEVICE_ATTR_RO(pmu_name); +static DEVICE_STRING_ATTR_RO(pmu_name, 0444, pmu_name_str); =20 static struct attribute *intel_pmu_caps_attrs[] =3D { - &dev_attr_pmu_name.attr, - NULL + &dev_attr_pmu_name.attr.attr, + NULL }; =20 static DEVICE_ATTR(allow_tsx_force_abort, 0644, diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_u= ncore_drw_pmu.c index a9277dcf90ce..a82592e131ba 100644 --- a/drivers/perf/alibaba_uncore_drw_pmu.c +++ b/drivers/perf/alibaba_uncore_drw_pmu.c @@ -236,24 +236,16 @@ static const struct attribute_group ali_drw_pmu_cpuma= sk_attr_group =3D { .attrs =3D ali_drw_pmu_cpumask_attrs, }; =20 -static ssize_t ali_drw_pmu_identifier_show(struct device *dev, - struct device_attribute *attr, - char *page) -{ - return sysfs_emit(page, "%s\n", "ali_drw_pmu"); -} - static umode_t ali_drw_pmu_identifier_attr_visible(struct kobject *kobj, struct attribute *attr, int n) { return attr->mode; } =20 -static struct device_attribute ali_drw_pmu_identifier_attr =3D - __ATTR(identifier, 0444, ali_drw_pmu_identifier_show, NULL); +static DEVICE_STRING_ATTR_RO(ali_drw_pmu_identifier, 0444, "ali_drw_pmu"); =20 static struct attribute *ali_drw_pmu_identifier_attrs[] =3D { - &ali_drw_pmu_identifier_attr.attr, + &dev_attr_ali_drw_pmu_identifier.attr.attr, NULL }; =20 diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c index 6be03f81ae5d..e516edc933f2 100644 --- a/drivers/perf/arm-cci.c +++ b/drivers/perf/arm-cci.c @@ -127,8 +127,6 @@ enum cci_models { =20 static void pmu_write_counters(struct cci_pmu *cci_pmu, unsigned long *mask); -static ssize_t __maybe_unused cci_pmu_format_show(struct device *dev, - struct device_attribute *attr, char *buf); static ssize_t __maybe_unused cci_pmu_event_show(struct device *dev, struct device_attribute *attr, char *buf); =20 @@ -138,7 +136,7 @@ static ssize_t __maybe_unused cci_pmu_event_show(struct= device *dev, })[0].attr.attr =20 #define CCI_FORMAT_EXT_ATTR_ENTRY(_name, _config) \ - CCI_EXT_ATTR_ENTRY(_name, cci_pmu_format_show, (char *)_config) + CCI_EXT_ATTR_ENTRY(_name, device_show_string, _config) #define CCI_EVENT_EXT_ATTR_ENTRY(_name, _config) \ CCI_EXT_ATTR_ENTRY(_name, cci_pmu_event_show, (unsigned long)_config) =20 @@ -688,14 +686,6 @@ static void __cci_pmu_disable(struct cci_pmu *cci_pmu) writel(val, cci_pmu->ctrl_base + CCI_PMCR); } =20 -static ssize_t cci_pmu_format_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *eattr =3D container_of(attr, - struct dev_ext_attribute, attr); - return sysfs_emit(buf, "%s\n", (char *)eattr->var); -} - static ssize_t cci_pmu_event_show(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c index 641471bd5eff..e4408acd4450 100644 --- a/drivers/perf/arm-ccn.c +++ b/drivers/perf/arm-ccn.c @@ -215,18 +215,9 @@ static void arm_ccn_pmu_config_set(u64 *config, u32 no= de_xp, u32 type, u32 port) *config |=3D (node_xp << 0) | (type << 8) | (port << 24); } =20 -static ssize_t arm_ccn_pmu_format_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *ea =3D container_of(attr, - struct dev_ext_attribute, attr); - - return sysfs_emit(buf, "%s\n", (char *)ea->var); -} - #define CCN_FORMAT_ATTR(_name, _config) \ struct dev_ext_attribute arm_ccn_pmu_format_attr_##_name =3D \ - { __ATTR(_name, S_IRUGO, arm_ccn_pmu_format_show, \ + { __ATTR(_name, S_IRUGO, device_show_string, \ NULL), _config } =20 static CCN_FORMAT_ATTR(node, "config:0-7"); diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/ar= m_cspmu.c index b9a252272f1e..7aff616523ec 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -223,16 +223,6 @@ arm_cspmu_event_attr_is_visible(struct kobject *kobj, return attr->mode; } =20 -ssize_t arm_cspmu_sysfs_format_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct dev_ext_attribute *eattr =3D - container_of(attr, struct dev_ext_attribute, attr); - return sysfs_emit(buf, "%s\n", (char *)eattr->var); -} -EXPORT_SYMBOL_GPL(arm_cspmu_sysfs_format_show); - static struct attribute *arm_cspmu_format_attrs[] =3D { ARM_CSPMU_FORMAT_EVENT_ATTR, ARM_CSPMU_FORMAT_FILTER_ATTR, diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/ar= m_cspmu.h index c9163acfe810..2621f3111148 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.h +++ b/drivers/perf/arm_cspmu/arm_cspmu.h @@ -28,7 +28,7 @@ })[0].attr.attr) =20 #define ARM_CSPMU_FORMAT_ATTR(_name, _config) \ - ARM_CSPMU_EXT_ATTR(_name, arm_cspmu_sysfs_format_show, (char *)_config) + ARM_CSPMU_EXT_ATTR(_name, device_show_string, _config) =20 #define ARM_CSPMU_EVENT_ATTR(_name, _config) \ PMU_EVENT_ATTR_ID(_name, arm_cspmu_sysfs_event_show, _config) @@ -167,11 +167,6 @@ ssize_t arm_cspmu_sysfs_event_show(struct device *dev, struct device_attribute *attr, char *buf); =20 -/* Default function to show format attribute in sysfs. */ -ssize_t arm_cspmu_sysfs_format_show(struct device *dev, - struct device_attribute *attr, - char *buf); - /* Register vendor backend. */ int arm_cspmu_impl_register(const struct arm_cspmu_impl_match *impl_match); =20 diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c index bae3ca37f846..4e54ce9100a6 100644 --- a/drivers/perf/arm_dsu_pmu.c +++ b/drivers/perf/arm_dsu_pmu.c @@ -85,7 +85,7 @@ DSU_EXT_ATTR(_name, dsu_pmu_sysfs_event_show, (unsigned long)_config) =20 #define DSU_FORMAT_ATTR(_name, _config) \ - DSU_EXT_ATTR(_name, dsu_pmu_sysfs_format_show, (char *)_config) + DSU_EXT_ATTR(_name, device_show_string, _config) =20 #define DSU_CPUMASK_ATTR(_name, _config) \ DSU_EXT_ATTR(_name, dsu_pmu_cpumask_show, (unsigned long)_config) @@ -139,15 +139,6 @@ static ssize_t dsu_pmu_sysfs_event_show(struct device = *dev, return sysfs_emit(buf, "event=3D0x%lx\n", (unsigned long)eattr->var); } =20 -static ssize_t dsu_pmu_sysfs_format_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct dev_ext_attribute *eattr =3D container_of(attr, - struct dev_ext_attribute, attr); - return sysfs_emit(buf, "%s\n", (char *)eattr->var); -} - static ssize_t dsu_pmu_cpumask_show(struct device *dev, struct device_attribute *attr, char *buf) diff --git a/drivers/perf/cxl_pmu.c b/drivers/perf/cxl_pmu.c index 308c9969642e..c41263c7fe5c 100644 --- a/drivers/perf/cxl_pmu.c +++ b/drivers/perf/cxl_pmu.c @@ -208,21 +208,10 @@ static int cxl_pmu_parse_caps(struct device *dev, str= uct cxl_pmu_info *info) return 0; } =20 -static ssize_t cxl_pmu_format_sysfs_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *eattr; - - eattr =3D container_of(attr, struct dev_ext_attribute, attr); - - return sysfs_emit(buf, "%s\n", (char *)eattr->var); -} - #define CXL_PMU_FORMAT_ATTR(_name, _format)\ (&((struct dev_ext_attribute[]) { \ { \ - .attr =3D __ATTR(_name, 0444, \ - cxl_pmu_format_sysfs_show, NULL), \ + .attr =3D __ATTR(_name, 0444, device_show_string, NULL), \ .var =3D (void *)_format \ } \ })[0].attr.attr) diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilico= n/hisi_pcie_pmu.c index 5d1f0e9fdb08..dfd1f448f3fc 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -99,16 +99,6 @@ HISI_PCIE_PMU_FILTER_ATTR(len_mode, config1, 11, 10); HISI_PCIE_PMU_FILTER_ATTR(port, config2, 15, 0); HISI_PCIE_PMU_FILTER_ATTR(bdf, config2, 31, 16); =20 -static ssize_t hisi_pcie_format_sysfs_show(struct device *dev, struct devi= ce_attribute *attr, - char *buf) -{ - struct dev_ext_attribute *eattr; - - eattr =3D container_of(attr, struct dev_ext_attribute, attr); - - return sysfs_emit(buf, "%s\n", (char *)eattr->var); -} - static ssize_t hisi_pcie_event_sysfs_show(struct device *dev, struct devic= e_attribute *attr, char *buf) { @@ -120,8 +110,7 @@ static ssize_t hisi_pcie_event_sysfs_show(struct device= *dev, struct device_attr =20 #define HISI_PCIE_PMU_FORMAT_ATTR(_name, _format) = \ (&((struct dev_ext_attribute[]){ \ - { .attr =3D __ATTR(_name, 0444, hisi_pcie_format_sysfs_show, \ - NULL), \ + { .attr =3D __ATTR(_name, 0444, device_show_string, NULL), \ .var =3D (void *)_format } \ })[0].attr.attr) =20 diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisili= con/hisi_uncore_pmu.c index 04031450d5fe..382c5567e4e2 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c @@ -22,20 +22,6 @@ =20 #define HISI_MAX_PERIOD(nr) (GENMASK_ULL((nr) - 1, 0)) =20 -/* - * PMU format attributes - */ -ssize_t hisi_format_sysfs_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *eattr; - - eattr =3D container_of(attr, struct dev_ext_attribute, attr); - - return sysfs_emit(buf, "%s\n", (char *)eattr->var); -} -EXPORT_SYMBOL_GPL(hisi_format_sysfs_show); - /* * PMU event attributes */ diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.h b/drivers/perf/hisili= con/hisi_uncore_pmu.h index 92402aa69d70..25b2d43b72bf 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.h +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.h @@ -33,7 +33,7 @@ })[0].attr.attr) =20 #define HISI_PMU_FORMAT_ATTR(_name, _config) \ - HISI_PMU_ATTR(_name, hisi_format_sysfs_show, (void *)_config) + HISI_PMU_ATTR(_name, device_show_string, _config) #define HISI_PMU_EVENT_ATTR(_name, _config) \ HISI_PMU_ATTR(_name, hisi_event_sysfs_show, (unsigned long)_config) =20 @@ -122,8 +122,6 @@ void hisi_uncore_pmu_enable(struct pmu *pmu); void hisi_uncore_pmu_disable(struct pmu *pmu); ssize_t hisi_event_sysfs_show(struct device *dev, struct device_attribute *attr, char *buf); -ssize_t hisi_format_sysfs_show(struct device *dev, - struct device_attribute *attr, char *buf); ssize_t hisi_cpumask_sysfs_show(struct device *dev, struct device_attribute *attr, char *buf); int hisi_uncore_pmu_online_cpu(unsigned int cpu, struct hlist_node *node); diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns= 3_pmu.c index 16869bf5bf4c..6d9725bdff83 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -363,16 +363,6 @@ HNS3_PMU_FILTER_ATTR(global, config1, 52, 52); HNS3_PMU_EVT_PPS_##_name##_TIME, \ HNS3_PMU_FILTER_INTR_##_name}) =20 -static ssize_t hns3_pmu_format_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *eattr; - - eattr =3D container_of(attr, struct dev_ext_attribute, attr); - - return sysfs_emit(buf, "%s\n", (char *)eattr->var); -} - static ssize_t hns3_pmu_event_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -421,7 +411,7 @@ static ssize_t hns3_pmu_filter_mode_show(struct device = *dev, })[0].attr.attr) =20 #define HNS3_PMU_FORMAT_ATTR(_name, _format) \ - HNS3_PMU_ATTR(_name, hns3_pmu_format_show, (void *)_format) + HNS3_PMU_ATTR(_name, device_show_string, _format) #define HNS3_PMU_EVENT_ATTR(_name, _event) \ HNS3_PMU_ATTR(_name, hns3_pmu_event_show, (void *)_event) #define HNS3_PMU_FLT_MODE_ATTR(_name, _event) \ diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c index f16783d03db7..5fc53781afba 100644 --- a/drivers/perf/qcom_l3_pmu.c +++ b/drivers/perf/qcom_l3_pmu.c @@ -609,18 +609,9 @@ static void qcom_l3_cache__event_read(struct perf_even= t *event) =20 /* formats */ =20 -static ssize_t l3cache_pmu_format_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *eattr; - - eattr =3D container_of(attr, struct dev_ext_attribute, attr); - return sysfs_emit(buf, "%s\n", (char *) eattr->var); -} - #define L3CACHE_PMU_FORMAT_ATTR(_name, _config) \ (&((struct dev_ext_attribute[]) { \ - { .attr =3D __ATTR(_name, 0444, l3cache_pmu_format_show, NULL), \ + { .attr =3D __ATTR(_name, 0444, device_show_string, NULL), \ .var =3D (void *) _config, } \ })[0].attr.attr) =20 diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c index 0d49343d704b..79279a359995 100644 --- a/drivers/perf/xgene_pmu.c +++ b/drivers/perf/xgene_pmu.c @@ -162,18 +162,9 @@ enum xgene_pmu_dev_type { /* * sysfs format attributes */ -static ssize_t xgene_pmu_format_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct dev_ext_attribute *eattr; - - eattr =3D container_of(attr, struct dev_ext_attribute, attr); - return sysfs_emit(buf, "%s\n", (char *) eattr->var); -} - #define XGENE_PMU_FORMAT_ATTR(_name, _config) \ (&((struct dev_ext_attribute[]) { \ - { .attr =3D __ATTR(_name, S_IRUGO, xgene_pmu_format_show, NULL), \ + { .attr =3D __ATTR(_name, S_IRUGO, device_show_string, NULL), \ .var =3D (void *) _config, } \ })[0].attr.attr) =20 --=20 2.43.0 From nobody Wed Feb 11 04:18:06 2026 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 550ED374F7; Sat, 20 Apr 2024 20:07:35 +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=1713643657; cv=none; b=vDjbuslxXaL1qvoPU3wJZAIftTSAnL7UNHUtzGnUavanwbYy+xUg+DzzcPcTOJ8Qw7ZrgflZo+n/GoGMBVm3PYHTUZcEvqQTH1HEVjqNzvPJ2KHk3voLiSoeUlrBpgRrSoikkTZtYMZudgfWLf4lpMtV6vBKA6uSf3FzpQcP6EA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643657; c=relaxed/simple; bh=N2bafYYP+b4kw+NKMOsMMvGGjOuIQlEGeTYftOJBCZI=; h=Message-ID:In-Reply-To:References:From:Date:Subject:To:Cc; b=tTpcRCUH0nok4yFmBvxOBwMSjB0N0rpdhbWKJZYWyJozqPM9e2iPkCf06Pe+tfPA9b53g9KuHrJ31f/5e7+19aqYXk5ZhrRTbEBTjBWfs3yDZcqcFsxqErKC/769LqySr4Bz4pbNzo5omTk65EWmMO5UjecGX6fF+oXphM2HW0E= 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 ED4D01003D027; Sat, 20 Apr 2024 22:07:32 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id C669A1D3F8; Sat, 20 Apr 2024 22:07:32 +0200 (CEST) Message-ID: <3ae8c9a73fbb291c1c863777af175c657a2a10e9.1713608122.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sat, 20 Apr 2024 22:00:05 +0200 Subject: [PATCH 5/6] platform/x86: Use device_show_string() helper for sysfs attributes To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Deduplicate sysfs ->show() callbacks which expose a string at a static memory location. Use the newly introduced device_show_string() helper in the driver core instead by declaring those sysfs attributes with DEVICE_STRING_ATTR_RO(). No functional change intended. Signed-off-by: Lukas Wunner Acked-by: Hans de Goede --- drivers/platform/x86/asus-wmi.c | 62 +++++++--------------------- drivers/platform/x86/thinkpad_acpi.c | 10 +---- drivers/platform/x86/toshiba_acpi.c | 9 +--- 3 files changed, 20 insertions(+), 61 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wm= i.c index 3f07bbf809ef..78d7579b2fdd 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -915,17 +915,12 @@ static ssize_t kbd_rgb_mode_store(struct device *dev, } static DEVICE_ATTR_WO(kbd_rgb_mode); =20 -static ssize_t kbd_rgb_mode_index_show(struct device *device, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", "cmd mode red green blue speed"); -} -static DEVICE_ATTR_RO(kbd_rgb_mode_index); +static DEVICE_STRING_ATTR_RO(kbd_rgb_mode_index, 0444, + "cmd mode red green blue speed"); =20 static struct attribute *kbd_rgb_mode_attrs[] =3D { &dev_attr_kbd_rgb_mode.attr, - &dev_attr_kbd_rgb_mode_index.attr, + &dev_attr_kbd_rgb_mode_index.attr.attr, NULL, }; =20 @@ -967,17 +962,12 @@ static ssize_t kbd_rgb_state_store(struct device *dev, } static DEVICE_ATTR_WO(kbd_rgb_state); =20 -static ssize_t kbd_rgb_state_index_show(struct device *device, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", "cmd boot awake sleep keyboard"); -} -static DEVICE_ATTR_RO(kbd_rgb_state_index); +static DEVICE_STRING_ATTR_RO(kbd_rgb_state_index, 0444, + "cmd boot awake sleep keyboard"); =20 static struct attribute *kbd_rgb_state_attrs[] =3D { &dev_attr_kbd_rgb_state.attr, - &dev_attr_kbd_rgb_state_index.attr, + &dev_attr_kbd_rgb_state_index.attr.attr, NULL, }; =20 @@ -2493,13 +2483,6 @@ static ssize_t pwm1_enable_store(struct device *dev, return count; } =20 -static ssize_t fan1_label_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", ASUS_FAN_DESC); -} - static ssize_t asus_hwmon_temp1(struct device *dev, struct device_attribute *attr, char *buf) @@ -2534,13 +2517,6 @@ static ssize_t fan2_input_show(struct device *dev, return sysfs_emit(buf, "%d\n", value * 100); } =20 -static ssize_t fan2_label_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", ASUS_GPU_FAN_DESC); -} - /* Middle/Center fan on modern ROG laptops */ static ssize_t fan3_input_show(struct device *dev, struct device_attribute *attr, @@ -2559,13 +2535,6 @@ static ssize_t fan3_input_show(struct device *dev, return sysfs_emit(buf, "%d\n", value * 100); } =20 -static ssize_t fan3_label_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", ASUS_MID_FAN_DESC); -} - static ssize_t pwm2_enable_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -2662,15 +2631,16 @@ static ssize_t pwm3_enable_store(struct device *dev, static DEVICE_ATTR_RW(pwm1); static DEVICE_ATTR_RW(pwm1_enable); static DEVICE_ATTR_RO(fan1_input); -static DEVICE_ATTR_RO(fan1_label); +static DEVICE_STRING_ATTR_RO(fan1_label, 0444, ASUS_FAN_DESC); + /* Fan2 - GPU fan */ static DEVICE_ATTR_RW(pwm2_enable); static DEVICE_ATTR_RO(fan2_input); -static DEVICE_ATTR_RO(fan2_label); +static DEVICE_STRING_ATTR_RO(fan2_label, 0444, ASUS_GPU_FAN_DESC); /* Fan3 - Middle/center fan */ static DEVICE_ATTR_RW(pwm3_enable); static DEVICE_ATTR_RO(fan3_input); -static DEVICE_ATTR_RO(fan3_label); +static DEVICE_STRING_ATTR_RO(fan3_label, 0444, ASUS_MID_FAN_DESC); =20 /* Temperature */ static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL); @@ -2681,11 +2651,11 @@ static struct attribute *hwmon_attributes[] =3D { &dev_attr_pwm2_enable.attr, &dev_attr_pwm3_enable.attr, &dev_attr_fan1_input.attr, - &dev_attr_fan1_label.attr, + &dev_attr_fan1_label.attr.attr, &dev_attr_fan2_input.attr, - &dev_attr_fan2_label.attr, + &dev_attr_fan2_label.attr.attr, &dev_attr_fan3_input.attr, - &dev_attr_fan3_label.attr, + &dev_attr_fan3_label.attr.attr, =20 &dev_attr_temp1_input.attr, NULL @@ -2702,17 +2672,17 @@ static umode_t asus_hwmon_sysfs_is_visible(struct k= object *kobj, if (asus->fan_type !=3D FAN_TYPE_AGFN) return 0; } else if (attr =3D=3D &dev_attr_fan1_input.attr - || attr =3D=3D &dev_attr_fan1_label.attr + || attr =3D=3D &dev_attr_fan1_label.attr.attr || attr =3D=3D &dev_attr_pwm1_enable.attr) { if (asus->fan_type =3D=3D FAN_TYPE_NONE) return 0; } else if (attr =3D=3D &dev_attr_fan2_input.attr - || attr =3D=3D &dev_attr_fan2_label.attr + || attr =3D=3D &dev_attr_fan2_label.attr.attr || attr =3D=3D &dev_attr_pwm2_enable.attr) { if (asus->gpu_fan_type =3D=3D FAN_TYPE_NONE) return 0; } else if (attr =3D=3D &dev_attr_fan3_input.attr - || attr =3D=3D &dev_attr_fan3_label.attr + || attr =3D=3D &dev_attr_fan3_label.attr.attr || attr =3D=3D &dev_attr_pwm3_enable.attr) { if (asus->mid_fan_type =3D=3D FAN_TYPE_NONE) return 0; diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/th= inkpad_acpi.c index 82429e59999d..47a64a213d14 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10991,13 +10991,7 @@ static struct ibm_struct auxmac_data =3D { .name =3D "auxmac", }; =20 -static ssize_t auxmac_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", auxmac); -} -static DEVICE_ATTR_RO(auxmac); +static DEVICE_STRING_ATTR_RO(auxmac, 0444, auxmac); =20 static umode_t auxmac_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) @@ -11006,7 +11000,7 @@ static umode_t auxmac_attr_is_visible(struct kobjec= t *kobj, } =20 static struct attribute *auxmac_attributes[] =3D { - &dev_attr_auxmac.attr, + &dev_attr_auxmac.attr.attr, NULL }; =20 diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/tos= hiba_acpi.c index 291f14ef6702..01cf60a015bf 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -1814,12 +1814,7 @@ static DECLARE_WORK(kbd_bl_work, toshiba_acpi_kbd_bl= _work); /* * Sysfs files */ -static ssize_t version_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return sprintf(buf, "%s\n", TOSHIBA_ACPI_VERSION); -} -static DEVICE_ATTR_RO(version); +static DEVICE_STRING_ATTR_RO(version, 0444, TOSHIBA_ACPI_VERSION); =20 static ssize_t fan_store(struct device *dev, struct device_attribute *attr, @@ -2428,7 +2423,7 @@ static ssize_t cooling_method_store(struct device *de= v, static DEVICE_ATTR_RW(cooling_method); =20 static struct attribute *toshiba_attributes[] =3D { - &dev_attr_version.attr, + &dev_attr_version.attr.attr, &dev_attr_fan.attr, &dev_attr_kbd_backlight_mode.attr, &dev_attr_kbd_type.attr, --=20 2.43.0 From nobody Wed Feb 11 04:18:06 2026 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [83.223.95.100]) (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 61CA5374F7; Sat, 20 Apr 2024 20:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.95.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643746; cv=none; b=kJX25dh7P2LEJIO5IVp1Ka4/0mb6huDzUfEXIWDAw+9WY16s9LJcuDlXKnogmxRVk7P+yJjEDyclfYd7ovOaLRht1G65Ng/WZY2ebWuF/YsSGrGAdqbX2tYx2SYfmNpMoVAoXnfZBUeX9wJvrbwRWY6it+JQEIk4CtmOa1s4Lms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713643746; c=relaxed/simple; bh=NRJ6iqRtJPQzhm+uZTGBeb1nQEvmOrudm7MhknkvQcE=; h=Message-ID:In-Reply-To:References:From:Date:Subject:To:Cc; b=s8NlqfJv3X6PBkEsWuz2ZyePeuKyPXe1fowBMW2HNC22AZjzftzfvj7bhJpUqSFnXr4MWoSZ9BHxownXsWFSe2KcdmZgwygmxAOzU9vMeo/AQi2om9FrIH6o6ZbMwsyCzdruI3xC+b7sbFAgsg+3s2sUQTlm5g03ltUCSwVMWyw= 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.95.100 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 bmailout1.hostsharing.net (Postfix) with ESMTPS id D459E30008CA3; Sat, 20 Apr 2024 22:09:02 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id CE71A10C1B1; Sat, 20 Apr 2024 22:09:02 +0200 (CEST) Message-ID: In-Reply-To: References: From: Lukas Wunner Date: Sat, 20 Apr 2024 22:00:06 +0200 Subject: [PATCH 6/6] scsi: Use device_show_string() helper for sysfs attributes To: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: Anil Gurumurthy , 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: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Deduplicate sysfs ->show() callbacks which expose a string at a static memory location. Use the newly introduced device_show_string() helper in the driver core instead by declaring those sysfs attributes with DEVICE_STRING_ATTR_RO(). No functional change intended. Signed-off-by: Lukas Wunner --- 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 +++------- 5 files changed, 16 insertions(+), 55 deletions(-) diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index e96e4b6df265..54bc1539e1e9 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c @@ -853,13 +853,6 @@ bfad_im_hw_version_show(struct device *dev, struct dev= ice_attribute *attr, return sysfs_emit(buf, "%s\n", hw_ver); } =20 -static ssize_t -bfad_im_drv_version_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", BFAD_DRIVER_VERSION); -} - static ssize_t bfad_im_optionrom_version_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -901,13 +894,6 @@ bfad_im_num_of_ports_show(struct device *dev, struct d= evice_attribute *attr, bfa_get_nports(&bfad->bfa)); } =20 -static ssize_t -bfad_im_drv_name_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", BFAD_DRIVER_NAME); -} - static ssize_t bfad_im_num_of_discovered_ports_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -944,15 +930,15 @@ static DEVICE_ATTR(symbolic_name, S_IRUGO, bfad_im_symbolic_name_show, NULL); static DEVICE_ATTR(hardware_version, S_IRUGO, bfad_im_hw_version_show, NULL); -static DEVICE_ATTR(driver_version, S_IRUGO, - bfad_im_drv_version_show, NULL); +static DEVICE_STRING_ATTR_RO(driver_version, S_IRUGO, + BFAD_DRIVER_VERSION); static DEVICE_ATTR(option_rom_version, S_IRUGO, bfad_im_optionrom_version_show, NULL); static DEVICE_ATTR(firmware_version, S_IRUGO, bfad_im_fw_version_show, NULL); static DEVICE_ATTR(number_of_ports, S_IRUGO, bfad_im_num_of_ports_show, NULL); -static DEVICE_ATTR(driver_name, S_IRUGO, bfad_im_drv_name_show, N= ULL); +static DEVICE_STRING_ATTR_RO(driver_name, S_IRUGO, BFAD_DRIVER_NAME); static DEVICE_ATTR(number_of_discovered_ports, S_IRUGO, bfad_im_num_of_discovered_ports_show, NULL); =20 @@ -963,11 +949,11 @@ static struct attribute *bfad_im_host_attrs[] =3D { &dev_attr_node_name.attr, &dev_attr_symbolic_name.attr, &dev_attr_hardware_version.attr, - &dev_attr_driver_version.attr, + &dev_attr_driver_version.attr.attr, &dev_attr_option_rom_version.attr, &dev_attr_firmware_version.attr, &dev_attr_number_of_ports.attr, - &dev_attr_driver_name.attr, + &dev_attr_driver_name.attr.attr, &dev_attr_number_of_discovered_ports.attr, NULL, }; @@ -988,11 +974,11 @@ static struct attribute *bfad_im_vport_attrs[] =3D { &dev_attr_node_name.attr, &dev_attr_symbolic_name.attr, &dev_attr_hardware_version.attr, - &dev_attr_driver_version.attr, + &dev_attr_driver_version.attr.attr, &dev_attr_option_rom_version.attr, &dev_attr_firmware_version.attr, &dev_attr_number_of_ports.attr, - &dev_attr_driver_name.attr, + &dev_attr_driver_name.attr.attr, &dev_attr_number_of_discovered_ports.attr, NULL, }; diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvsc= si_tgt/ibmvscsi_tgt.c index 68b99924ee4f..2fca17cf8b51 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3613,12 +3613,6 @@ static void ibmvscsis_remove(struct vio_dev *vdev) kfree(vscsi); } =20 -static ssize_t system_id_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return sysfs_emit(buf, "%s\n", system_id); -} - static ssize_t partition_number_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -3982,8 +3976,7 @@ static const struct target_core_fabric_ops ibmvscsis_= ops =3D { =20 static void ibmvscsis_dev_release(struct device *dev) {}; =20 -static struct device_attribute dev_attr_system_id =3D - __ATTR(system_id, S_IRUGO, system_id_show, NULL); +static DEVICE_STRING_ATTR_RO(system_id, S_IRUGO, system_id); =20 static struct device_attribute dev_attr_partition_number =3D __ATTR(partition_number, S_IRUGO, partition_number_show, NULL); @@ -3992,7 +3985,7 @@ static struct device_attribute dev_attr_unit_address = =3D __ATTR(unit_address, S_IRUGO, unit_address_show, NULL); =20 static struct attribute *ibmvscsis_dev_attrs[] =3D { - &dev_attr_system_id.attr, + &dev_attr_system_id.attr.attr, &dev_attr_partition_number.attr, &dev_attr_unit_address.attr, }; diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 43ebb331e216..2a25d574feb9 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -691,13 +691,7 @@ static struct pci_driver mvs_pci_driver =3D { .remove =3D mvs_pci_remove, }; =20 -static ssize_t driver_version_show(struct device *cdev, - struct device_attribute *attr, char *buffer) -{ - return sysfs_emit(buffer, "%s\n", DRV_VERSION); -} - -static DEVICE_ATTR_RO(driver_version); +static DEVICE_STRING_ATTR_RO(driver_version, 0444, DRV_VERSION); =20 static ssize_t interrupt_coalescing_store(struct device *cdev, struct device_attribute *attr, @@ -772,7 +766,7 @@ static void __exit mvs_exit(void) } =20 static struct attribute *mvst_host_attrs[] =3D { - &dev_attr_driver_version.attr, + &dev_attr_driver_version.attr.attr, &dev_attr_interrupt_coalescing.attr, NULL, }; diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_att= r.c index 44449c70a375..d4b420aef4a8 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -1067,13 +1067,6 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool s= top_beacon) =20 /* Scsi_Host attributes. */ =20 -static ssize_t -qla2x00_driver_version_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return scnprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str); -} - static ssize_t qla2x00_fw_version_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -2412,7 +2405,7 @@ qla2x00_dport_diagnostics_show(struct device *dev, static DEVICE_ATTR(dport_diagnostics, 0444, qla2x00_dport_diagnostics_show, NULL); =20 -static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_driver_version_show, N= ULL); +static DEVICE_STRING_ATTR_RO(driver_version, S_IRUGO, qla2x00_version_str); static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); static DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); @@ -2478,7 +2471,7 @@ static DEVICE_ATTR(port_no, 0444, qla2x00_port_no_sho= w, NULL); static DEVICE_ATTR(fw_attr, 0444, qla2x00_fw_attr_show, NULL); =20 static struct attribute *qla2x00_host_attrs[] =3D { - &dev_attr_driver_version.attr, + &dev_attr_driver_version.attr.attr, &dev_attr_fw_version.attr, &dev_attr_serial_num.attr, &dev_attr_isp_name.attr, diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/= smartpqi_init.c index 385180c98be4..f11cf590b2a9 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -6892,12 +6892,6 @@ static ssize_t pqi_firmware_version_show(struct devi= ce *dev, return scnprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->firmware_version); } =20 -static ssize_t pqi_driver_version_show(struct device *dev, - struct device_attribute *attr, char *buffer) -{ - return scnprintf(buffer, PAGE_SIZE, "%s\n", DRIVER_VERSION BUILD_TIMESTAM= P); -} - static ssize_t pqi_serial_number_show(struct device *dev, struct device_attribute *attr, char *buffer) { @@ -7066,7 +7060,8 @@ static ssize_t pqi_host_enable_r6_writes_store(struct= device *dev, return count; } =20 -static DEVICE_ATTR(driver_version, 0444, pqi_driver_version_show, NULL); +static DEVICE_STRING_ATTR_RO(driver_version, 0444, + DRIVER_VERSION BUILD_TIMESTAMP); static DEVICE_ATTR(firmware_version, 0444, pqi_firmware_version_show, NULL= ); static DEVICE_ATTR(model, 0444, pqi_model_show, NULL); static DEVICE_ATTR(serial_number, 0444, pqi_serial_number_show, NULL); @@ -7083,7 +7078,7 @@ static DEVICE_ATTR(enable_r6_writes, 0644, pqi_host_enable_r6_writes_show, pqi_host_enable_r6_writes_store); =20 static struct attribute *pqi_shost_attrs[] =3D { - &dev_attr_driver_version.attr, + &dev_attr_driver_version.attr.attr, &dev_attr_firmware_version.attr, &dev_attr_model.attr, &dev_attr_serial_number.attr, --=20 2.43.0