Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358753
b: refs/heads/master
c: b42748c
h: refs/heads/master
i:
  358751: e91ad34
v: v3
  • Loading branch information
Linus Walleij committed Jan 28, 2013
1 parent 6711766 commit d633922
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 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: 0e8f2fdacf1d44651aa7e57063c76142d1f4988b
refs/heads/master: b42748c970d1865685749960cb23f08e259a9f86
32 changes: 8 additions & 24 deletions trunk/drivers/gpio/gpio-pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
}
ret = pca953x_read_regs(chip, offset, chip->irq_stat);
if (ret)
goto out_failed;
return ret;

/*
* There is no way to know which GPIO line generated the
Expand All @@ -579,7 +579,8 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
if (!chip->domain)
return -ENODEV;

ret = request_threaded_irq(client->irq,
ret = devm_request_threaded_irq(&client->dev,
client->irq,
NULL,
pca953x_irq_handler,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
Expand All @@ -596,12 +597,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
return 0;
}

static void pca953x_irq_teardown(struct pca953x_chip *chip)
{
if (chip->irq_base != -1) {
free_irq(chip->client->irq, chip);
}
}
#else /* CONFIG_GPIO_PCA953X_IRQ */
static int pca953x_irq_setup(struct pca953x_chip *chip,
const struct i2c_device_id *id,
Expand All @@ -614,10 +609,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,

return 0;
}

static void pca953x_irq_teardown(struct pca953x_chip *chip)
{
}
#endif

/*
Expand Down Expand Up @@ -736,7 +727,8 @@ static int pca953x_probe(struct i2c_client *client,
int ret;
u32 invert = 0;

chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
chip = devm_kzalloc(&client->dev,
sizeof(struct pca953x_chip), GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -771,15 +763,15 @@ static int pca953x_probe(struct i2c_client *client,
else
ret = device_pca957x_init(chip, invert);
if (ret)
goto out_failed;
return ret;

ret = pca953x_irq_setup(chip, id, irq_base);
if (ret)
goto out_failed;
return ret;

ret = gpiochip_add(&chip->gpio_chip);
if (ret)
goto out_failed_irq;
return ret;

if (pdata && pdata->setup) {
ret = pdata->setup(client, chip->gpio_chip.base,
Expand All @@ -790,12 +782,6 @@ static int pca953x_probe(struct i2c_client *client,

i2c_set_clientdata(client, chip);
return 0;

out_failed_irq:
pca953x_irq_teardown(chip);
out_failed:
kfree(chip);
return ret;
}

static int pca953x_remove(struct i2c_client *client)
Expand All @@ -821,8 +807,6 @@ static int pca953x_remove(struct i2c_client *client)
return ret;
}

pca953x_irq_teardown(chip);
kfree(chip);
return 0;
}

Expand Down

0 comments on commit d633922

Please sign in to comment.