diff options
author | Dely Sy <dlsy@snoqualmie.dp.intel.com> | 2005-05-05 14:57:25 -0400 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-05-17 17:31:10 -0400 |
commit | ee17fd93a5892c162b0a02d58cdfdb9c50cf8467 (patch) | |
tree | d218eab66a47e883ddf84f5c30e9060cd99394ec /drivers | |
parent | ff0d2f90fdc4b564d47a7c26b16de81a16cfa28e (diff) |
[PATCH] PCI Hotplug: Fix echoing 1 to power file of enabled slot problem with SHPC driver
Here is a patch to fix the problem of echoing 1 to "power" file
to enabled slot causing the slot to power down, and echoing 0
to disabled slot causing shpchp_disabled_slot() to be called
twice. This problem was reported by kenji Kaneshige.
Thanks,
Dely
Signed-off-by: Dely Sy <dely.l.sy@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_ctrl.c | 30 |
2 files changed, 16 insertions, 16 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index f0c53f850aed..a70a5c5705f2 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -95,7 +95,7 @@ static struct hotplug_slot_ops shpchp_hotplug_slot_ops = { | |||
95 | */ | 95 | */ |
96 | static void release_slot(struct hotplug_slot *hotplug_slot) | 96 | static void release_slot(struct hotplug_slot *hotplug_slot) |
97 | { | 97 | { |
98 | struct slot *slot = (struct slot *)hotplug_slot->private; | 98 | struct slot *slot = hotplug_slot->private; |
99 | 99 | ||
100 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 100 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); |
101 | 101 | ||
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index 9f90eb8e6ecd..490a9553a062 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c | |||
@@ -1885,7 +1885,7 @@ int shpchp_enable_slot (struct slot *p_slot) | |||
1885 | func = shpchp_slot_find(p_slot->bus, p_slot->device, 0); | 1885 | func = shpchp_slot_find(p_slot->bus, p_slot->device, 0); |
1886 | if (!func) { | 1886 | if (!func) { |
1887 | dbg("%s: Error! slot NULL\n", __FUNCTION__); | 1887 | dbg("%s: Error! slot NULL\n", __FUNCTION__); |
1888 | return 1; | 1888 | return -ENODEV; |
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | /* Check to see if (latch closed, card present, power off) */ | 1891 | /* Check to see if (latch closed, card present, power off) */ |
@@ -1894,19 +1894,19 @@ int shpchp_enable_slot (struct slot *p_slot) | |||
1894 | if (rc || !getstatus) { | 1894 | if (rc || !getstatus) { |
1895 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 1895 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
1896 | up(&p_slot->ctrl->crit_sect); | 1896 | up(&p_slot->ctrl->crit_sect); |
1897 | return 1; | 1897 | return -ENODEV; |
1898 | } | 1898 | } |
1899 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 1899 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
1900 | if (rc || getstatus) { | 1900 | if (rc || getstatus) { |
1901 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 1901 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
1902 | up(&p_slot->ctrl->crit_sect); | 1902 | up(&p_slot->ctrl->crit_sect); |
1903 | return 1; | 1903 | return -ENODEV; |
1904 | } | 1904 | } |
1905 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 1905 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
1906 | if (rc || getstatus) { | 1906 | if (rc || getstatus) { |
1907 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); | 1907 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); |
1908 | up(&p_slot->ctrl->crit_sect); | 1908 | up(&p_slot->ctrl->crit_sect); |
1909 | return 1; | 1909 | return -ENODEV; |
1910 | } | 1910 | } |
1911 | up(&p_slot->ctrl->crit_sect); | 1911 | up(&p_slot->ctrl->crit_sect); |
1912 | 1912 | ||
@@ -1914,7 +1914,7 @@ int shpchp_enable_slot (struct slot *p_slot) | |||
1914 | 1914 | ||
1915 | func = shpchp_slot_create(p_slot->bus); | 1915 | func = shpchp_slot_create(p_slot->bus); |
1916 | if (func == NULL) | 1916 | if (func == NULL) |
1917 | return 1; | 1917 | return -ENOMEM; |
1918 | 1918 | ||
1919 | func->bus = p_slot->bus; | 1919 | func->bus = p_slot->bus; |
1920 | func->device = p_slot->device; | 1920 | func->device = p_slot->device; |
@@ -1939,7 +1939,7 @@ int shpchp_enable_slot (struct slot *p_slot) | |||
1939 | /* Setup slot structure with entry for empty slot */ | 1939 | /* Setup slot structure with entry for empty slot */ |
1940 | func = shpchp_slot_create(p_slot->bus); | 1940 | func = shpchp_slot_create(p_slot->bus); |
1941 | if (func == NULL) | 1941 | if (func == NULL) |
1942 | return (1); /* Out of memory */ | 1942 | return -ENOMEM; /* Out of memory */ |
1943 | 1943 | ||
1944 | func->bus = p_slot->bus; | 1944 | func->bus = p_slot->bus; |
1945 | func->device = p_slot->device; | 1945 | func->device = p_slot->device; |
@@ -1972,7 +1972,7 @@ int shpchp_disable_slot (struct slot *p_slot) | |||
1972 | struct pci_func *func; | 1972 | struct pci_func *func; |
1973 | 1973 | ||
1974 | if (!p_slot->ctrl) | 1974 | if (!p_slot->ctrl) |
1975 | return 1; | 1975 | return -ENODEV; |
1976 | 1976 | ||
1977 | pci_bus = p_slot->ctrl->pci_dev->subordinate; | 1977 | pci_bus = p_slot->ctrl->pci_dev->subordinate; |
1978 | 1978 | ||
@@ -1983,19 +1983,19 @@ int shpchp_disable_slot (struct slot *p_slot) | |||
1983 | if (ret || !getstatus) { | 1983 | if (ret || !getstatus) { |
1984 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 1984 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
1985 | up(&p_slot->ctrl->crit_sect); | 1985 | up(&p_slot->ctrl->crit_sect); |
1986 | return 1; | 1986 | return -ENODEV; |
1987 | } | 1987 | } |
1988 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 1988 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
1989 | if (ret || getstatus) { | 1989 | if (ret || getstatus) { |
1990 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 1990 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
1991 | up(&p_slot->ctrl->crit_sect); | 1991 | up(&p_slot->ctrl->crit_sect); |
1992 | return 1; | 1992 | return -ENODEV; |
1993 | } | 1993 | } |
1994 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 1994 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
1995 | if (ret || !getstatus) { | 1995 | if (ret || !getstatus) { |
1996 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); | 1996 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); |
1997 | up(&p_slot->ctrl->crit_sect); | 1997 | up(&p_slot->ctrl->crit_sect); |
1998 | return 1; | 1998 | return -ENODEV; |
1999 | } | 1999 | } |
2000 | up(&p_slot->ctrl->crit_sect); | 2000 | up(&p_slot->ctrl->crit_sect); |
2001 | 2001 | ||
@@ -2011,7 +2011,7 @@ int shpchp_disable_slot (struct slot *p_slot) | |||
2011 | /* Check the Class Code */ | 2011 | /* Check the Class Code */ |
2012 | rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); | 2012 | rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); |
2013 | if (rc) | 2013 | if (rc) |
2014 | return rc; | 2014 | return -ENODEV; |
2015 | 2015 | ||
2016 | if (class_code == PCI_BASE_CLASS_DISPLAY) { | 2016 | if (class_code == PCI_BASE_CLASS_DISPLAY) { |
2017 | /* Display/Video adapter (not supported) */ | 2017 | /* Display/Video adapter (not supported) */ |
@@ -2020,13 +2020,13 @@ int shpchp_disable_slot (struct slot *p_slot) | |||
2020 | /* See if it's a bridge */ | 2020 | /* See if it's a bridge */ |
2021 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); | 2021 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); |
2022 | if (rc) | 2022 | if (rc) |
2023 | return rc; | 2023 | return -ENODEV; |
2024 | 2024 | ||
2025 | /* If it's a bridge, check the VGA Enable bit */ | 2025 | /* If it's a bridge, check the VGA Enable bit */ |
2026 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { | 2026 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { |
2027 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR); | 2027 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR); |
2028 | if (rc) | 2028 | if (rc) |
2029 | return rc; | 2029 | return -ENODEV; |
2030 | 2030 | ||
2031 | /* If the VGA Enable bit is set, remove isn't supported */ | 2031 | /* If the VGA Enable bit is set, remove isn't supported */ |
2032 | if (BCR & PCI_BRIDGE_CTL_VGA) { | 2032 | if (BCR & PCI_BRIDGE_CTL_VGA) { |
@@ -2042,12 +2042,12 @@ int shpchp_disable_slot (struct slot *p_slot) | |||
2042 | if ((func != NULL) && !rc) { | 2042 | if ((func != NULL) && !rc) { |
2043 | rc = remove_board(func, p_slot->ctrl); | 2043 | rc = remove_board(func, p_slot->ctrl); |
2044 | } else if (!rc) | 2044 | } else if (!rc) |
2045 | rc = 1; | 2045 | rc = -ENODEV; |
2046 | 2046 | ||
2047 | if (p_slot) | 2047 | if (p_slot) |
2048 | update_slot_info(p_slot); | 2048 | update_slot_info(p_slot); |
2049 | 2049 | ||
2050 | return(rc); | 2050 | return rc; |
2051 | } | 2051 | } |
2052 | 2052 | ||
2053 | 2053 | ||