mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-26 07:44:27 +08:00
Merge series "ASoC: soc-dapm: cleanup cppcheck warning" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer discussion. Thus I want to post more easy patch first, and reduce my local patches. These are cppcheck warning cleanup patches for soc-dapm. Kuninori Morimoto (12): ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup() ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux() ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status() ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga() ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link() ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event() ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run() ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route() ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes() ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes() ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls() ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event() sound/soc/soc-dapm.c | 65 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 32 deletions(-) -- 2.25.1
This commit is contained in:
commit
7002ab4192
@ -650,12 +650,11 @@ static struct snd_soc_dapm_widget *
|
|||||||
dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, const char *name)
|
dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, const char *name)
|
||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *w = wcache->widget;
|
struct snd_soc_dapm_widget *w = wcache->widget;
|
||||||
struct list_head *wlist;
|
|
||||||
const int depth = 2;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if (w) {
|
if (w) {
|
||||||
wlist = &w->dapm->card->widgets;
|
struct list_head *wlist = &w->dapm->card->widgets;
|
||||||
|
const int depth = 2;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
list_for_each_entry_from(w, wlist, list) {
|
list_for_each_entry_from(w, wlist, list) {
|
||||||
if (!strcmp(name, w->name))
|
if (!strcmp(name, w->name))
|
||||||
@ -748,10 +747,11 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
|
|||||||
{
|
{
|
||||||
const struct snd_kcontrol_new *kcontrol = &w->kcontrol_news[0];
|
const struct snd_kcontrol_new *kcontrol = &w->kcontrol_news[0];
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
unsigned int val, item;
|
unsigned int item;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (e->reg != SND_SOC_NOPM) {
|
if (e->reg != SND_SOC_NOPM) {
|
||||||
|
unsigned int val;
|
||||||
val = soc_dapm_read(dapm, e->reg);
|
val = soc_dapm_read(dapm, e->reg);
|
||||||
val = (val >> e->shift_l) & e->mask;
|
val = (val >> e->shift_l) & e->mask;
|
||||||
item = snd_soc_enum_val_to_item(e, val);
|
item = snd_soc_enum_val_to_item(e, val);
|
||||||
@ -782,14 +782,14 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_path *p, int i,
|
|||||||
struct soc_mixer_control *mc = (struct soc_mixer_control *)
|
struct soc_mixer_control *mc = (struct soc_mixer_control *)
|
||||||
p->sink->kcontrol_news[i].private_value;
|
p->sink->kcontrol_news[i].private_value;
|
||||||
unsigned int reg = mc->reg;
|
unsigned int reg = mc->reg;
|
||||||
unsigned int shift = mc->shift;
|
|
||||||
unsigned int max = mc->max;
|
|
||||||
unsigned int mask = (1 << fls(max)) - 1;
|
|
||||||
unsigned int invert = mc->invert;
|
unsigned int invert = mc->invert;
|
||||||
unsigned int val;
|
|
||||||
|
|
||||||
if (reg != SND_SOC_NOPM) {
|
if (reg != SND_SOC_NOPM) {
|
||||||
val = soc_dapm_read(p->sink->dapm, reg);
|
unsigned int shift = mc->shift;
|
||||||
|
unsigned int max = mc->max;
|
||||||
|
unsigned int mask = (1 << fls(max)) - 1;
|
||||||
|
unsigned int val = soc_dapm_read(p->sink->dapm, reg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The nth_path argument allows this function to know
|
* The nth_path argument allows this function to know
|
||||||
* which path of a kcontrol it is setting the initial
|
* which path of a kcontrol it is setting the initial
|
||||||
@ -1060,10 +1060,10 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
|
|||||||
/* create new dapm volume control */
|
/* create new dapm volume control */
|
||||||
static int dapm_new_pga(struct snd_soc_dapm_widget *w)
|
static int dapm_new_pga(struct snd_soc_dapm_widget *w)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < w->num_kcontrols; i++) {
|
for (i = 0; i < w->num_kcontrols; i++) {
|
||||||
ret = dapm_create_or_share_kcontrol(w, i);
|
int ret = dapm_create_or_share_kcontrol(w, i);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1074,10 +1074,7 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
|
|||||||
/* create new dapm dai link control */
|
/* create new dapm dai link control */
|
||||||
static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
|
static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i;
|
||||||
struct snd_kcontrol *kcontrol;
|
|
||||||
struct snd_soc_dapm_context *dapm = w->dapm;
|
|
||||||
struct snd_card *card = dapm->card->snd_card;
|
|
||||||
struct snd_soc_pcm_runtime *rtd = w->priv;
|
struct snd_soc_pcm_runtime *rtd = w->priv;
|
||||||
|
|
||||||
/* create control for links with > 1 config */
|
/* create control for links with > 1 config */
|
||||||
@ -1086,9 +1083,12 @@ static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
|
|||||||
|
|
||||||
/* add kcontrol */
|
/* add kcontrol */
|
||||||
for (i = 0; i < w->num_kcontrols; i++) {
|
for (i = 0; i < w->num_kcontrols; i++) {
|
||||||
kcontrol = snd_soc_cnew(&w->kcontrol_news[i], w,
|
struct snd_soc_dapm_context *dapm = w->dapm;
|
||||||
w->name, NULL);
|
struct snd_card *card = dapm->card->snd_card;
|
||||||
ret = snd_ctl_add(card, kcontrol);
|
struct snd_kcontrol *kcontrol = snd_soc_cnew(&w->kcontrol_news[i],
|
||||||
|
w, w->name, NULL);
|
||||||
|
int ret = snd_ctl_add(card, kcontrol);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dapm->dev,
|
dev_err(dapm->dev,
|
||||||
"ASoC: failed to add widget %s dapm kcontrol %s: %d\n",
|
"ASoC: failed to add widget %s dapm kcontrol %s: %d\n",
|
||||||
@ -1528,7 +1528,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
|
|||||||
struct snd_soc_dapm_widget *w, int event)
|
struct snd_soc_dapm_widget *w, int event)
|
||||||
{
|
{
|
||||||
const char *ev_name;
|
const char *ev_name;
|
||||||
int power, ret;
|
int power;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SND_SOC_DAPM_PRE_PMU:
|
case SND_SOC_DAPM_PRE_PMU:
|
||||||
@ -1564,6 +1564,8 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (w->event && (w->event_flags & event)) {
|
if (w->event && (w->event_flags & event)) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
pop_dbg(w->dapm->dev, card->pop_time, "pop test : %s %s\n",
|
pop_dbg(w->dapm->dev, card->pop_time, "pop test : %s %s\n",
|
||||||
w->name, ev_name);
|
w->name, ev_name);
|
||||||
soc_dapm_async_complete(w->dapm);
|
soc_dapm_async_complete(w->dapm);
|
||||||
@ -1645,7 +1647,7 @@ static void dapm_seq_run(struct snd_soc_card *card,
|
|||||||
int cur_subseq = -1;
|
int cur_subseq = -1;
|
||||||
int cur_reg = SND_SOC_NOPM;
|
int cur_reg = SND_SOC_NOPM;
|
||||||
struct snd_soc_dapm_context *cur_dapm = NULL;
|
struct snd_soc_dapm_context *cur_dapm = NULL;
|
||||||
int ret, i;
|
int i;
|
||||||
int *sort;
|
int *sort;
|
||||||
|
|
||||||
if (power_up)
|
if (power_up)
|
||||||
@ -1654,7 +1656,7 @@ static void dapm_seq_run(struct snd_soc_card *card,
|
|||||||
sort = dapm_down_seq;
|
sort = dapm_down_seq;
|
||||||
|
|
||||||
list_for_each_entry_safe(w, n, list, power_list) {
|
list_for_each_entry_safe(w, n, list, power_list) {
|
||||||
ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Do we need to apply any queued changes? */
|
/* Do we need to apply any queued changes? */
|
||||||
if (sort[w->id] != cur_sort || w->reg != cur_reg ||
|
if (sort[w->id] != cur_sort || w->reg != cur_reg ||
|
||||||
@ -3004,7 +3006,6 @@ err:
|
|||||||
static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
|
static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
|
||||||
const struct snd_soc_dapm_route *route)
|
const struct snd_soc_dapm_route *route)
|
||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *wsource, *wsink;
|
|
||||||
struct snd_soc_dapm_path *path, *p;
|
struct snd_soc_dapm_path *path, *p;
|
||||||
const char *sink;
|
const char *sink;
|
||||||
const char *source;
|
const char *source;
|
||||||
@ -3042,8 +3043,8 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
wsource = path->source;
|
struct snd_soc_dapm_widget *wsource = path->source;
|
||||||
wsink = path->sink;
|
struct snd_soc_dapm_widget *wsink = path->sink;
|
||||||
|
|
||||||
dapm_mark_dirty(wsource, "Route removed");
|
dapm_mark_dirty(wsource, "Route removed");
|
||||||
dapm_mark_dirty(wsink, "Route removed");
|
dapm_mark_dirty(wsink, "Route removed");
|
||||||
@ -3079,11 +3080,11 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
|
|||||||
int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
|
int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
|
||||||
const struct snd_soc_dapm_route *route, int num)
|
const struct snd_soc_dapm_route *route, int num)
|
||||||
{
|
{
|
||||||
int i, r, ret = 0;
|
int i, ret = 0;
|
||||||
|
|
||||||
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
|
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
r = snd_soc_dapm_add_route(dapm, route);
|
int r = snd_soc_dapm_add_route(dapm, route);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
|
dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
|
||||||
route->source,
|
route->source,
|
||||||
@ -3187,12 +3188,12 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
|
|||||||
int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
|
int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
|
||||||
const struct snd_soc_dapm_route *route, int num)
|
const struct snd_soc_dapm_route *route, int num)
|
||||||
{
|
{
|
||||||
int i, err;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
|
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
err = snd_soc_dapm_weak_route(dapm, route);
|
int err = snd_soc_dapm_weak_route(dapm, route);
|
||||||
if (err)
|
if (err)
|
||||||
ret = err;
|
ret = err;
|
||||||
route++;
|
route++;
|
||||||
@ -3783,13 +3784,12 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
|
|||||||
const struct snd_soc_dapm_widget *widget,
|
const struct snd_soc_dapm_widget *widget,
|
||||||
int num)
|
int num)
|
||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *w;
|
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
|
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
w = snd_soc_dapm_new_control_unlocked(dapm, widget);
|
struct snd_soc_dapm_widget *w = snd_soc_dapm_new_control_unlocked(dapm, widget);
|
||||||
if (IS_ERR(w)) {
|
if (IS_ERR(w)) {
|
||||||
ret = PTR_ERR(w);
|
ret = PTR_ERR(w);
|
||||||
break;
|
break;
|
||||||
@ -4365,11 +4365,12 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
|
|||||||
int event)
|
int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *w;
|
struct snd_soc_dapm_widget *w;
|
||||||
unsigned int ep;
|
|
||||||
|
|
||||||
w = snd_soc_dai_get_widget(dai, stream);
|
w = snd_soc_dai_get_widget(dai, stream);
|
||||||
|
|
||||||
if (w) {
|
if (w) {
|
||||||
|
unsigned int ep;
|
||||||
|
|
||||||
dapm_mark_dirty(w, "stream event");
|
dapm_mark_dirty(w, "stream event");
|
||||||
|
|
||||||
if (w->id == snd_soc_dapm_dai_in) {
|
if (w->id == snd_soc_dapm_dai_in) {
|
||||||
|
Loading…
Reference in New Issue
Block a user