Skip to contentSkip to conversation

scsi: Export scsi_bus_type

PATCH Superseded Holger Macht 2 participants 2 messages Dec 6, 2011 – Jan 18, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 scsi: Export scsi_bus_type

From: Matthew Garrett <[email protected]>

We need scsi_bus_type in order to be able to bind ata devices against acpi devices. Export it from the scsi core.

---
 drivers/scsi/scsi_priv.h |    1 -
 include/scsi/scsi.h      |    2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_priv.h +0 -1
Index: linux/drivers/scsi/scsi_priv.h
===================================================================
@@ -134,7 +134,6 @@ extern int scsi_sysfs_target_initialize(
 extern struct scsi_transport_template blank_transport_template;
 extern void __scsi_remove_device(struct scsi_device *);
 
-extern struct bus_type scsi_bus_type;
 extern const struct attribute_group *scsi_sysfs_shost_attr_groups[];
 
 /* scsi_netlink.c */
include/scsi/scsi.h +2 -0
Index: linux/include/scsi/scsi.h
===================================================================
@@ -187,6 +187,8 @@ struct scsi_cmnd;
 
 #define SCSI_MAX_VARLEN_CDB_SIZE 260
 
+extern struct bus_type scsi_bus_type;
+
 /* defined in T10 SCSI Primary Commands-2 (SPC2) */
 struct scsi_varlen_cdb_hdr {
 	__u8 opcode;        /* opcode always == VARIABLE_LENGTH_CMD */
maintainer
#1 lore raw
Quoted 7 lines · Holger Macht

From: Matthew Garrett <[email protected]>

We need scsi_bus_type in order to be able to bind ata devices against acpi devices. Export it from the scsi core.

If you're transmitting a patch, that needs to be a signed-off-by not an acked-by (because you're part of the transmission sequence).

Quoted 21 lines
 drivers/scsi/scsi_priv.h |    1 -
 include/scsi/scsi.h      |    2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux/drivers/scsi/scsi_priv.h
===================================================================

drivers/scsi/scsi_priv.h +0 -1
@@ -134,7 +134,6 @@ extern int scsi_sysfs_target_initialize(
 extern struct scsi_transport_template blank_transport_template;
 extern void __scsi_remove_device(struct scsi_device *);
 
-extern struct bus_type scsi_bus_type;
 extern const struct attribute_group *scsi_sysfs_shost_attr_groups[];
 
 /* scsi_netlink.c */

Index: linux/include/scsi/scsi.h
===================================================================

include/scsi/scsi.h struct scsi_cmnd; · line 191

Quoted 5 lines
include/scsi/scsi.h +2 -0
@@ -187,6 +187,8 @@ struct scsi_cmnd;
 
 #define SCSI_MAX_VARLEN_CDB_SIZE 260
 
+extern struct bus_type scsi_bus_type;
+

For about the third time, no to this: You're exposing deep SCSI internal magic you shouldn't be touching. The whole reason scsi_bus_type is in scsi_priv is that only SCSI internals should be touching it. We don't want its use to leak outside of this.

The only reason you need it is because the odd type acpi_bus_type insists on a bus_type parent. So the correct fix is some type of wrapper in scsi_lib.c:

scsi_register_acpi_bus_type(struct acpi_bus_type *bus)

{
	bus->bus = &scsi_bus_type;
	return register_acpi_bus_type(bus);
}

EXPORT_SYMBOL_GPL(scsi_register_acpi_bus_type);

For symmetry we probably want the unregister (it can be a pure inline passthrough).

James