]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/acpiphp_core.c
PCI: introduce pci_slot
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / acpiphp_core.c
index a0ca63adad5ac41c3df29fc7171b814d5db4709a..0e496e866a84dc51480d4cb3194e1ea6b62023c8 100644 (file)
@@ -70,7 +70,6 @@ static int disable_slot               (struct hotplug_slot *slot);
 static int set_attention_status (struct hotplug_slot *slot, u8 value);
 static int get_power_status    (struct hotplug_slot *slot, u8 *value);
 static int get_attention_status (struct hotplug_slot *slot, u8 *value);
-static int get_address         (struct hotplug_slot *slot, u32 *value);
 static int get_latch_status    (struct hotplug_slot *slot, u8 *value);
 static int get_adapter_status  (struct hotplug_slot *slot, u8 *value);
 
@@ -83,7 +82,6 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = {
        .get_attention_status   = get_attention_status,
        .get_latch_status       = get_latch_status,
        .get_adapter_status     = get_adapter_status,
-       .get_address            = get_address,
 };
 
 
@@ -91,10 +89,10 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = {
  * acpiphp_register_attention - set attention LED callback
  * @info: must be completely filled with LED callbacks
  *
- * Description: this is used to register a hardware specific ACPI
+ * Description: This is used to register a hardware specific ACPI
  * driver that manipulates the attention LED.  All the fields in
  * info must be set.
- **/
+ */
 int acpiphp_register_attention(struct acpiphp_attention_info *info)
 {
        int retval = -EINVAL;
@@ -112,10 +110,10 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info)
  * acpiphp_unregister_attention - unset attention LED callback
  * @info: must match the pointer used to register
  *
- * Description: this is used to un-register a hardware specific acpi
+ * Description: This is used to un-register a hardware specific acpi
  * driver that manipulates the attention LED.  The pointer to the 
  * info struct must be the same as the one used to set it.
- **/
+ */
 int acpiphp_unregister_attention(struct acpiphp_attention_info *info)
 {
        int retval = -EINVAL;
@@ -133,13 +131,12 @@ int acpiphp_unregister_attention(struct acpiphp_attention_info *info)
  * @hotplug_slot: slot to enable
  *
  * Actual tasks are done in acpiphp_enable_slot()
- *
  */
 static int enable_slot(struct hotplug_slot *hotplug_slot)
 {
        struct slot *slot = hotplug_slot->private;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
 
        /* enable the specified slot */
        return acpiphp_enable_slot(slot->acpi_slot);
@@ -151,14 +148,13 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
  * @hotplug_slot: slot to disable
  *
  * Actual tasks are done in acpiphp_disable_slot()
- *
  */
 static int disable_slot(struct hotplug_slot *hotplug_slot)
 {
        struct slot *slot = hotplug_slot->private;
        int retval;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
 
        /* disable the specified slot */
        retval = acpiphp_disable_slot(slot->acpi_slot);
@@ -168,20 +164,20 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
 }
 
 
- /**
 * set_attention_status - set attention LED
+/**
+ * set_attention_status - set attention LED
  * @hotplug_slot: slot to set attention LED on
  * @status: value to set attention LED to (0 or 1)
  *
  * attention status LED, so we use a callback that
  * was registered with us.  This allows hardware specific
  * ACPI implementations to blink the light for us.
- **/
+ */
  static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
  {
        int retval = -ENODEV;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
  
        if (attention_info && try_module_get(attention_info->owner)) {
                retval = attention_info->set_attn(hotplug_slot, status);
@@ -199,13 +195,12 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
  *
  * Some platforms may not implement _STA method properly.
  * In that case, the value returned may not be reliable.
- *
  */
 static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
        struct slot *slot = hotplug_slot->private;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
 
        *value = acpiphp_get_power_status(slot->acpi_slot);
 
@@ -213,7 +208,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
 }
 
 
- /**
+/**
  * get_attention_status - get attention LED status
  * @hotplug_slot: slot to get status from
  * @value: returns with value of attention LED
@@ -221,13 +216,13 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
  * ACPI doesn't have known method to determine the state
  * of the attention status LED, so we use a callback that
  * was registered with us.  This allows hardware specific
- * ACPI implementations to determine its state
- **/
+ * ACPI implementations to determine its state.
+ */
 static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
        int retval = -EINVAL;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
 
        if (attention_info && try_module_get(attention_info->owner)) {
                retval = attention_info->get_attn(hotplug_slot, value);
@@ -244,14 +239,13 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
  * @value: pointer to store status
  *
  * ACPI doesn't provide any formal means to access latch status.
- * Instead, we fake latch status from _STA
- *
+ * Instead, we fake latch status from _STA.
  */
 static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
        struct slot *slot = hotplug_slot->private;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
 
        *value = acpiphp_get_latch_status(slot->acpi_slot);
 
@@ -265,37 +259,19 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
  * @value: pointer to store status
  *
  * ACPI doesn't provide any formal means to access adapter status.
- * Instead, we fake adapter status from _STA
- *
+ * Instead, we fake adapter status from _STA.
  */
 static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
        struct slot *slot = hotplug_slot->private;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
 
        *value = acpiphp_get_adapter_status(slot->acpi_slot);
 
        return 0;
 }
 
-
-/**
- * get_address - get pci address of a slot
- * @hotplug_slot: slot to get status
- * @value: pointer to struct pci_busdev (seg, bus, dev)
- */
-static int get_address(struct hotplug_slot *hotplug_slot, u32 *value)
-{
-       struct slot *slot = hotplug_slot->private;
-
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
-
-       *value = acpiphp_get_address(slot->acpi_slot);
-
-       return 0;
-}
-
 static int __init init_acpi(void)
 {
        int retval;
@@ -323,7 +299,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
 {
        struct slot *slot = hotplug_slot->private;
 
-       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+       dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
 
        kfree(slot->hotplug_slot);
        kfree(slot);
@@ -362,7 +338,11 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
        acpiphp_slot->slot = slot;
        snprintf(slot->name, sizeof(slot->name), "%u", slot->acpi_slot->sun);
 
-       retval = pci_hp_register(slot->hotplug_slot);
+       retval = pci_hp_register(slot->hotplug_slot,
+                                       acpiphp_slot->bridge->pci_bus,
+                                       acpiphp_slot->device);
+       if (retval == -EBUSY)
+               goto error_hpslot;
        if (retval) {
                err("pci_hp_register failed with error %d\n", retval);
                goto error_hpslot;
@@ -397,6 +377,9 @@ static int __init acpiphp_init(void)
 {
        info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
 
+       if (acpi_pci_disabled)
+               return 0;
+
        acpiphp_debug = debug;
 
        /* read all the ACPI info from the system */
@@ -406,6 +389,9 @@ static int __init acpiphp_init(void)
 
 static void __exit acpiphp_exit(void)
 {
+       if (acpi_pci_disabled)
+               return;
+
        /* deallocate internal data structures etc. */
        acpiphp_glue_exit();
 }