aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/yenta_socket.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-05-17 21:51:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-06-13 17:42:22 -0400
commitb918c62e086b2130a7bae44110ca516ef10bfe5a (patch)
treee4aee0e76da9a6ddd2d787de63f4ae7ad4d10e59 /drivers/pcmcia/yenta_socket.c
parent92f02430934ca1c1e991a1ab3541880575042697 (diff)
PCI: replace struct pci_bus secondary/subordinate with busn_res
Replace the struct pci_bus secondary/subordinate members with the struct resource busn_res. Later we'll build a resource tree of these bus numbers. [bhelgaas: changelog] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pcmcia/yenta_socket.c')
-rw-r--r--drivers/pcmcia/yenta_socket.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index d07f9ac8c41d..667678db1153 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1048,8 +1048,8 @@ static void yenta_config_init(struct yenta_socket *socket)
1048 config_writeb(socket, PCI_LATENCY_TIMER, 168); 1048 config_writeb(socket, PCI_LATENCY_TIMER, 168);
1049 config_writel(socket, PCI_PRIMARY_BUS, 1049 config_writel(socket, PCI_PRIMARY_BUS,
1050 (176 << 24) | /* sec. latency timer */ 1050 (176 << 24) | /* sec. latency timer */
1051 (dev->subordinate->subordinate << 16) | /* subordinate bus */ 1051 ((unsigned int)dev->subordinate->busn_res.end << 16) | /* subordinate bus */
1052 (dev->subordinate->secondary << 8) | /* secondary bus */ 1052 ((unsigned int)dev->subordinate->busn_res.start << 8) | /* secondary bus */
1053 dev->subordinate->primary); /* primary bus */ 1053 dev->subordinate->primary); /* primary bus */
1054 1054
1055 /* 1055 /*
@@ -1086,14 +1086,14 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1086 struct pci_bus *bridge_to_fix = cardbus_bridge->parent; 1086 struct pci_bus *bridge_to_fix = cardbus_bridge->parent;
1087 1087
1088 /* Check bus numbers are already set up correctly: */ 1088 /* Check bus numbers are already set up correctly: */
1089 if (bridge_to_fix->subordinate >= cardbus_bridge->subordinate) 1089 if (bridge_to_fix->busn_res.end >= cardbus_bridge->busn_res.end)
1090 return; /* The subordinate number is ok, nothing to do */ 1090 return; /* The subordinate number is ok, nothing to do */
1091 1091
1092 if (!bridge_to_fix->parent) 1092 if (!bridge_to_fix->parent)
1093 return; /* Root bridges are ok */ 1093 return; /* Root bridges are ok */
1094 1094
1095 /* stay within the limits of the bus range of the parent: */ 1095 /* stay within the limits of the bus range of the parent: */
1096 upper_limit = bridge_to_fix->parent->subordinate; 1096 upper_limit = bridge_to_fix->parent->busn_res.end;
1097 1097
1098 /* check the bus ranges of all silbling bridges to prevent overlap */ 1098 /* check the bus ranges of all silbling bridges to prevent overlap */
1099 list_for_each(tmp, &bridge_to_fix->parent->children) { 1099 list_for_each(tmp, &bridge_to_fix->parent->children) {
@@ -1104,36 +1104,36 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1104 * current upper limit, set the new upper limit to 1104 * current upper limit, set the new upper limit to
1105 * the bus number below the silbling's range: 1105 * the bus number below the silbling's range:
1106 */ 1106 */
1107 if (silbling->secondary > bridge_to_fix->subordinate 1107 if (silbling->busn_res.start > bridge_to_fix->busn_res.end
1108 && silbling->secondary <= upper_limit) 1108 && silbling->busn_res.start <= upper_limit)
1109 upper_limit = silbling->secondary - 1; 1109 upper_limit = silbling->busn_res.start - 1;
1110 } 1110 }
1111 1111
1112 /* Show that the wanted subordinate number is not possible: */ 1112 /* Show that the wanted subordinate number is not possible: */
1113 if (cardbus_bridge->subordinate > upper_limit) 1113 if (cardbus_bridge->busn_res.end > upper_limit)
1114 dev_printk(KERN_WARNING, &cardbus_bridge->dev, 1114 dev_printk(KERN_WARNING, &cardbus_bridge->dev,
1115 "Upper limit for fixing this " 1115 "Upper limit for fixing this "
1116 "bridge's parent bridge: #%02x\n", upper_limit); 1116 "bridge's parent bridge: #%02x\n", upper_limit);
1117 1117
1118 /* If we have room to increase the bridge's subordinate number, */ 1118 /* If we have room to increase the bridge's subordinate number, */
1119 if (bridge_to_fix->subordinate < upper_limit) { 1119 if (bridge_to_fix->busn_res.end < upper_limit) {
1120 1120
1121 /* use the highest number of the hidden bus, within limits */ 1121 /* use the highest number of the hidden bus, within limits */
1122 unsigned char subordinate_to_assign = 1122 unsigned char subordinate_to_assign =
1123 min(cardbus_bridge->subordinate, upper_limit); 1123 min_t(int, cardbus_bridge->busn_res.end, upper_limit);
1124 1124
1125 dev_printk(KERN_INFO, &bridge_to_fix->dev, 1125 dev_printk(KERN_INFO, &bridge_to_fix->dev,
1126 "Raising subordinate bus# of parent " 1126 "Raising subordinate bus# of parent "
1127 "bus (#%02x) from #%02x to #%02x\n", 1127 "bus (#%02x) from #%02x to #%02x\n",
1128 bridge_to_fix->number, 1128 bridge_to_fix->number,
1129 bridge_to_fix->subordinate, subordinate_to_assign); 1129 (int)bridge_to_fix->busn_res.end, subordinate_to_assign);
1130 1130
1131 /* Save the new subordinate in the bus struct of the bridge */ 1131 /* Save the new subordinate in the bus struct of the bridge */
1132 bridge_to_fix->subordinate = subordinate_to_assign; 1132 bridge_to_fix->busn_res.end = subordinate_to_assign;
1133 1133
1134 /* and update the PCI config space with the new subordinate */ 1134 /* and update the PCI config space with the new subordinate */
1135 pci_write_config_byte(bridge_to_fix->self, 1135 pci_write_config_byte(bridge_to_fix->self,
1136 PCI_SUBORDINATE_BUS, bridge_to_fix->subordinate); 1136 PCI_SUBORDINATE_BUS, bridge_to_fix->busn_res.end);
1137 } 1137 }
1138} 1138}
1139 1139