Patchwork [v4,01/13,SCSI] : add wrapper to access and set scsi_bus_type in struct acpi_bus_type

login
register
mail settings
Submitter Lin Ming
Date May 28, 2012, 5:08 a.m.
Message ID <1338181720-4149-2-git-send-email-ming.m.lin@intel.com>
Download mbox | patch
Permalink /patch/161587/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Lin Ming - May 28, 2012, 5:08 a.m.
From: Holger Macht <holger@homac.de>

For being able to bind ata devices against acpi devices, scsi_bus_type
needs to be set as bus in struct acpi_bus_type. So add wrapper to
scsi_lib to accomplish that.

Signed-off-by: Holger Macht <holger@homac.de>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
 drivers/scsi/scsi_lib.c |   17 +++++++++++++++++
 include/scsi/scsi.h     |   10 ++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
Sergei Shtylyov - May 29, 2012, 12:26 p.m.
Hello.

On 28-05-2012 9:08, Lin Ming wrote:

> From: Holger Macht<holger@homac.de>

> For being able to bind ata devices against acpi devices, scsi_bus_type
> needs to be set as bus in struct acpi_bus_type. So add wrapper to
> scsi_lib to accomplish that.

> Signed-off-by: Holger Macht<holger@homac.de>
> Signed-off-by: Lin Ming<ming.m.lin@intel.com>
> ---
>   drivers/scsi/scsi_lib.c |   17 +++++++++++++++++
>   include/scsi/scsi.h     |   10 ++++++++++
>   2 files changed, 27 insertions(+), 0 deletions(-)

> diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
> index f34a5a8..4527b3a 100644
> --- a/include/scsi/scsi.h
> +++ b/include/scsi/scsi.h
> @@ -214,6 +214,16 @@ scsi_command_size(const unsigned char *cmnd)
>   		scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]);
>   }
>
> +#ifdef CONFIG_ACPI

    You don't have to enclode declarations into #ifdef.

> +struct acpi_bus_type;
> +
> +extern int

    'extern' is the default memory class for function, no need to specidy it.
And don't break the line here.

> +scsi_register_acpi_bus_type(struct acpi_bus_type *bus);
> +
> +extern void

    Same comment.

> +scsi_unregister_acpi_bus_type(struct acpi_bus_type *bus);
> +#endif

MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 5dfd749..a243212 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -68,6 +68,23 @@  static struct scsi_host_sg_pool scsi_sg_pools[] = {
 
 struct kmem_cache *scsi_sdb_cache;
 
+#ifdef CONFIG_ACPI
+#include <acpi/acpi_bus.h>
+
+int 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);
+
+void scsi_unregister_acpi_bus_type(struct acpi_bus_type *bus)
+{
+	unregister_acpi_bus_type(bus);
+}
+EXPORT_SYMBOL_GPL(scsi_unregister_acpi_bus_type);
+#endif
+
 /*
  * When to reinvoke queueing after a resource shortage. It's 3 msecs to
  * not change behaviour from the previous unplug mechanism, experimentation
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index f34a5a8..4527b3a 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -214,6 +214,16 @@  scsi_command_size(const unsigned char *cmnd)
 		scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]);
 }
 
+#ifdef CONFIG_ACPI
+struct acpi_bus_type;
+
+extern int
+scsi_register_acpi_bus_type(struct acpi_bus_type *bus);
+
+extern void
+scsi_unregister_acpi_bus_type(struct acpi_bus_type *bus);
+#endif
+
 /*
  *  SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
  *  T10/1561-D Revision 4 Draft dated 7th November 2002.