Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330173
b: refs/heads/master
c: 005842e
h: refs/heads/master
i:
  330171: 64c8ab6
v: v3
  • Loading branch information
Alexandre Bounine authored and Linus Torvalds committed Oct 5, 2012
1 parent 0209349 commit b4e289c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 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: a7071efc20567f4b6c454ff93ca80daf51bf93e9
refs/heads/master: 005842efd1ac8ef455ebd28a8c713944863edc5a
3 changes: 1 addition & 2 deletions trunk/drivers/rapidio/rio-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ static void rio_init_em(struct rio_dev *rdev);
DEFINE_SPINLOCK(rio_global_list_lock);

static int next_destid = 0;
static int next_net = 0;
static int next_comptag = 1;

static int rio_mport_phys_table[] = {
Expand Down Expand Up @@ -1062,7 +1061,7 @@ static struct rio_net __devinit *rio_alloc_net(struct rio_mport *port)
INIT_LIST_HEAD(&net->mports);
list_add_tail(&port->nnode, &net->mports);
net->hport = port;
net->id = next_net++;
net->id = port->id;
}
return net;
}
Expand Down
51 changes: 49 additions & 2 deletions trunk/drivers/rapidio/rio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1260,15 +1260,62 @@ static int __devinit rio_init(void)
return 0;
}

static struct workqueue_struct *rio_wq;

struct rio_disc_work {
struct work_struct work;
struct rio_mport *mport;
};

static void __devinit disc_work_handler(struct work_struct *_work)
{
struct rio_disc_work *work;

work = container_of(_work, struct rio_disc_work, work);
pr_debug("RIO: discovery work for mport %d %s\n",
work->mport->id, work->mport->name);
rio_disc_mport(work->mport);

kfree(work);
}

int __devinit rio_init_mports(void)
{
struct rio_mport *port;
struct rio_disc_work *work;
int no_disc = 0;

list_for_each_entry(port, &rio_mports, node) {
if (port->host_deviceid >= 0)
rio_enum_mport(port);
else
rio_disc_mport(port);
else if (!no_disc) {
if (!rio_wq) {
rio_wq = alloc_workqueue("riodisc", 0, 0);
if (!rio_wq) {
pr_err("RIO: unable allocate rio_wq\n");
no_disc = 1;
continue;
}
}

work = kzalloc(sizeof *work, GFP_KERNEL);
if (!work) {
pr_err("RIO: no memory for work struct\n");
no_disc = 1;
continue;
}

work->mport = port;
INIT_WORK(&work->work, disc_work_handler);
queue_work(rio_wq, &work->work);
}
}

if (rio_wq) {
pr_debug("RIO: flush discovery workqueue\n");
flush_workqueue(rio_wq);
pr_debug("RIO: flush discovery workqueue finished\n");
destroy_workqueue(rio_wq);
}

rio_init();
Expand Down

0 comments on commit b4e289c

Please sign in to comment.