diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:37 +0000 |
commit | 94ac2ab3fff96814d7460a27a0e9d004abbd4128 (patch) | |
tree | 9a4eb8cc234b540b0f4b93363109cdd37a20540b /drivers/soc/qcom/pmic_glink.c | |
parent | Adding debian version 6.8.12-1. (diff) | |
download | linux-94ac2ab3fff96814d7460a27a0e9d004abbd4128.tar.xz linux-94ac2ab3fff96814d7460a27a0e9d004abbd4128.zip |
Merging upstream version 6.9.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/soc/qcom/pmic_glink.c')
-rw-r--r-- | drivers/soc/qcom/pmic_glink.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c index 823fd108fa..f913e9bd57 100644 --- a/drivers/soc/qcom/pmic_glink.c +++ b/drivers/soc/qcom/pmic_glink.c @@ -11,7 +11,6 @@ #include <linux/slab.h> #include <linux/soc/qcom/pdr.h> #include <linux/soc/qcom/pmic_glink.h> -#include <linux/spinlock.h> enum { PMIC_GLINK_CLIENT_BATT = 0, @@ -37,7 +36,7 @@ struct pmic_glink { unsigned int pdr_state; /* serializing clients list updates */ - spinlock_t client_lock; + struct mutex client_lock; struct list_head clients; }; @@ -59,11 +58,10 @@ static void _devm_pmic_glink_release_client(struct device *dev, void *res) { struct pmic_glink_client *client = (struct pmic_glink_client *)res; struct pmic_glink *pg = client->pg; - unsigned long flags; - spin_lock_irqsave(&pg->client_lock, flags); + mutex_lock(&pg->client_lock); list_del(&client->node); - spin_unlock_irqrestore(&pg->client_lock, flags); + mutex_unlock(&pg->client_lock); } struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev, @@ -74,7 +72,6 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev, { struct pmic_glink_client *client; struct pmic_glink *pg = dev_get_drvdata(dev->parent); - unsigned long flags; client = devres_alloc(_devm_pmic_glink_release_client, sizeof(*client), GFP_KERNEL); if (!client) @@ -86,14 +83,9 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev, client->pdr_notify = pdr; client->priv = priv; - mutex_lock(&pg->state_lock); - spin_lock_irqsave(&pg->client_lock, flags); - + mutex_lock(&pg->client_lock); list_add(&client->node, &pg->clients); - client->pdr_notify(client->priv, pg->client_state); - - spin_unlock_irqrestore(&pg->client_lock, flags); - mutex_unlock(&pg->state_lock); + mutex_unlock(&pg->client_lock); devres_add(dev, client); @@ -115,7 +107,6 @@ static int pmic_glink_rpmsg_callback(struct rpmsg_device *rpdev, void *data, struct pmic_glink_client *client; struct pmic_glink_hdr *hdr; struct pmic_glink *pg = dev_get_drvdata(&rpdev->dev); - unsigned long flags; if (len < sizeof(*hdr)) { dev_warn(pg->dev, "ignoring truncated message\n"); @@ -124,12 +115,10 @@ static int pmic_glink_rpmsg_callback(struct rpmsg_device *rpdev, void *data, hdr = data; - spin_lock_irqsave(&pg->client_lock, flags); list_for_each_entry(client, &pg->clients, node) { if (client->id == le32_to_cpu(hdr->owner)) client->cb(data, len, client->priv); } - spin_unlock_irqrestore(&pg->client_lock, flags); return 0; } @@ -169,7 +158,6 @@ static void pmic_glink_state_notify_clients(struct pmic_glink *pg) { struct pmic_glink_client *client; unsigned int new_state = pg->client_state; - unsigned long flags; if (pg->client_state != SERVREG_SERVICE_STATE_UP) { if (pg->pdr_state == SERVREG_SERVICE_STATE_UP && pg->ept) @@ -180,10 +168,8 @@ static void pmic_glink_state_notify_clients(struct pmic_glink *pg) } if (new_state != pg->client_state) { - spin_lock_irqsave(&pg->client_lock, flags); list_for_each_entry(client, &pg->clients, node) client->pdr_notify(client->priv, new_state); - spin_unlock_irqrestore(&pg->client_lock, flags); pg->client_state = new_state; } } @@ -270,7 +256,7 @@ static int pmic_glink_probe(struct platform_device *pdev) pg->dev = &pdev->dev; INIT_LIST_HEAD(&pg->clients); - spin_lock_init(&pg->client_lock); + mutex_init(&pg->client_lock); mutex_init(&pg->state_lock); match_data = (unsigned long *)of_device_get_match_data(&pdev->dev); |