aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_device.h
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2021-10-12 16:35:13 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2021-10-16 21:45:52 -0400
commit92c4b58b15c56298b1b225c1d2e533165b3e32af (patch)
treec59608ec54742e0aa884314dc72507390aad36eb /include/scsi/scsi_device.h
parentscsi: core: Remove the 'done' argument from SCSI queuecommand_lck functions (diff)
downloadlinux-dev-92c4b58b15c56298b1b225c1d2e533165b3e32af.tar.xz
linux-dev-92c4b58b15c56298b1b225c1d2e533165b3e32af.zip
scsi: core: Register sysfs attributes earlier
A quote from Documentation/driver-api/driver-model/device.rst: "Word of warning: While the kernel allows device_create_file() and device_remove_file() to be called on a device at any time, userspace has strict expectations on when attributes get created. When a new device is registered in the kernel, a uevent is generated to notify userspace (like udev) that a new device is available. If attributes are added after the device is registered, then userspace won't get notified and userspace will not know about the new attributes." Hence register SCSI host sysfs attributes before the SCSI host shost_dev uevent is emitted instead of after that event has been emitted. Link: https://lore.kernel.org/r/20211012233558.4066756-2-bvanassche@acm.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/scsi/scsi_device.h')
-rw-r--r--include/scsi/scsi_device.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index b97e142a7ca9..01732aabd7c3 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -225,6 +225,13 @@ struct scsi_device {
struct device sdev_gendev,
sdev_dev;
+ struct attribute_group lld_attr_group;
+ /*
+ * The array size 6 provides space for one attribute group for the
+ * SCSI core, four attribute groups defined by SCSI LLDs and one
+ * terminating NULL pointer.
+ */
+ const struct attribute_group *gendev_attr_groups[6];
struct execute_work ew; /* used to get process context on put */
struct work_struct requeue_work;