summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-nomadik.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-24 14:05:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-24 14:05:46 -0700
commit914311c9fb9bc01a215de9d848b72b5449c0e342 (patch)
treee130f41c9c721bae03d6e293ffe0039d1a9018ea /drivers/pinctrl/pinctrl-nomadik.c
parent5dedb9f3bd5bcb186313ea0c0cff8f2c525d4122 (diff)
parent8b8b091bf07fa7ef7f13c1ac40b30bcf74050b60 (diff)
Merge tag 'pinctrl-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control changes from Linus Walleij: "These are the accumulated pin control patches for v3.6: - Various cleanups to the U300 driver - Refactor the pin control core to automatically remove any GPIO ranges when the drivers are removed, instead of having the drivers do this explicitly. - Add a function for registering a batch of GPIO ranges. - Fix a number of incorrect but non-regressive error checks. - Incremental improvements to the COH901, i.MX and Nomadik drivers - Add a one-register-per-pin entirely Device Tree-based pin control driver from Tony Lindgren." * tag 'pinctrl-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: Add one-register-per-pin type device tree based pinctrl driver pinctrl/nomadik: add spi2_oc1_2 pin group pinctrl/nomadik: kerneldoc fix pinctrl/nomadik: use devm_* allocators for gpio probe pinctrl/nomadik: add pin group to mco function pinctrl/nomadik: add hsit_a_2 pin group pinctrl/nomadik: add pin group smcs1 and smps0 pinctrl/nomadik: fix hsir_a_1_pins pin list pinctrl: pinctrl-imx: fix map setting problem if NO_PAD_CTL is set pinctrl/coh901: use clk_prepare_[en|dis]able() pinctrl/pinctrl-tegra: remove IS_ERR checking of pmx->pctl pinctrl/pinctrl-spear: remove IS_ERR checking of pmx->pctl pinctrl/u300: drop unused variable pinctrl: select the proper symbol pinctrl: add pinctrl_add_gpio_ranges function pinctrl: remove pinctrl_remove_gpio_range pinctrl/pinctrl-core: cleanup pinctrl_register pinctrl/u300: delete pointless debug print pinctrl/pinctrl-u300: remove devm_kfree at driver unload
Diffstat (limited to 'drivers/pinctrl/pinctrl-nomadik.c')
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c37
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index dd9e6f26416..53b0d49a7a1 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -434,7 +434,7 @@ static int __nmk_config_pins(pin_cfg_t *cfgs, int num, bool sleep)
/**
* nmk_config_pin - configure a pin's mux attributes
* @cfg: pin confguration
- *
+ * @sleep: Non-zero to apply the sleep mode configuration
* Configures a pin's mode (alternate function or GPIO), its pull up status,
* and its sleep mode based on the specified configuration. The @cfg is
* usually one of the SoC specific macros defined in mach/<soc>-pins.h. These
@@ -1194,7 +1194,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
}
if (np) {
- pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+ pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;
@@ -1229,29 +1229,23 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
goto out;
}
- if (request_mem_region(res->start, resource_size(res),
- dev_name(&dev->dev)) == NULL) {
- ret = -EBUSY;
- goto out;
- }
-
- base = ioremap(res->start, resource_size(res));
+ base = devm_request_and_ioremap(&dev->dev, res);
if (!base) {
ret = -ENOMEM;
- goto out_release;
+ goto out;
}
- clk = clk_get(&dev->dev, NULL);
+ clk = devm_clk_get(&dev->dev, NULL);
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
- goto out_unmap;
+ goto out;
}
clk_prepare(clk);
- nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL);
+ nmk_chip = devm_kzalloc(&dev->dev, sizeof(*nmk_chip), GFP_KERNEL);
if (!nmk_chip) {
ret = -ENOMEM;
- goto out_clk;
+ goto out;
}
/*
@@ -1286,7 +1280,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
ret = gpiochip_add(&nmk_chip->chip);
if (ret)
- goto out_free;
+ goto out;
BUG_ON(nmk_chip->bank >= ARRAY_SIZE(nmk_gpio_chips));
@@ -1300,7 +1294,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
if (!nmk_chip->domain) {
pr_err("%s: Failed to create irqdomain\n", np->full_name);
ret = -ENOSYS;
- goto out_free;
+ goto out;
}
nmk_gpio_init_irq(nmk_chip);
@@ -1309,20 +1303,9 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
return 0;
-out_free:
- kfree(nmk_chip);
-out_clk:
- clk_disable(clk);
- clk_put(clk);
-out_unmap:
- iounmap(base);
-out_release:
- release_mem_region(res->start, resource_size(res));
out:
dev_err(&dev->dev, "Failure %i for GPIO %i-%i\n", ret,
pdata->first_gpio, pdata->first_gpio+31);
- if (np)
- kfree(pdata);
return ret;
}