Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
798bb31
scripts/checkpatch.pl: remove trace format warnings
plbossart Jan 16, 2019
12454e0
src/audio/buffer.c: fix style
plbossart Jan 16, 2019
3ab6139
src/audio/component.c: fix style
plbossart Jan 16, 2019
26b2fd5
src/audio/dai.c: fix style
plbossart Jan 16, 2019
5b1a4ec
src/audio/fir.h: fix style
plbossart Jan 16, 2019
6f5010e
src/audio/host.c: fix style
plbossart Jan 16, 2019
3f3829f
src/audio/mixer.c: fix style
plbossart Jan 16, 2019
712c498
src/audio/pipeline.c: fix style
plbossart Jan 16, 2019
492d8da
src/audio/pipeline_static.c: fix style
plbossart Jan 16, 2019
b3cc712
src/audio/tone.c: fix style
plbossart Jan 16, 2019
dd8b048
src/audio/volume.c: fix style
plbossart Jan 16, 2019
679a95e
src/drivers/dw-dma.c: fix style
plbossart Jan 16, 2019
6529c48
src/drivers/intel/baytrail/ipc.c: fix style
plbossart Jan 16, 2019
eb70c75
src/drivers/intel/baytrail/ssp.c: fix style
plbossart Jan 16, 2019
83a9c0f
src/drivers/intel/baytrail/timer.c: fix style
plbossart Jan 16, 2019
f6a39b4
src/drivers/intel/cavs/dmic.c: fix style
plbossart Jan 16, 2019
5465579
src/drivers/intel/cavs/hda-dma.c: fix style
plbossart Jan 16, 2019
1237a3d
src/drivers/intel/cavs/ipc.c: fix style
plbossart Jan 16, 2019
a8c3294
src/drivers/intel/cavs/ssp.c: fix style
plbossart Jan 16, 2019
23177a0
src/drivers/intel/cavs/sue-ipc.c: fix style
plbossart Jan 16, 2019
cbf17df
src/drivers/intel/cavs/timer.c: fix style
plbossart Jan 16, 2019
48c3fbc
src/drivers/intel/haswell/ipc.c: fix style
plbossart Jan 16, 2019
23abfc8
src/drivers/intel/haswell/ssp.c: fix style
plbossart Jan 16, 2019
0081a6e
src/drivers/intel/haswell/timer.c: fix style
plbossart Jan 16, 2019
a378567
src/drivers/intel/pmc-ipc.c: fix style
plbossart Jan 16, 2019
1fedcde
src/host/schedule.c: fix style
plbossart Jan 16, 2019
f791786
src/host/testbench.c: fix style
plbossart Jan 16, 2019
7bdf449
src/host/topology.c: fix style
plbossart Jan 16, 2019
b96eb23
src/include/host/topology.h: fix style
plbossart Jan 16, 2019
2e5db13
src/include/sof/audio/buffer.h: fix style
plbossart Jan 16, 2019
ec69479
src/include/sof/audio/format.h: fix style
plbossart Jan 16, 2019
72dfb3c
src/include/sof/audio/pipeline.h: fix style
plbossart Jan 16, 2019
2832a88
src/include/sof/dai.h: fix style
plbossart Jan 16, 2019
41a69d5
src/include/sof/debug.h: fix style
plbossart Jan 16, 2019
25db599
src/include/sof/dma-trace.h: fix style
plbossart Jan 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5213,57 +5213,12 @@ sub process {
"Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst\n" . $herecurr);
}

# Check for user-visible strings broken across lines, which breaks the ability
# to grep for the string. Make exceptions when the previous string ends in a
# newline (multiple lines in one string constant) or '\t', '\r', ';', or '{'
# (common in inline assembly) or is a octal \123 or hexadecimal \xaf value
if ($line =~ /^\+\s*$String/ &&
$prevline =~ /"\s*$/ &&
$prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
if (WARN("SPLIT_STRING",
"quoted string split across lines\n" . $hereprev) &&
$fix &&
$prevrawline =~ /^\+.*"\s*$/ &&
$last_coalesced_string_linenr != $linenr - 1) {
my $extracted_string = get_quoted_string($line, $rawline);
my $comma_close = "";
if ($rawline =~ /\Q$extracted_string\E(\s*\)\s*;\s*$|\s*,\s*)/) {
$comma_close = $1;
}

fix_delete_line($fixlinenr - 1, $prevrawline);
fix_delete_line($fixlinenr, $rawline);
my $fixedline = $prevrawline;
$fixedline =~ s/"\s*$//;
$fixedline .= substr($extracted_string, 1) . trim($comma_close);
fix_insert_line($fixlinenr - 1, $fixedline);
$fixedline = $rawline;
$fixedline =~ s/\Q$extracted_string\E\Q$comma_close\E//;
if ($fixedline !~ /\+\s*$/) {
fix_insert_line($fixlinenr, $fixedline);
}
$last_coalesced_string_linenr = $linenr;
}
}

# check for missing a space in a string concatenation
if ($prevrawline =~ /[^\\]\w"$/ && $rawline =~ /^\+[\t ]+"\w/) {
WARN('MISSING_SPACE',
"break quoted strings at a space character\n" . $hereprev);
}

# check for an embedded function name in a string when the function is known

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singalsu I think @plbossart have done the function name warn for trace here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiuli Great that the annoyance is fixed! Due to that I've unfortunately had most of the time the pre commit script disabled.

# This does not work very well for -f --file checking as it depends on patch
# context providing the function name or a single line form for in-file
# function declarations
if ($line =~ /^\+.*$String/ &&
defined($context_function) &&
get_quoted_string($line, $rawline) =~ /\b$context_function\b/ &&
length(get_quoted_string($line, $rawline)) != (length($context_function) + 2)) {
WARN("EMBEDDED_FUNCTION_NAME",
"Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a string\n" . $herecurr);
}

# check for spaces before a quoted newline
if ($rawline =~ /^.*\".*\s\\n/) {
if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE",
Expand Down
22 changes: 12 additions & 10 deletions src/audio/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc)

/* allocate new buffer */
buffer = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*buffer));
if (buffer == NULL) {
if (!buffer) {
trace_buffer_error("buffer_new() error: "
"could not alloc structure");
return NULL;
}

buffer->addr = rballoc(RZONE_RUNTIME, desc->caps, desc->size);
if (buffer->addr == NULL) {
if (!buffer->addr) {
rfree(buffer);
trace_buffer_error("buffer_new() error: "
"could not alloc size = %u "
Expand All @@ -79,9 +79,11 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc)

memcpy(&buffer->ipc_buffer, desc, sizeof(*desc));

buffer->size = buffer->alloc_size = desc->size;
buffer->size = desc->size;
buffer->alloc_size = desc->size;
buffer->ipc_buffer = *desc;
buffer->w_ptr = buffer->r_ptr = buffer->addr;
buffer->w_ptr = buffer->addr;
buffer->r_ptr = buffer->addr;
buffer->end_addr = buffer->addr + buffer->ipc_buffer.size;
buffer->free = buffer->ipc_buffer.size;
buffer->avail = 0;
Expand Down Expand Up @@ -132,9 +134,8 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes)
dcache_invalidate_region(buffer->w_ptr, head);
if (tail)
dcache_invalidate_region(buffer->addr, tail);
}
else if (!buffer->source->is_dma_connected &&
buffer->sink->is_dma_connected) {
} else if (!buffer->source->is_dma_connected &&
buffer->sink->is_dma_connected) {
/* need write back to memory for sink component to use */
dcache_writeback_region(buffer->w_ptr, head);
if (tail)
Expand Down Expand Up @@ -167,7 +168,7 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes)
(buffer->ipc_buffer.comp.id << 16) | buffer->size);
tracev_buffer("comp_update_buffer_produce(), ((buffer->r_ptr - buffer"
"->addr) << 16 | (buffer->w_ptr - buffer->addr)) = %08x",
(buffer->r_ptr - buffer->addr) << 16 |
(buffer->r_ptr - buffer->addr) << 16 |
(buffer->w_ptr - buffer->addr));
}

Expand All @@ -181,7 +182,8 @@ void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes)

/* check for pointer wrap */
if (buffer->r_ptr >= buffer->end_addr)
buffer->r_ptr = buffer->addr + (buffer->r_ptr - buffer->end_addr);
buffer->r_ptr = buffer->addr +
(buffer->r_ptr - buffer->end_addr);

/* calculate available bytes */
if (buffer->r_ptr < buffer->w_ptr)
Expand All @@ -201,7 +203,7 @@ void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes)
spin_unlock_irq(&buffer->lock, flags);

tracev_buffer("comp_update_buffer_consume(), %u, %u, %u",
(buffer->avail << 16) | buffer->free,
(buffer->avail << 16) | buffer->free,
(buffer->ipc_buffer.comp.id << 16) | buffer->size,
(buffer->r_ptr - buffer->addr) << 16 |
(buffer->w_ptr - buffer->addr));
Expand Down
12 changes: 6 additions & 6 deletions src/audio/component.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp)

/* find the driver for our new component */
drv = get_drv(comp->type);
if (drv == NULL) {
if (!drv) {
trace_comp_error("comp_new() error: driver not found, "
"comp->type = %u", comp->type);
return NULL;
}

/* create the new component */
cdev = drv->ops.new(comp);
if (cdev == NULL) {
if (!cdev) {
trace_comp_error("comp_new() error: "
"unable to create the new component");
return NULL;
Expand Down Expand Up @@ -156,9 +156,9 @@ int comp_set_state(struct comp_dev *dev, int cmd)
break;
case COMP_TRIGGER_PAUSE:
/* only support pausing for running */
if (dev->state == COMP_STATE_ACTIVE)
if (dev->state == COMP_STATE_ACTIVE) {
dev->state = COMP_STATE_PAUSED;
else {
} else {
trace_comp_error("comp_set_state() error: "
"wrong state = %u, "
"COMP_TRIGGER_PAUSE", dev->state);
Expand All @@ -168,7 +168,7 @@ int comp_set_state(struct comp_dev *dev, int cmd)
case COMP_TRIGGER_RESET:
/* reset always succeeds */
if (dev->state == COMP_STATE_ACTIVE ||
dev->state == COMP_STATE_PAUSED) {
dev->state == COMP_STATE_PAUSED) {
trace_comp_error("comp_set_state() error: "
"wrong state = %u, "
"COMP_TRIGGER_RESET", dev->state);
Expand All @@ -178,7 +178,7 @@ int comp_set_state(struct comp_dev *dev, int cmd)
break;
case COMP_TRIGGER_PREPARE:
if (dev->state == COMP_STATE_PREPARE ||
dev->state == COMP_STATE_READY) {
dev->state == COMP_STATE_READY) {
dev->state = COMP_STATE_PREPARE;
} else {
trace_comp_error("comp_set_state() error: "
Expand Down
36 changes: 19 additions & 17 deletions src/audio/dai.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2016, Intel Corporation
* All rights reserved.
*
Expand Down Expand Up @@ -204,22 +204,22 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)

dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_dai));
if (dev == NULL)
if (!dev)
return NULL;

dai = (struct sof_ipc_comp_dai *)&dev->comp;
memcpy(dai, ipc_dai, sizeof(struct sof_ipc_comp_dai));

dd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*dd));
if (dd == NULL) {
if (!dd) {
rfree(dev);
return NULL;
}

comp_set_drvdata(dev, dd);

dd->dai = dai_get(dai->type, dai->dai_index, DAI_CREAT);
if (dd->dai == NULL) {
if (!dd->dai) {
trace_dai_error("dai_new() error: dai_get() failed to create "
"DAI.");
goto error;
Expand All @@ -245,7 +245,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
break;
}
dd->dma = dma_get(dir, caps, dma_dev, DMA_ACCESS_SHARED);
if (dd->dma == NULL) {
if (!dd->dma) {
trace_dai_error("dai_new() error: dma_get() failed to get "
"shared access to DMA.");
goto error;
Expand Down Expand Up @@ -442,13 +442,14 @@ static int dai_params(struct comp_dev *dev)
dma_buffer->r_ptr = dma_buffer->addr;

return dai_playback_params(dev);
} else {
dma_buffer = list_first_item(&dev->bsink_list,
struct comp_buffer, source_list);
dma_buffer->w_ptr = dma_buffer->addr;

return dai_capture_params(dev);
}

dma_buffer = list_first_item(&dev->bsink_list,
struct comp_buffer, source_list);
dma_buffer->w_ptr = dma_buffer->addr;

return dai_capture_params(dev);

}

static int dai_prepare(struct comp_dev *dev)
Expand Down Expand Up @@ -550,7 +551,8 @@ static void dai_pointer_init(struct comp_dev *dev)
break;
default:
/* advance source pipeline w_ptr by one period
* this places pipeline w_ptr in period before DAI r_ptr */
* this places pipeline w_ptr in period before DAI r_ptr
*/
comp_update_buffer_produce(dma_buffer, dd->period_bytes);
break;
}
Expand All @@ -573,12 +575,12 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd)
switch (cmd) {
case COMP_TRIGGER_START:
trace_dai_with_ids(dev, "dai_comp_trigger(), START");
if (!dd->pointer_init)
if (!dd->pointer_init) {
dai_pointer_init(dev);
/* for nono-first init start, we need to recover the buffer
* state as well pointer position as pause/relesas did
*/
else {
/* for nono-first init start, we need to recover the buffer
* state as well pointer position as pause/release did
*/
} else {
/* set valid buffer pointer */
dai_buffer_process(dev);

Expand Down
4 changes: 2 additions & 2 deletions src/audio/fir.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void eq_fir_s32(struct fir_state_32x16 *fir, struct comp_buffer *source,
/* The next functions are inlined to optmize execution speed */

static inline void fir_part_32x16(int64_t *y, int taps, const int16_t c[],
int *ic, int32_t d[], int *id)
int *ic, int32_t d[], int *id)
{
int n;

Expand Down Expand Up @@ -107,7 +107,7 @@ static inline int32_t fir_32x16(struct fir_state_32x16 *fir, int32_t x)
* is >= 0 after FIR computation.
*/
fir_part_32x16(&y, fir->length, fir->coef, &i, fir->delay,
&tmp_ri);
&tmp_ri);
} else {
n2 = fir->length - n1;
/* Part 1, loop n1 times, fir_ri becomes -1 */
Expand Down
15 changes: 8 additions & 7 deletions src/audio/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ static void host_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
next->dest = local_elem->dest;
next->size = local_elem->size;
return;
} else
next->size = DMA_RELOAD_END;
}

next->size = DMA_RELOAD_END;

/* let any waiters know we have completed */
wait_completed(&hd->complete);
Expand Down Expand Up @@ -348,14 +349,14 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)

dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_host));
if (dev == NULL)
if (!dev)
return NULL;

host = (struct sof_ipc_comp_host *)&dev->comp;
memcpy(host, ipc_host, sizeof(struct sof_ipc_comp_host));

hd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*hd));
if (hd == NULL) {
if (!hd) {
rfree(dev);
return NULL;
}
Expand All @@ -371,7 +372,8 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)
caps = 0;
dma_dev = DMA_DEV_HOST;
hd->dma = dma_get(dir, caps, dma_dev, DMA_ACCESS_SHARED);
if (hd->dma == NULL) {

if (!hd->dma) {
trace_host_error("host_new() error: dma_get() returned NULL");
goto error;
}
Expand Down Expand Up @@ -600,7 +602,7 @@ static int host_stop(struct comp_dev *dev)
}

static int host_position(struct comp_dev *dev,
struct sof_ipc_stream_posn *posn)
struct sof_ipc_stream_posn *posn)
{
struct host_data *hd = comp_get_drvdata(dev);

Expand Down Expand Up @@ -687,7 +689,6 @@ static int host_copy_int(struct comp_dev *dev, bool preload_run)
return 0;
}
} else {

if (hd->dma_buffer->avail < local_elem->size) {
/* buffer is enough empty, just return. */
tracev_host("host_copy_int(), buffer is enough empty");
Expand Down
Loading