diff options
Diffstat (limited to 'drivers/rapidio/rio-scan.c')
-rw-r--r-- | drivers/rapidio/rio-scan.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 7bdc67419cc3..4c15dbf81087 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c | |||
@@ -1134,19 +1134,30 @@ static void rio_pw_enable(struct rio_mport *port, int enable) | |||
1134 | /** | 1134 | /** |
1135 | * rio_enum_mport- Start enumeration through a master port | 1135 | * rio_enum_mport- Start enumeration through a master port |
1136 | * @mport: Master port to send transactions | 1136 | * @mport: Master port to send transactions |
1137 | * @flags: Enumeration control flags | ||
1137 | * | 1138 | * |
1138 | * Starts the enumeration process. If somebody has enumerated our | 1139 | * Starts the enumeration process. If somebody has enumerated our |
1139 | * master port device, then give up. If not and we have an active | 1140 | * master port device, then give up. If not and we have an active |
1140 | * link, then start recursive peer enumeration. Returns %0 if | 1141 | * link, then start recursive peer enumeration. Returns %0 if |
1141 | * enumeration succeeds or %-EBUSY if enumeration fails. | 1142 | * enumeration succeeds or %-EBUSY if enumeration fails. |
1142 | */ | 1143 | */ |
1143 | int rio_enum_mport(struct rio_mport *mport) | 1144 | int rio_enum_mport(struct rio_mport *mport, u32 flags) |
1144 | { | 1145 | { |
1145 | struct rio_net *net = NULL; | 1146 | struct rio_net *net = NULL; |
1146 | int rc = 0; | 1147 | int rc = 0; |
1147 | 1148 | ||
1148 | printk(KERN_INFO "RIO: enumerate master port %d, %s\n", mport->id, | 1149 | printk(KERN_INFO "RIO: enumerate master port %d, %s\n", mport->id, |
1149 | mport->name); | 1150 | mport->name); |
1151 | |||
1152 | /* | ||
1153 | * To avoid multiple start requests (repeat enumeration is not supported | ||
1154 | * by this method) check if enumeration/discovery was performed for this | ||
1155 | * mport: if mport was added into the list of mports for a net exit | ||
1156 | * with error. | ||
1157 | */ | ||
1158 | if (mport->nnode.next || mport->nnode.prev) | ||
1159 | return -EBUSY; | ||
1160 | |||
1150 | /* If somebody else enumerated our master port device, bail. */ | 1161 | /* If somebody else enumerated our master port device, bail. */ |
1151 | if (rio_enum_host(mport) < 0) { | 1162 | if (rio_enum_host(mport) < 0) { |
1152 | printk(KERN_INFO | 1163 | printk(KERN_INFO |
@@ -1236,14 +1247,16 @@ static void rio_build_route_tables(struct rio_net *net) | |||
1236 | /** | 1247 | /** |
1237 | * rio_disc_mport- Start discovery through a master port | 1248 | * rio_disc_mport- Start discovery through a master port |
1238 | * @mport: Master port to send transactions | 1249 | * @mport: Master port to send transactions |
1250 | * @flags: discovery control flags | ||
1239 | * | 1251 | * |
1240 | * Starts the discovery process. If we have an active link, | 1252 | * Starts the discovery process. If we have an active link, |
1241 | * then wait for the signal that enumeration is complete. | 1253 | * then wait for the signal that enumeration is complete (if wait |
1254 | * is allowed). | ||
1242 | * When enumeration completion is signaled, start recursive | 1255 | * When enumeration completion is signaled, start recursive |
1243 | * peer discovery. Returns %0 if discovery succeeds or %-EBUSY | 1256 | * peer discovery. Returns %0 if discovery succeeds or %-EBUSY |
1244 | * on failure. | 1257 | * on failure. |
1245 | */ | 1258 | */ |
1246 | int rio_disc_mport(struct rio_mport *mport) | 1259 | int rio_disc_mport(struct rio_mport *mport, u32 flags) |
1247 | { | 1260 | { |
1248 | struct rio_net *net = NULL; | 1261 | struct rio_net *net = NULL; |
1249 | unsigned long to_end; | 1262 | unsigned long to_end; |
@@ -1253,6 +1266,11 @@ int rio_disc_mport(struct rio_mport *mport) | |||
1253 | 1266 | ||
1254 | /* If master port has an active link, allocate net and discover peers */ | 1267 | /* If master port has an active link, allocate net and discover peers */ |
1255 | if (rio_mport_is_active(mport)) { | 1268 | if (rio_mport_is_active(mport)) { |
1269 | if (rio_enum_complete(mport)) | ||
1270 | goto enum_done; | ||
1271 | else if (flags & RIO_SCAN_ENUM_NO_WAIT) | ||
1272 | return -EAGAIN; | ||
1273 | |||
1256 | pr_debug("RIO: wait for enumeration to complete...\n"); | 1274 | pr_debug("RIO: wait for enumeration to complete...\n"); |
1257 | 1275 | ||
1258 | to_end = jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ; | 1276 | to_end = jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ; |