Loading drivers/hwtracing/coresight/coresight-byte-cntr.c +6 −12 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * * Description: CoreSight Trace Memory Controller driver */ Loading @@ -20,21 +20,17 @@ static struct tmc_drvdata *tmcdrvdata; static void tmc_etr_read_bytes(struct byte_cntr *byte_cntr_data, loff_t *ppos, size_t bytes, size_t *len, char **bufp) { struct etr_flat_buf *flat_buf = tmcdrvdata->etr_buf->private; if (*bufp >= (char *)(flat_buf->vaddr + tmcdrvdata->size)) *bufp = flat_buf->vaddr; struct etr_buf *etr_buf = tmcdrvdata->etr_buf; size_t actual; if (*len >= bytes) *len = bytes; else if (((uint32_t)*ppos % bytes) + *len > bytes) *len = bytes - ((uint32_t)*ppos % bytes); if ((*bufp + *len) > (char *)(flat_buf->vaddr + tmcdrvdata->size)) *len = (char *)(flat_buf->vaddr + tmcdrvdata->size) - *bufp; if (*len == bytes || (*len + (uint32_t)*ppos) % bytes == 0) actual = tmc_etr_buf_get_data(etr_buf, *ppos, *len, bufp); *len = actual; if (actual == bytes || (actual + (uint32_t)*ppos) % bytes == 0) atomic_dec(&byte_cntr_data->irq_cnt); } Loading Loading @@ -76,8 +72,6 @@ static ssize_t tmc_etr_byte_cntr_read(struct file *fp, char __user *data, if (!byte_cntr_data->read_active) goto err0; bufp = (char *)(tmcdrvdata->buf + *ppos); if (byte_cntr_data->enable) { if (!atomic_read(&byte_cntr_data->irq_cnt)) { mutex_unlock(&byte_cntr_data->byte_cntr_lock); Loading drivers/hwtracing/coresight/coresight-tmc-etr.c +1 −1 Original line number Diff line number Diff line Loading @@ -853,7 +853,7 @@ void tmc_free_etr_buf(struct etr_buf *etr_buf) * Returns: The size of the linear data available @pos, with *bufpp * updated to point to the buffer. */ static ssize_t tmc_etr_buf_get_data(struct etr_buf *etr_buf, ssize_t tmc_etr_buf_get_data(struct etr_buf *etr_buf, u64 offset, size_t len, char **bufpp) { /* Adjust the length to limit this transaction to end of buffer */ Loading drivers/hwtracing/coresight/coresight-tmc.c +6 −1 Original line number Diff line number Diff line Loading @@ -456,8 +456,13 @@ static ssize_t block_size_store(struct device *dev, if (!drvdata->byte_cntr) return -EINVAL; if (val && val < 4096) { pr_err("Assign minimum block size of 4096 bytes\n"); return -EINVAL; } mutex_lock(&drvdata->byte_cntr->byte_cntr_lock); drvdata->byte_cntr->block_size = val * 8; drvdata->byte_cntr->block_size = val; mutex_unlock(&drvdata->byte_cntr->byte_cntr_lock); return size; Loading drivers/hwtracing/coresight/coresight-tmc.h +2 −1 Original line number Diff line number Diff line Loading @@ -322,7 +322,8 @@ extern struct byte_cntr *byte_cntr_init(struct amba_device *adev, extern const struct coresight_ops tmc_etr_cs_ops; ssize_t tmc_etr_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos, size_t len, char **bufpp); ssize_t tmc_etr_buf_get_data(struct etr_buf *etr_buf, u64 offset, size_t len, char **bufpp); #define TMC_REG_PAIR(name, lo_off, hi_off) \ static inline u64 \ Loading Loading
drivers/hwtracing/coresight/coresight-byte-cntr.c +6 −12 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * * Description: CoreSight Trace Memory Controller driver */ Loading @@ -20,21 +20,17 @@ static struct tmc_drvdata *tmcdrvdata; static void tmc_etr_read_bytes(struct byte_cntr *byte_cntr_data, loff_t *ppos, size_t bytes, size_t *len, char **bufp) { struct etr_flat_buf *flat_buf = tmcdrvdata->etr_buf->private; if (*bufp >= (char *)(flat_buf->vaddr + tmcdrvdata->size)) *bufp = flat_buf->vaddr; struct etr_buf *etr_buf = tmcdrvdata->etr_buf; size_t actual; if (*len >= bytes) *len = bytes; else if (((uint32_t)*ppos % bytes) + *len > bytes) *len = bytes - ((uint32_t)*ppos % bytes); if ((*bufp + *len) > (char *)(flat_buf->vaddr + tmcdrvdata->size)) *len = (char *)(flat_buf->vaddr + tmcdrvdata->size) - *bufp; if (*len == bytes || (*len + (uint32_t)*ppos) % bytes == 0) actual = tmc_etr_buf_get_data(etr_buf, *ppos, *len, bufp); *len = actual; if (actual == bytes || (actual + (uint32_t)*ppos) % bytes == 0) atomic_dec(&byte_cntr_data->irq_cnt); } Loading Loading @@ -76,8 +72,6 @@ static ssize_t tmc_etr_byte_cntr_read(struct file *fp, char __user *data, if (!byte_cntr_data->read_active) goto err0; bufp = (char *)(tmcdrvdata->buf + *ppos); if (byte_cntr_data->enable) { if (!atomic_read(&byte_cntr_data->irq_cnt)) { mutex_unlock(&byte_cntr_data->byte_cntr_lock); Loading
drivers/hwtracing/coresight/coresight-tmc-etr.c +1 −1 Original line number Diff line number Diff line Loading @@ -853,7 +853,7 @@ void tmc_free_etr_buf(struct etr_buf *etr_buf) * Returns: The size of the linear data available @pos, with *bufpp * updated to point to the buffer. */ static ssize_t tmc_etr_buf_get_data(struct etr_buf *etr_buf, ssize_t tmc_etr_buf_get_data(struct etr_buf *etr_buf, u64 offset, size_t len, char **bufpp) { /* Adjust the length to limit this transaction to end of buffer */ Loading
drivers/hwtracing/coresight/coresight-tmc.c +6 −1 Original line number Diff line number Diff line Loading @@ -456,8 +456,13 @@ static ssize_t block_size_store(struct device *dev, if (!drvdata->byte_cntr) return -EINVAL; if (val && val < 4096) { pr_err("Assign minimum block size of 4096 bytes\n"); return -EINVAL; } mutex_lock(&drvdata->byte_cntr->byte_cntr_lock); drvdata->byte_cntr->block_size = val * 8; drvdata->byte_cntr->block_size = val; mutex_unlock(&drvdata->byte_cntr->byte_cntr_lock); return size; Loading
drivers/hwtracing/coresight/coresight-tmc.h +2 −1 Original line number Diff line number Diff line Loading @@ -322,7 +322,8 @@ extern struct byte_cntr *byte_cntr_init(struct amba_device *adev, extern const struct coresight_ops tmc_etr_cs_ops; ssize_t tmc_etr_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos, size_t len, char **bufpp); ssize_t tmc_etr_buf_get_data(struct etr_buf *etr_buf, u64 offset, size_t len, char **bufpp); #define TMC_REG_PAIR(name, lo_off, hi_off) \ static inline u64 \ Loading