Skip to content

Commit ee27f44

Browse files
miklelappogregkh
authored andcommitted
stm class: Propagate source type to protocols
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 <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 07cf835 commit ee27f44

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

drivers/hwtracing/stm/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,15 +600,15 @@ EXPORT_SYMBOL_GPL(stm_data_write);
600600

601601
static ssize_t notrace
602602
stm_write(struct stm_device *stm, struct stm_output *output,
603-
unsigned int chan, const char *buf, size_t count)
603+
unsigned int chan, const char *buf, size_t count, struct stm_source_data *source)
604604
{
605605
int err;
606606

607607
/* stm->pdrv is serialized against policy_mutex */
608608
if (!stm->pdrv)
609609
return -ENODEV;
610610

611-
err = stm->pdrv->write(stm->data, output, chan, buf, count);
611+
err = stm->pdrv->write(stm->data, output, chan, buf, count, source);
612612
if (err < 0)
613613
return err;
614614

@@ -657,7 +657,7 @@ static ssize_t stm_char_write(struct file *file, const char __user *buf,
657657

658658
pm_runtime_get_sync(&stm->dev);
659659

660-
count = stm_write(stm, &stmf->output, 0, kbuf, count);
660+
count = stm_write(stm, &stmf->output, 0, kbuf, count, NULL);
661661

662662
pm_runtime_mark_last_busy(&stm->dev);
663663
pm_runtime_put_autosuspend(&stm->dev);
@@ -1299,7 +1299,7 @@ int notrace stm_source_write(struct stm_source_data *data,
12991299

13001300
stm = srcu_dereference(src->link, &stm_source_srcu);
13011301
if (stm)
1302-
count = stm_write(stm, &src->output, chan, buf, count);
1302+
count = stm_write(stm, &src->output, chan, buf, count, data);
13031303
else
13041304
count = -ENODEV;
13051305

drivers/hwtracing/stm/p_basic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#include "stm.h"
1111

1212
static ssize_t basic_write(struct stm_data *data, struct stm_output *output,
13-
unsigned int chan, const char *buf, size_t count)
13+
unsigned int chan, const char *buf, size_t count,
14+
struct stm_source_data *source)
1415
{
1516
unsigned int c = output->channel + chan;
1617
unsigned int m = output->master;

drivers/hwtracing/stm/p_sys-t.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ sys_t_clock_sync(struct stm_data *data, unsigned int m, unsigned int c)
285285
}
286286

287287
static ssize_t sys_t_write(struct stm_data *data, struct stm_output *output,
288-
unsigned int chan, const char *buf, size_t count)
288+
unsigned int chan, const char *buf, size_t count,
289+
struct stm_source_data *source)
289290
{
290291
struct sys_t_output *op = output->pdrv_private;
291292
unsigned int c = output->channel + chan;

drivers/hwtracing/stm/stm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct stm_protocol_driver {
9696
const char *name;
9797
ssize_t (*write)(struct stm_data *data,
9898
struct stm_output *output, unsigned int chan,
99-
const char *buf, size_t count);
99+
const char *buf, size_t count, struct stm_source_data *source);
100100
void (*policy_node_init)(void *arg);
101101
int (*output_open)(void *priv, struct stm_output *output);
102102
void (*output_close)(struct stm_output *output);

0 commit comments

Comments
 (0)