Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57109
b: refs/heads/master
c: 6776f3d
h: refs/heads/master
i:
  57107: 97e19bc
v: v3
  • Loading branch information
Enrico Scholz authored and Russell King committed May 26, 2007
1 parent 5b0660e commit cf961ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 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: ece97941c378b4a424530585a7c855e466f1bd2c
refs/heads/master: 6776f3d26aec60cb6e0fc770a00993accd09376f
23 changes: 9 additions & 14 deletions trunk/drivers/i2c/busses/i2c-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,20 +837,10 @@ static const struct i2c_algorithm i2c_pxa_algorithm = {
.functionality = i2c_pxa_functionality,
};

static struct pxa_i2c i2c_pxa = {
.lock = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock),
.adap = {
.owner = THIS_MODULE,
.algo = &i2c_pxa_algorithm,
.name = "pxa2xx-i2c.0",
.retries = 5,
},
};

#define res_len(r) ((r)->end - (r)->start + 1)
static int i2c_pxa_probe(struct platform_device *dev)
{
struct pxa_i2c *i2c = &i2c_pxa;
struct pxa_i2c *i2c;
struct resource *res;
struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
int ret;
Expand All @@ -864,15 +854,20 @@ static int i2c_pxa_probe(struct platform_device *dev)
if (!request_mem_region(res->start, res_len(res), res->name))
return -ENOMEM;

i2c = kmalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
if (!i2c) {
ret = -ENOMEM;
goto emalloc;
}

memcpy(i2c, &i2c_pxa, sizeof(struct pxa_i2c));
i2c->adap.owner = THIS_MODULE;
i2c->adap.algo = &i2c_pxa_algorithm;
i2c->adap.retries = 5;

spin_lock_init(&i2c->lock);
init_waitqueue_head(&i2c->wait);
i2c->adap.name[strlen(i2c->adap.name) - 1] = '0' + dev->id % 10;

sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id);

i2c->reg_base = ioremap(res->start, res_len(res));
if (!i2c->reg_base) {
Expand Down

0 comments on commit cf961ac

Please sign in to comment.