aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-sx150x.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-01-22 03:45:24 -0500
committerLinus Walleij <linus.walleij@linaro.org>2015-01-22 03:45:24 -0500
commit16858cc5d9a65a0aa03b81214e234e33fbfbd64a (patch)
tree46adcba20260c9fe9b4a1f30474475749197bd16 /drivers/gpio/gpio-sx150x.c
parent257e10752c13f2698d53e5df1744f4d7e41fdfa7 (diff)
gpio: sx150x: fixup OF support
Make OF conditional on CONFIG_OF_GPIO, rename and register the match table. Reported-by: Mike Krinkin <krinkin.m.u@gmail.com> Cc: Wei Chen <Wei.Chen@csr.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-sx150x.c')
-rw-r--r--drivers/gpio/gpio-sx150x.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index 88012e2b5b15..458d9d7952b8 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -152,12 +152,13 @@ static const struct i2c_device_id sx150x_id[] = {
152}; 152};
153MODULE_DEVICE_TABLE(i2c, sx150x_id); 153MODULE_DEVICE_TABLE(i2c, sx150x_id);
154 154
155static const struct of_device_id sx150x_dt_id[] = { 155static const struct of_device_id sx150x_of_match[] = {
156 { .compatible = "semtech,sx1508q" }, 156 { .compatible = "semtech,sx1508q" },
157 { .compatible = "semtech,sx1509q" }, 157 { .compatible = "semtech,sx1509q" },
158 { .compatible = "semtech,sx1506q" }, 158 { .compatible = "semtech,sx1506q" },
159 {}, 159 {},
160}; 160};
161MODULE_DEVICE_TABLE(of, sx150x_of_match);
161 162
162static s32 sx150x_i2c_write(struct i2c_client *client, u8 reg, u8 val) 163static s32 sx150x_i2c_write(struct i2c_client *client, u8 reg, u8 val)
163{ 164{
@@ -484,8 +485,10 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
484 chip->gpio_chip.base = pdata->gpio_base; 485 chip->gpio_chip.base = pdata->gpio_base;
485 chip->gpio_chip.can_sleep = true; 486 chip->gpio_chip.can_sleep = true;
486 chip->gpio_chip.ngpio = chip->dev_cfg->ngpios; 487 chip->gpio_chip.ngpio = chip->dev_cfg->ngpios;
488#ifdef CONFIG_OF_GPIO
487 chip->gpio_chip.of_node = client->dev.of_node; 489 chip->gpio_chip.of_node = client->dev.of_node;
488 chip->gpio_chip.of_gpio_n_cells = 2; 490 chip->gpio_chip.of_gpio_n_cells = 2;
491#endif
489 if (pdata->oscio_is_gpo) 492 if (pdata->oscio_is_gpo)
490 ++chip->gpio_chip.ngpio; 493 ++chip->gpio_chip.ngpio;
491 494
@@ -681,7 +684,7 @@ static struct i2c_driver sx150x_driver = {
681 .driver = { 684 .driver = {
682 .name = "sx150x", 685 .name = "sx150x",
683 .owner = THIS_MODULE, 686 .owner = THIS_MODULE,
684 .of_match_table = of_match_ptr(sx150x_dt_id), 687 .of_match_table = of_match_ptr(sx150x_of_match),
685 }, 688 },
686 .probe = sx150x_probe, 689 .probe = sx150x_probe,
687 .remove = sx150x_remove, 690 .remove = sx150x_remove,