hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/pinctrl/pinctrl-xway.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/pinctrl/pinmux-xway.c
34 * based on linux/drivers/pinctrl/pinmux-pxa910.c
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as
7
- * publishhed by the Free Software Foundation.
85 *
96 * Copyright (C) 2012 John Crispin <john@phrozen.org>
107 * Copyright (C) 2015 Martin Schiller <mschiller@tdt.de>
....@@ -1708,12 +1705,10 @@
17081705 {
17091706 const struct of_device_id *match;
17101707 const struct pinctrl_xway_soc *xway_soc;
1711
- struct resource *res;
17121708 int ret, i;
17131709
17141710 /* get and remap our register range */
1715
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1716
- xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res);
1711
+ xway_info.membase[0] = devm_platform_ioremap_resource(pdev, 0);
17171712 if (IS_ERR(xway_info.membase[0]))
17181713 return PTR_ERR(xway_info.membase[0]);
17191714
....@@ -1734,13 +1729,11 @@
17341729 return -ENOMEM;
17351730
17361731 for (i = 0; i < xway_chip.ngpio; i++) {
1737
- /* strlen("ioXY") + 1 = 5 */
1738
- char *name = devm_kzalloc(&pdev->dev, 5, GFP_KERNEL);
1732
+ char *name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "io%d", i);
17391733
17401734 if (!name)
17411735 return -ENOMEM;
17421736
1743
- snprintf(name, 5, "io%d", i);
17441737 xway_info.pads[i].number = GPIO0 + i;
17451738 xway_info.pads[i].name = name;
17461739 }