The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=35fee38c77f1bb1a30a2c62b8eca923463dbed7e

commit 35fee38c77f1bb1a30a2c62b8eca923463dbed7e
Author:     Andrew Turner <and...@freebsd.org>
AuthorDate: 2025-06-09 13:21:35 +0000
Commit:     Andrew Turner <and...@freebsd.org>
CommitDate: 2025-06-04 01:32:39 +0000

    Revert "scmi: Add optional asynchronous handling of replies"
    
    Revert to reapply series as some patches were incorrect versions
    
    This reverts commit b802926b7b145d7cfe2465ac4e19f062a9eb6e6d.
---
 sys/dev/firmware/arm/scmi.c | 46 +++++----------------------------------------
 sys/dev/firmware/arm/scmi.h |  1 -
 2 files changed, 5 insertions(+), 42 deletions(-)

diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c
index 0b165e413674..950bbf94eeb6 100644
--- a/sys/dev/firmware/arm/scmi.c
+++ b/sys/dev/firmware/arm/scmi.c
@@ -43,7 +43,6 @@
 #include <sys/mutex.h>
 #include <sys/queue.h>
 #include <sys/refcount.h>
-#include <sys/taskqueue.h>
 
 #include <dev/clk/clk.h>
 #include <dev/fdt/simplebus.h>
@@ -95,8 +94,6 @@ struct scmi_req {
        bool            use_polling;
        bool            done;
        bool            is_raw;
-       device_t        dev;
-       struct task     tsk;
        struct mtx      mtx;
        LIST_ENTRY(scmi_req)    next;
        int             protocol_id;
@@ -106,7 +103,6 @@ struct scmi_req {
        struct scmi_msg msg;
 };
 
-#define tsk_to_req(t)  __containerof((t), struct scmi_req, tsk)
 #define buf_to_msg(b)  __containerof((b), struct scmi_msg, payld)
 #define msg_to_req(m)  __containerof((m), struct scmi_req, msg)
 #define buf_to_req(b)  msg_to_req(buf_to_msg(b))
@@ -135,9 +131,7 @@ struct scmi_transport {
 static void            scmi_transport_configure(struct scmi_transport_desc *, 
phandle_t);
 static int             scmi_transport_init(struct scmi_softc *, phandle_t);
 static void            scmi_transport_cleanup(struct scmi_softc *);
-static void            scmi_req_async_waiter(void *, int);
-static struct scmi_reqs_pool *scmi_reqs_pool_allocate(device_t, const int,
-                           const int);
+static struct scmi_reqs_pool *scmi_reqs_pool_allocate(const int, const int);
 static void            scmi_reqs_pool_free(struct scmi_reqs_pool *);
 static struct scmi_req *scmi_req_alloc(struct scmi_softc *, enum scmi_chan);
 static struct scmi_req *scmi_req_initialized_alloc(device_t, int, int);
@@ -223,7 +217,7 @@ DRIVER_MODULE(scmi, simplebus, scmi_driver, 0, 0);
 MODULE_VERSION(scmi, 1);
 
 static struct scmi_reqs_pool *
-scmi_reqs_pool_allocate(device_t dev, const int max_msg, const int 
max_payld_sz)
+scmi_reqs_pool_allocate(const int max_msg, const int max_payld_sz)
 {
        struct scmi_reqs_pool *rp;
        struct scmi_req *req;
@@ -235,10 +229,6 @@ scmi_reqs_pool_allocate(device_t dev, const int max_msg, 
const int max_payld_sz)
                req = malloc(sizeof(*req) + max_payld_sz,
                    M_DEVBUF, M_ZERO | M_WAITOK);
 
-               req->dev = dev;
-               req->tsk.ta_context = &req->tsk;
-               req->tsk.ta_func = scmi_req_async_waiter;
-
                mtx_init(&req->mtx, "req", "SCMI", MTX_SPIN);
                LIST_INSERT_HEAD(&rp->head, req, next);
        }
@@ -290,14 +280,14 @@ scmi_transport_init(struct scmi_softc *sc, phandle_t node)
        trs->inflight_ht = hashinit(td->max_msg, M_DEVBUF, &trs->inflight_mask);
 
        trs->chans[SCMI_CHAN_A2P] =
-           scmi_reqs_pool_allocate(sc->dev, td->max_msg, td->max_payld_sz);
+           scmi_reqs_pool_allocate(td->max_msg, td->max_payld_sz);
        if (trs->chans[SCMI_CHAN_A2P] == NULL) {
                free(trs, M_DEVBUF);
                return (ENOMEM);
        }
 
        trs->chans[SCMI_CHAN_P2A] =
-           scmi_reqs_pool_allocate(sc->dev, td->max_msg, td->max_payld_sz);
+           scmi_reqs_pool_allocate(td->max_msg, td->max_payld_sz);
        if (trs->chans[SCMI_CHAN_P2A] == NULL) {
                scmi_reqs_pool_free(trs->chans[SCMI_CHAN_A2P]);
                free(trs, M_DEVBUF);
@@ -658,8 +648,7 @@ scmi_wait_for_response(struct scmi_softc *sc, struct 
scmi_req *req, void **out)
                SCMI_COLLECT_REPLY(sc->dev, &req->msg);
                if (req->msg.payld[0] != 0)
                        ret = req->msg.payld[0];
-               if (out != NULL)
-                       *out = &req->msg.payld[SCMI_MSG_HDR_SIZE];
+               *out = &req->msg.payld[SCMI_MSG_HDR_SIZE];
        } else {
                device_printf(sc->dev,
                    "Request for token 0x%X timed-out.\n", req->token);
@@ -714,20 +703,6 @@ scmi_msg_get(device_t dev, int tx_payld_sz, int 
rx_payld_sz)
        return (&req->msg);
 }
 
-static void
-scmi_req_async_waiter(void *context, int pending)
-{
-       struct task *ta = context;
-       struct scmi_softc *sc;
-       struct scmi_req *req;
-
-       req = tsk_to_req(ta);
-       sc = device_get_softc(req->dev);
-       scmi_wait_for_response(sc, req, NULL);
-
-       scmi_msg_put(req->dev, &req->msg);
-}
-
 void
 scmi_msg_put(device_t dev, struct scmi_msg *msg)
 {
@@ -788,14 +763,3 @@ scmi_request(device_t dev, void *in, void **out)
 
        return (scmi_wait_for_response(sc, req, out));
 }
-
-int
-scmi_msg_async_enqueue(struct scmi_msg *msg)
-{
-       struct scmi_req *req;
-
-       req = msg_to_req(msg);
-
-       return taskqueue_enqueue_flags(taskqueue_thread, &req->tsk,
-           TASKQUEUE_FAIL_IF_PENDING | TASKQUEUE_FAIL_IF_CANCELING);
-}
diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h
index 990759237964..f5b4173272bb 100644
--- a/sys/dev/firmware/arm/scmi.h
+++ b/sys/dev/firmware/arm/scmi.h
@@ -84,7 +84,6 @@ struct scmi_msg *scmi_msg_get(device_t dev, int tx_payld_sz, 
int rx_payld_sz);
 void scmi_msg_put(device_t dev, struct scmi_msg *msg);
 int scmi_request(device_t dev, void *in, void **);
 int scmi_request_tx(device_t dev, void *in);
-int scmi_msg_async_enqueue(struct scmi_msg *msg);
 void scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t 
rx_len);
 
 DECLARE_CLASS(scmi_driver);

Reply via email to