Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317002
b: refs/heads/master
c: fe6e125
h: refs/heads/master
v: v3
  • Loading branch information
Richard Zhao authored and Greg Kroah-Hartman committed Jul 9, 2012
1 parent 6798d77 commit 3cc8823
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 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: cbc6dc2af39e1395564445fd71cfcc1c70a96277
refs/heads/master: fe6e125e30fb9d93fdfc5e3e3702b9c7c3076194
21 changes: 16 additions & 5 deletions trunk/drivers/usb/chipidea/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
Expand Down Expand Up @@ -332,17 +333,24 @@ static irqreturn_t ci_irq(int irq, void *data)
return ci->role == CI_ROLE_END ? ret : ci_role(ci)->irq(ci);
}

static DEFINE_IDA(ci_ida);

struct platform_device *ci13xxx_add_device(struct device *dev,
struct resource *res, int nres,
struct ci13xxx_platform_data *platdata)
{
struct platform_device *pdev;
int ret;
int id, ret;

/* FIXME: find a way to choose id */
pdev = platform_device_alloc("ci_hdrc", -1);
if (!pdev)
return ERR_PTR(-ENOMEM);
id = ida_simple_get(&ci_ida, 0, 0, GFP_KERNEL);
if (id < 0)
return ERR_PTR(id);

pdev = platform_device_alloc("ci_hdrc", id);
if (!pdev) {
ret = -ENOMEM;
goto put_id;
}

pdev->dev.parent = dev;
pdev->dev.dma_mask = dev->dma_mask;
Expand All @@ -365,13 +373,16 @@ struct platform_device *ci13xxx_add_device(struct device *dev,

err:
platform_device_put(pdev);
put_id:
ida_simple_remove(&ci_ida, id);
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(ci13xxx_add_device);

void ci13xxx_remove_device(struct platform_device *pdev)
{
platform_device_unregister(pdev);
ida_simple_remove(&ci_ida, pdev->id);
}
EXPORT_SYMBOL_GPL(ci13xxx_remove_device);

Expand Down

0 comments on commit 3cc8823

Please sign in to comment.