scsi: bfa: Switch to attribute groups
authorBart Van Assche <bvanassche@acm.org>
Tue, 12 Oct 2021 23:35:26 +0000 (16:35 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 17 Oct 2021 01:45:54 +0000 (21:45 -0400)
struct device supports attribute groups directly but does not support
struct device_attribute directly. Hence switch to attribute groups.

Link: https://lore.kernel.org/r/20211012233558.4066756-15-bvanassche@acm.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/bfa/bfad_attr.c
drivers/scsi/bfa/bfad_im.c
drivers/scsi/bfa/bfad_im.h

index 5ae1e3f..c8b947c 100644 (file)
@@ -956,36 +956,52 @@ static          DEVICE_ATTR(driver_name, S_IRUGO, bfad_im_drv_name_show, NULL);
 static          DEVICE_ATTR(number_of_discovered_ports, S_IRUGO,
                                bfad_im_num_of_discovered_ports_show, NULL);
 
-struct device_attribute *bfad_im_host_attrs[] = {
-       &dev_attr_serial_number,
-       &dev_attr_model,
-       &dev_attr_model_description,
-       &dev_attr_node_name,
-       &dev_attr_symbolic_name,
-       &dev_attr_hardware_version,
-       &dev_attr_driver_version,
-       &dev_attr_option_rom_version,
-       &dev_attr_firmware_version,
-       &dev_attr_number_of_ports,
-       &dev_attr_driver_name,
-       &dev_attr_number_of_discovered_ports,
+static struct attribute *bfad_im_host_attrs[] = {
+       &dev_attr_serial_number.attr,
+       &dev_attr_model.attr,
+       &dev_attr_model_description.attr,
+       &dev_attr_node_name.attr,
+       &dev_attr_symbolic_name.attr,
+       &dev_attr_hardware_version.attr,
+       &dev_attr_driver_version.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_number_of_discovered_ports.attr,
        NULL,
 };
 
-struct device_attribute *bfad_im_vport_attrs[] = {
-       &dev_attr_serial_number,
-       &dev_attr_model,
-       &dev_attr_model_description,
-       &dev_attr_node_name,
-       &dev_attr_symbolic_name,
-       &dev_attr_hardware_version,
-       &dev_attr_driver_version,
-       &dev_attr_option_rom_version,
-       &dev_attr_firmware_version,
-       &dev_attr_number_of_ports,
-       &dev_attr_driver_name,
-       &dev_attr_number_of_discovered_ports,
+static const struct attribute_group bfad_im_host_attr_group = {
+       .attrs = bfad_im_host_attrs
+};
+
+const struct attribute_group *bfad_im_host_groups[] = {
+       &bfad_im_host_attr_group,
+       NULL
+};
+
+struct attribute *bfad_im_vport_attrs[] = {
+       &dev_attr_serial_number.attr,
+       &dev_attr_model.attr,
+       &dev_attr_model_description.attr,
+       &dev_attr_node_name.attr,
+       &dev_attr_symbolic_name.attr,
+       &dev_attr_hardware_version.attr,
+       &dev_attr_driver_version.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_number_of_discovered_ports.attr,
        NULL,
 };
 
+static const struct attribute_group bfad_im_vport_attr_group = {
+       .attrs = bfad_im_vport_attrs
+};
 
+const struct attribute_group *bfad_im_vport_groups[] = {
+       &bfad_im_vport_attr_group,
+       NULL
+};
index 79d8f2a..759d2bb 100644 (file)
@@ -809,7 +809,7 @@ struct scsi_host_template bfad_im_scsi_host_template = {
        .this_id = -1,
        .sg_tablesize = BFAD_IO_MAX_SGE,
        .cmd_per_lun = 3,
-       .shost_attrs = bfad_im_host_attrs,
+       .shost_groups = bfad_im_host_groups,
        .max_sectors = BFAD_MAX_SECTORS,
        .vendor_id = BFA_PCI_VENDOR_ID_BROCADE,
 };
@@ -831,7 +831,7 @@ struct scsi_host_template bfad_im_vport_template = {
        .this_id = -1,
        .sg_tablesize = BFAD_IO_MAX_SGE,
        .cmd_per_lun = 3,
-       .shost_attrs = bfad_im_vport_attrs,
+       .shost_groups = bfad_im_vport_groups,
        .max_sectors = BFAD_MAX_SECTORS,
 };
 
index f16d4b2..829345b 100644 (file)
@@ -174,8 +174,8 @@ extern struct fc_function_template bfad_im_vport_fc_function_template;
 extern struct scsi_transport_template *bfad_im_scsi_transport_template;
 extern struct scsi_transport_template *bfad_im_scsi_vport_transport_template;
 
-extern struct device_attribute *bfad_im_host_attrs[];
-extern struct device_attribute *bfad_im_vport_attrs[];
+extern const struct attribute_group *bfad_im_host_groups[];
+extern const struct attribute_group *bfad_im_vport_groups[];
 
 irqreturn_t bfad_intx(int irq, void *dev_id);