1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

- Repair Syscon users not specifying the "syscon" compatible

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmesv8wACgkQUa+KL4f8
 d2GXZA//c6b/0pU6Hhg0h61jtG7cmKJ5gDkVJ3MtBL3lSznZLAySW6SvcESN/t4Z
 d1q3Ccck9da/uinxpu5sSSgvX/a55p/Z2du7BannuHrdyr/P4Iw3gNfAGJJQuajc
 53QWRNUSwiWhx1uPRWZQL2n9cgtjlmpY4HrOVWAuq1mESiIfB2pmdp7YlZeDc2XK
 2p1qO3Mt4CCz3MzIM2l0sb/j3KydWYkbMhnG6AeXECHG59SGoTJ5AFIWWZCEHvzk
 M9zNK3qBUGe7+HLHl/5STsO2t8CaUmSCo998+3w+xakYLWfHLdSGt0jZYPCTP0Oc
 pUo8PY+Y3FvPqTN6flRluCSH2H/yAZKr2bWyrSGa0ImPPGB93K1W++hEe8ycR1K2
 Ui7WAIEeLxCsXhza+V/XrO1Hsm9qklUYp+FM4JsiDOE7vDBbY8AXANGVauEsRIlo
 uKYH//mYiZy0gJ5h0PEqOsTqs9xgzY+J1FnRcI1YH/uxRA5yHYr/qYK1HXLprQPb
 yDBimgIu6MQz0XfzE7y0T/xGkBhYAXxMXJqQzO1vN60cuYvQfX6dSNv9k4UDkGe/
 dbLlBMKK9s1WacocYDJongBp7sDisT0Xt/amRg0DqfxqQ7BRYRnzE+6ASEUwfjcC
 VF2qrYcevreGmKpd6BAV5l0kZV1dXk1isK3E8FojBG7Vt6yOE6k=
 =t2Dj
 -----END PGP SIGNATURE-----

Merge tag 'mfd-fixes-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD fix from Lee Jones:

 - Fix syscon users not specifying the "syscon" compatible

* tag 'mfd-fixes-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
  mfd: syscon: Restore device_node_to_regmap() for non-syscon nodes
This commit is contained in:
Linus Torvalds 2025-02-12 14:22:37 -08:00
commit 4dc1d1bec8

View file

@ -159,6 +159,7 @@ err_regmap:
}
static struct regmap *device_node_get_regmap(struct device_node *np,
bool create_regmap,
bool check_res)
{
struct syscon *entry, *syscon = NULL;
@ -172,7 +173,7 @@ static struct regmap *device_node_get_regmap(struct device_node *np,
}
if (!syscon) {
if (of_device_is_compatible(np, "syscon"))
if (create_regmap)
syscon = of_syscon_register(np, check_res);
else
syscon = ERR_PTR(-EINVAL);
@ -233,15 +234,37 @@ err_unlock:
}
EXPORT_SYMBOL_GPL(of_syscon_register_regmap);
/**
* device_node_to_regmap() - Get or create a regmap for specified device node
* @np: Device tree node
*
* Get a regmap for the specified device node. If there's not an existing
* regmap, then one is instantiated. This function should not be used if the
* device node has a custom regmap driver or has resources (clocks, resets) to
* be managed. Use syscon_node_to_regmap() instead for those cases.
*
* Return: regmap ptr on success, negative error code on failure.
*/
struct regmap *device_node_to_regmap(struct device_node *np)
{
return device_node_get_regmap(np, false);
return device_node_get_regmap(np, true, false);
}
EXPORT_SYMBOL_GPL(device_node_to_regmap);
/**
* syscon_node_to_regmap() - Get or create a regmap for specified syscon device node
* @np: Device tree node
*
* Get a regmap for the specified device node. If there's not an existing
* regmap, then one is instantiated if the node is a generic "syscon". This
* function is safe to use for a syscon registered with
* of_syscon_register_regmap().
*
* Return: regmap ptr on success, negative error code on failure.
*/
struct regmap *syscon_node_to_regmap(struct device_node *np)
{
return device_node_get_regmap(np, true);
return device_node_get_regmap(np, of_device_is_compatible(np, "syscon"), true);
}
EXPORT_SYMBOL_GPL(syscon_node_to_regmap);