stm class: Propagate source type to protocols
authorMikhail Lappo <miklelappo@gmail.com>
Mon, 29 Apr 2024 13:01:07 +0000 (16:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 May 2024 16:57:21 +0000 (18:57 +0200)
Pass stm source type via stm_write() to allow different handling on
protocol level.

The measure above should allow protocol level encoder to differentiate
and accordingly pack the messages. As an example SyS-T might get use of
ftrace message ID's and instead of applying regular header, pack them
as SyS-T catalog or SyS-T Structured Binary Data message to allow proper
decoding on the other side.

Signed-off-by: Mikhail Lappo <miklelappo@gmail.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240429130119.1518073-4-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/stm/core.c
drivers/hwtracing/stm/p_basic.c
drivers/hwtracing/stm/p_sys-t.c
drivers/hwtracing/stm/stm.h

index 20895d39156236d19ff88cfeaab13f59b26110bd..ccf39a80dc4f606b25720aec05f929a4e9068057 100644 (file)
@@ -600,7 +600,7 @@ EXPORT_SYMBOL_GPL(stm_data_write);
 
 static ssize_t notrace
 stm_write(struct stm_device *stm, struct stm_output *output,
-         unsigned int chan, const char *buf, size_t count)
+         unsigned int chan, const char *buf, size_t count, struct stm_source_data *source)
 {
        int err;
 
@@ -608,7 +608,7 @@ stm_write(struct stm_device *stm, struct stm_output *output,
        if (!stm->pdrv)
                return -ENODEV;
 
-       err = stm->pdrv->write(stm->data, output, chan, buf, count);
+       err = stm->pdrv->write(stm->data, output, chan, buf, count, source);
        if (err < 0)
                return err;
 
@@ -657,7 +657,7 @@ static ssize_t stm_char_write(struct file *file, const char __user *buf,
 
        pm_runtime_get_sync(&stm->dev);
 
-       count = stm_write(stm, &stmf->output, 0, kbuf, count);
+       count = stm_write(stm, &stmf->output, 0, kbuf, count, NULL);
 
        pm_runtime_mark_last_busy(&stm->dev);
        pm_runtime_put_autosuspend(&stm->dev);
@@ -1299,7 +1299,7 @@ int notrace stm_source_write(struct stm_source_data *data,
 
        stm = srcu_dereference(src->link, &stm_source_srcu);
        if (stm)
-               count = stm_write(stm, &src->output, chan, buf, count);
+               count = stm_write(stm, &src->output, chan, buf, count, data);
        else
                count = -ENODEV;
 
index 8980a6a5fd6c45da1e501c470d03c03d5e984992..5525c975cc6f63d94cc8c63816802943a86c003c 100644 (file)
@@ -10,7 +10,8 @@
 #include "stm.h"
 
 static ssize_t basic_write(struct stm_data *data, struct stm_output *output,
-                          unsigned int chan, const char *buf, size_t count)
+                          unsigned int chan, const char *buf, size_t count,
+                          struct stm_source_data *source)
 {
        unsigned int c = output->channel + chan;
        unsigned int m = output->master;
index 8254971c02e70eec9fd4dad08824a0bfa8cb4ae3..5b4b9f350ec1f80292f847e7e21b81b79745777c 100644 (file)
@@ -285,7 +285,8 @@ sys_t_clock_sync(struct stm_data *data, unsigned int m, unsigned int c)
 }
 
 static ssize_t sys_t_write(struct stm_data *data, struct stm_output *output,
-                          unsigned int chan, const char *buf, size_t count)
+                          unsigned int chan, const char *buf, size_t count,
+                          struct stm_source_data *source)
 {
        struct sys_t_output *op = output->pdrv_private;
        unsigned int c = output->channel + chan;
index a9be49fc7a6b0dc99ab43ca2ec54da6327e3e848..85dda6e0d10c5df77c17b311a8a80e3ee8bb548b 100644 (file)
@@ -96,7 +96,7 @@ struct stm_protocol_driver {
        const char      *name;
        ssize_t         (*write)(struct stm_data *data,
                                 struct stm_output *output, unsigned int chan,
-                                const char *buf, size_t count);
+                                const char *buf, size_t count, struct stm_source_data *source);
        void            (*policy_node_init)(void *arg);
        int             (*output_open)(void *priv, struct stm_output *output);
        void            (*output_close)(struct stm_output *output);