This is a note to let you know that I've just added the patch titled RDMA/srp: Use the attribute group mechanism for sysfs attributes to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 14ab55e56e4200b6aeb7b89243c0aadfcf3a16d1 Author: Bart Van Assche <bvanassche@xxxxxxx> Date: Thu Aug 25 14:39:00 2022 -0700 RDMA/srp: Use the attribute group mechanism for sysfs attributes [ Upstream commit b8a9c18c2f39bd84b8240b744b666114f7d62054 ] Simplify the SRP driver by using the attribute group mechanism instead of calling device_create_file() explicitly. Link: https://lore.kernel.org/r/20220825213900.864587-5-bvanassche@xxxxxxx Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx> Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index fc4777f22fd3..96be06e8635c 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3180,8 +3180,13 @@ static void srp_release_dev(struct device *dev) complete(&host->released); } +static struct attribute *srp_class_attrs[]; + +ATTRIBUTE_GROUPS(srp_class); + static struct class srp_class = { .name = "infiniband_srp", + .dev_groups = srp_class_groups, .dev_release = srp_release_dev }; @@ -3887,6 +3892,13 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR_RO(port); +static struct attribute *srp_class_attrs[] = { + &dev_attr_add_target.attr, + &dev_attr_ibdev.attr, + &dev_attr_port.attr, + NULL +}; + static struct srp_host *srp_add_port(struct srp_device *device, u8 port) { struct srp_host *host; @@ -3910,12 +3922,6 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) goto put_host; if (device_add(&host->dev)) goto put_host; - if (device_create_file(&host->dev, &dev_attr_add_target)) - goto put_host; - if (device_create_file(&host->dev, &dev_attr_ibdev)) - goto put_host; - if (device_create_file(&host->dev, &dev_attr_port)) - goto put_host; return host;