string: factorize skip_spaces and export it to be generally available
[safe/jmp/linux-2.6] / include / linux / pci_hotplug.h
index 5efba66..652ba79 100644 (file)
@@ -62,21 +62,15 @@ enum pcie_link_width {
 };
 
 enum pcie_link_speed {
-       PCIE_2PT5GB             = 0x14,
+       PCIE_2_5GB              = 0x14,
+       PCIE_5_0GB              = 0x15,
        PCIE_LNK_SPEED_UNKNOWN  = 0xFF,
 };
 
-struct hotplug_slot;
-struct hotplug_slot_attribute {
-       struct attribute attr;
-       ssize_t (*show)(struct hotplug_slot *, char *);
-       ssize_t (*store)(struct hotplug_slot *, const char *, size_t);
-};
-#define to_hotplug_attr(n) container_of(n, struct hotplug_slot_attribute, attr);
-
 /**
  * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
  * @owner: The module owner of this structure
+ * @mod_name: The module name (KBUILD_MODNAME) of this structure
  * @enable_slot: Called when the user wants to enable a specific pci slot
  * @disable_slot: Called when the user wants to disable a specific pci slot
  * @set_attention_status: Called to set the specific slot's attention LED to
@@ -109,6 +103,7 @@ struct hotplug_slot_attribute {
  */
 struct hotplug_slot_ops {
        struct module *owner;
+       const char *mod_name;
        int (*enable_slot)              (struct hotplug_slot *slot);
        int (*disable_slot)             (struct hotplug_slot *slot);
        int (*set_attention_status)     (struct hotplug_slot *slot, u8 value);
@@ -142,8 +137,6 @@ struct hotplug_slot_info {
 
 /**
  * struct hotplug_slot - used to register a physical slot with the hotplug pci core
- * @name: the name of the slot being registered.  This string must
- * be unique amoung slots registered on this system.
  * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot
  * @info: pointer to the &struct hotplug_slot_info for the initial values for
  * this slot.
@@ -153,7 +146,6 @@ struct hotplug_slot_info {
  * needs.
  */
 struct hotplug_slot {
-       char                            *name;
        struct hotplug_slot_ops         *ops;
        struct hotplug_slot_info        *info;
        void (*release) (struct hotplug_slot *slot);
@@ -165,12 +157,26 @@ struct hotplug_slot {
 };
 #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
 
-extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr,
-                          const char *name);
+static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
+{
+       return pci_slot_name(slot->pci_slot);
+}
+
+extern int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus,
+                            int nr, const char *name,
+                            struct module *owner, const char *mod_name);
 extern int pci_hp_deregister(struct hotplug_slot *slot);
 extern int __must_check pci_hp_change_slot_info        (struct hotplug_slot *slot,
                                                 struct hotplug_slot_info *info);
 
+static inline int pci_hp_register(struct hotplug_slot *slot,
+                                 struct pci_bus *pbus,
+                                 int devnr, const char *name)
+{
+       return __pci_hp_register(slot, pbus, devnr, name,
+                                THIS_MODULE, KBUILD_MODNAME);
+}
+
 /* PCI Setting Record (Type 0) */
 struct hpp_type0 {
        u32 revision;
@@ -221,11 +227,18 @@ struct hotplug_params {
 #ifdef CONFIG_ACPI
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
-#include <acpi/actypes.h>
-extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
-                               struct hotplug_params *hpp);
+int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp);
 int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
-int acpi_root_bridge(acpi_handle handle);
+int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
+int acpi_pci_detect_ejectable(acpi_handle handle);
+#else
+static inline int pci_get_hp_params(struct pci_dev *dev,
+                                   struct hotplug_params *hpp)
+{
+       return -ENODEV;
+}
 #endif
+
+void pci_configure_slot(struct pci_dev *dev);
 #endif