Merge tag 'pinctrl-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Jul 2012 21:05:46 +0000 (14:05 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Jul 2012 21:05:46 +0000 (14:05 -0700)
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

1  2 
drivers/pinctrl/pinctrl-imx.c
drivers/pinctrl/pinctrl-nomadik.c

index 90c837f469a612be02304415a85c384d7b9363af,2bafb5d9c712c82c45a0e4dca166da0cc1d78482..44e97265cd7dc59dd4658175ec394e9c0d0a2b23
@@@ -146,7 -146,7 +146,7 @@@ static int imx_dt_node_to_map(struct pi
        struct pinctrl_map *new_map;
        struct device_node *parent;
        int map_num = 1;
-       int i;
+       int i, j;
  
        /*
         * first find the group of this node and check if we need create
  
        /* create config map */
        new_map++;
-       for (i = 0; i < grp->npins; i++) {
+       for (i = j = 0; i < grp->npins; i++) {
                if (!(grp->configs[i] & IMX_NO_PAD_CTL)) {
-                       new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
-                       new_map[i].data.configs.group_or_pin =
+                       new_map[j].type = PIN_MAP_TYPE_CONFIGS_PIN;
+                       new_map[j].data.configs.group_or_pin =
                                        pin_get_name(pctldev, grp->pins[i]);
-                       new_map[i].data.configs.configs = &grp->configs[i];
-                       new_map[i].data.configs.num_configs = 1;
+                       new_map[j].data.configs.configs = &grp->configs[i];
+                       new_map[j].data.configs.num_configs = 1;
+                       j++;
                }
        }
  
@@@ -474,9 -475,7 +475,9 @@@ static int __devinit imx_pinctrl_parse_
                grp->configs[j] = config & ~IMX_PAD_SION;
        }
  
 +#ifdef DEBUG
        IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins);
 +#endif
  
        return 0;
  }
index dd9e6f26416da777dfb66231aca0c9f86bade9a0,e2a2dd1990c13008527186b1b81b82dc60f25198..53b0d49a7a1c817a7316fc25e57fff3a5c5341bb
@@@ -434,7 -434,7 +434,7 @@@ static int __nmk_config_pins(pin_cfg_t 
  /**
   * 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,11 -1194,11 +1194,11 @@@ static int __devinit nmk_gpio_probe(str
        }
  
        if (np) {
-               pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+               pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
                if (!pdata)
                        return -ENOMEM;
  
 -              if (of_get_property(np, "supports-sleepmode", NULL))
 +              if (of_get_property(np, "st,supports-sleepmode", NULL))
                        pdata->supports_sleepmode = true;
  
                if (of_property_read_u32(np, "gpio-bank", &dev->id)) {
                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;
        }
  
        /*
  
        ret = gpiochip_add(&nmk_chip->chip);
        if (ret)
-               goto out_free;
+               goto out;
  
        BUG_ON(nmk_chip->bank >= ARRAY_SIZE(nmk_gpio_chips));
  
        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);
  
        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;
  }