Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330171
b: refs/heads/master
c: fa3dbaa
h: refs/heads/master
i:
  330169: 7f9e5fa
  330167: b046cb8
v: v3
  • Loading branch information
Alexandre Bounine authored and Linus Torvalds committed Oct 5, 2012
1 parent d64be88 commit 64c8ab6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d4630dcf41214719cf44a94f8eec2a83f69943b
refs/heads/master: fa3dbaa0109d9fff23f7fd28c245bee880757ecd
62 changes: 20 additions & 42 deletions trunk/drivers/rapidio/rio-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/jiffies.h>
#include <linux/slab.h>

Expand All @@ -39,8 +40,6 @@
LIST_HEAD(rio_devices);
static LIST_HEAD(rio_switches);

static void rio_enum_timeout(unsigned long);

static void rio_init_em(struct rio_dev *rdev);

DEFINE_SPINLOCK(rio_global_list_lock);
Expand All @@ -49,9 +48,6 @@ static int next_destid = 0;
static int next_net = 0;
static int next_comptag = 1;

static struct timer_list rio_enum_timer =
TIMER_INITIALIZER(rio_enum_timeout, 0, 0);

static int rio_mport_phys_table[] = {
RIO_EFB_PAR_EP_ID,
RIO_EFB_PAR_EP_REC_ID,
Expand Down Expand Up @@ -1233,20 +1229,6 @@ static void rio_build_route_tables(void)
}
}

/**
* rio_enum_timeout- Signal that enumeration timed out
* @data: Address of timeout flag.
*
* When the enumeration complete timer expires, set a flag that
* signals to the discovery process that enumeration did not
* complete in a sane amount of time.
*/
static void rio_enum_timeout(unsigned long data)
{
/* Enumeration timed out, set flag */
*(int *)data = 1;
}

/**
* rio_disc_mport- Start discovery through a master port
* @mport: Master port to send transactions
Expand All @@ -1260,34 +1242,33 @@ static void rio_enum_timeout(unsigned long data)
int __devinit rio_disc_mport(struct rio_mport *mport)
{
struct rio_net *net = NULL;
int enum_timeout_flag = 0;
unsigned long to_end;

printk(KERN_INFO "RIO: discover master port %d, %s\n", mport->id,
mport->name);

/* If master port has an active link, allocate net and discover peers */
if (rio_mport_is_active(mport)) {
if (!(net = rio_alloc_net(mport))) {
printk(KERN_ERR "RIO: Failed to allocate new net\n");
goto bail;
}
pr_debug("RIO: wait for enumeration to complete...\n");

pr_debug("RIO: wait for enumeration complete...");

rio_enum_timer.expires =
jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ;
rio_enum_timer.data = (unsigned long)&enum_timeout_flag;
add_timer(&rio_enum_timer);
while (!rio_enum_complete(mport)) {
mdelay(1);
if (enum_timeout_flag) {
del_timer_sync(&rio_enum_timer);
goto timeout;
}
to_end = jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ;
while (time_before(jiffies, to_end)) {
if (rio_enum_complete(mport))
goto enum_done;
schedule_timeout_uninterruptible(msecs_to_jiffies(10));
}
del_timer_sync(&rio_enum_timer);

pr_debug("done\n");
pr_debug("RIO: discovery timeout on mport %d %s\n",
mport->id, mport->name);
goto bail;
enum_done:
pr_debug("RIO: ... enumeration done\n");

net = rio_alloc_net(mport);
if (!net) {
printk(KERN_ERR "RIO: Failed to allocate new net\n");
goto bail;
}

/* Read DestID assigned by enumerator */
rio_local_read_config_32(mport, RIO_DID_CSR,
Expand All @@ -1307,9 +1288,6 @@ int __devinit rio_disc_mport(struct rio_mport *mport)
}

return 0;

timeout:
pr_debug("timeout\n");
bail:
bail:
return -EBUSY;
}

0 comments on commit 64c8ab6

Please sign in to comment.