diff options
Diffstat (limited to 'drivers/pinctrl/pinctrl-falcon.c')
| -rw-r--r-- | drivers/pinctrl/pinctrl-falcon.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c index fb73dcbb5ef3..100eed175c0d 100644 --- a/drivers/pinctrl/pinctrl-falcon.c +++ b/drivers/pinctrl/pinctrl-falcon.c @@ -1,26 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * linux/drivers/pinctrl/pinmux-falcon.c * based on linux/drivers/pinctrl/pinmux-pxa910.c * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * * Copyright (C) 2012 Thomas Langer <thomas.langer@lantiq.com> * Copyright (C) 2012 John Crispin <john@phrozen.org> */ -#include <linux/gpio.h> -#include <linux/interrupt.h> -#include <linux/slab.h> -#include <linux/export.h> #include <linux/err.h> +#include <linux/export.h> +#include <linux/gpio/driver.h> +#include <linux/interrupt.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_platform.h> #include <linux/of_address.h> -#include <linux/of_gpio.h> +#include <linux/of_platform.h> #include <linux/platform_device.h> +#include <linux/seq_file.h> +#include <linux/slab.h> #include "pinctrl-lantiq.h" @@ -99,12 +96,8 @@ static void lantiq_load_pin_desc(struct pinctrl_pin_desc *d, int bank, int len) int i; for (i = 0; i < len; i++) { - /* strlen("ioXYZ") + 1 = 6 */ - char *name = kzalloc(6, GFP_KERNEL); - - snprintf(name, 6, "io%d", base + i); d[i].number = base + i; - d[i].name = name; + d[i].name = kasprintf(GFP_KERNEL, "io%d", base + i); } pad_count[bank] = len; } @@ -438,32 +431,39 @@ static int pinctrl_falcon_probe(struct platform_device *pdev) /* load and remap the pad resources of the different banks */ for_each_compatible_node(np, NULL, "lantiq,pad-falcon") { - struct platform_device *ppdev = of_find_device_by_node(np); const __be32 *bank = of_get_property(np, "lantiq,bank", NULL); struct resource res; + struct platform_device *ppdev; u32 avail; int pins; if (!of_device_is_available(np)) continue; - if (!ppdev) { - dev_err(&pdev->dev, "failed to find pad pdev\n"); - continue; - } if (!bank || *bank >= PORTS) continue; if (of_address_to_resource(np, 0, &res)) continue; + + ppdev = of_find_device_by_node(np); + if (!ppdev) { + dev_err(&pdev->dev, "failed to find pad pdev\n"); + continue; + } + falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL); + put_device(&ppdev->dev); if (IS_ERR(falcon_info.clk[*bank])) { dev_err(&ppdev->dev, "failed to get clock\n"); + of_node_put(np); return PTR_ERR(falcon_info.clk[*bank]); } falcon_info.membase[*bank] = devm_ioremap_resource(&pdev->dev, &res); - if (IS_ERR(falcon_info.membase[*bank])) + if (IS_ERR(falcon_info.membase[*bank])) { + of_node_put(np); return PTR_ERR(falcon_info.membase[*bank]); + } avail = pad_r32(falcon_info.membase[*bank], LTQ_PADC_AVAIL); @@ -505,7 +505,7 @@ static struct platform_driver pinctrl_falcon_driver = { }, }; -int __init pinctrl_falcon_init(void) +static int __init pinctrl_falcon_init(void) { return platform_driver_register(&pinctrl_falcon_driver); } |
