1
0
Fork 0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-05-29 10:56:15 +02:00
openwrt/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regm...
John Audia 99c9d8abd6 kernel: bump 5.15 to 5.15.148
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.148

Removed upstreamed:
	generic/hack-5.15/321-powerpc_crtsavres_prereq.patch[1]

Manually rebased:
	target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch[2]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.148&id=0b11a145eb00d51f7ef18cfcae587b93f9adb1e9
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?h=v5.15.148&id=b67064bd372300a75293efbbc70624996dccffd4

Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
2024-02-01 21:36:00 +01:00

69 lines
2.1 KiB
Diff

From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Fri, 03 Apr 2020 19:50:03 +0200
Subject: add removed helper syscon_regmap_lookup_by_pdevname
The helper syscon_regmap_lookup_by_pdevname has been removed in 29d14b668d2f
("mfd: Remove unused helper syscon_regmap_lookup_by_pdevname") due to lack
of users.
Thus, we have to maintain it locally.
This patch includes a fix due to changes in driver_find_device;
kernel commit: 92ce7e83b4e5 ("driver_find_device: Unify the match function
with class_find_device()")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -209,6 +209,27 @@ struct regmap *syscon_regmap_lookup_by_c
}
EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible);
+static int syscon_match_pdevname(struct device *dev, const void *data)
+{
+ return !strcmp(dev_name(dev), (const char *)data);
+}
+
+struct regmap *syscon_regmap_lookup_by_pdevname(const char *s)
+{
+ struct device *dev;
+ struct syscon *syscon;
+
+ dev = driver_find_device(&syscon_driver.driver, NULL, (void *)s,
+ syscon_match_pdevname);
+ if (!dev)
+ return ERR_PTR(-EPROBE_DEFER);
+
+ syscon = dev_get_drvdata(dev);
+
+ return syscon->regmap;
+}
+EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_pdevname);
+
struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,
const char *property)
{
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -20,6 +20,7 @@ struct device_node;
extern struct regmap *device_node_to_regmap(struct device_node *np);
extern struct regmap *syscon_node_to_regmap(struct device_node *np);
extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
+extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
extern struct regmap *syscon_regmap_lookup_by_phandle(
struct device_node *np,
const char *property);
@@ -46,6 +47,11 @@ static inline struct regmap *syscon_regm
{
return ERR_PTR(-ENOTSUPP);
}
+
+static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s)
+{
+ return ERR_PTR(-ENOTSUPP);
+}
static inline struct regmap *syscon_regmap_lookup_by_phandle(
struct device_node *np,