Commit 50a390ad authored by Coiby Xu's avatar Coiby Xu Committed by Greg Kroah-Hartman

staging: greybus: fix warnings about endianness detected by sparse

This patch fix the following warnings from sparse,

$ make C=2 drivers/staging/greybus/
drivers/staging/greybus/audio_module.c:222:25: warning: incorrect type in assignment (different base types)
drivers/staging/greybus/audio_module.c:222:25:    expected restricted __le16 [usertype] data_cport
drivers/staging/greybus/audio_module.c:222:25:    got unsigned short [usertype] intf_cport_id
drivers/staging/greybus/audio_topology.c:460:40: warning: restricted __le32 degrades to integer
drivers/staging/greybus/audio_topology.c:691:41: warning: incorrect type in assignment (different base types)
drivers/staging/greybus/audio_topology.c:691:41:    expected unsigned int access
drivers/staging/greybus/audio_topology.c:691:41:    got restricted __le32 [usertype] access
drivers/staging/greybus/audio_topology.c:746:44: warning: incorrect type in assignment (different base types)
drivers/staging/greybus/audio_topology.c:746:44:    expected unsigned int
drivers/staging/greybus/audio_topology.c:746:44:    got restricted __le32
drivers/staging/greybus/audio_topology.c:748:52: warning: incorrect type in assignment (different base types)
drivers/staging/greybus/audio_topology.c:748:52:    expected unsigned int
drivers/staging/greybus/audio_topology.c:748:52:    got restricted __le32
drivers/staging/greybus/audio_topology.c:802:42: warning: restricted __le32 degrades to integer
drivers/staging/greybus/audio_topology.c:805:50: warning: incorrect type in assignment (different base types)
drivers/staging/greybus/audio_topology.c:805:50:    expected restricted __le32
drivers/staging/greybus/audio_topology.c:805:50:    got unsigned int
drivers/staging/greybus/audio_topology.c:814:50: warning: restricted __le32 degrades to integer
drivers/staging/greybus/audio_topology.c:817:58: warning: incorrect type in assignment (different base types)
drivers/staging/greybus/audio_topology.c:817:58:    expected restricted __le32
drivers/staging/greybus/audio_topology.c:817:58:    got unsigned int
drivers/staging/greybus/audio_topology.c:889:25: warning: incorrect type in assignment (different base types)
drivers/staging/greybus/audio_topology.c:889:25:    expected unsigned int access
drivers/staging/greybus/audio_topology.c:889:25:    got restricted __le32 [usertype] access
Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarCoiby Xu <coiby.xu@gmail.com>
Link: https://lore.kernel.org/r/20201002233057.74462-1-coiby.xu@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cba90582
...@@ -219,7 +219,7 @@ static int gb_audio_add_data_connection(struct gbaudio_module_info *gbmodule, ...@@ -219,7 +219,7 @@ static int gb_audio_add_data_connection(struct gbaudio_module_info *gbmodule,
greybus_set_drvdata(bundle, gbmodule); greybus_set_drvdata(bundle, gbmodule);
dai->id = 0; dai->id = 0;
dai->data_cport = connection->intf_cport_id; dai->data_cport = cpu_to_le16(connection->intf_cport_id);
dai->connection = connection; dai->connection = connection;
list_add(&dai->list, &gbmodule->data_list); list_add(&dai->list, &gbmodule->data_list);
...@@ -329,7 +329,7 @@ static int gb_audio_probe(struct gb_bundle *bundle, ...@@ -329,7 +329,7 @@ static int gb_audio_probe(struct gb_bundle *bundle,
if (ret) { if (ret) {
dev_err(dev, dev_err(dev,
"%d:Error while enabling %d:data connection\n", "%d:Error while enabling %d:data connection\n",
ret, dai->data_cport); ret, le16_to_cpu(dai->data_cport));
goto disable_data_connection; goto disable_data_connection;
} }
} }
...@@ -451,7 +451,7 @@ static int gb_audio_resume(struct device *dev) ...@@ -451,7 +451,7 @@ static int gb_audio_resume(struct device *dev)
if (ret) { if (ret) {
dev_err(dev, dev_err(dev,
"%d:Error while enabling %d:data connection\n", "%d:Error while enabling %d:data connection\n",
ret, dai->data_cport); ret, le16_to_cpu(dai->data_cport));
return ret; return ret;
} }
} }
......
...@@ -466,7 +466,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, ...@@ -466,7 +466,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
goto exit; goto exit;
/* update ucontrol */ /* update ucontrol */
if (gbvalue.value.integer_value[0] != val) { if (le32_to_cpu(gbvalue.value.integer_value[0]) != val) {
for (wi = 0; wi < wlist->num_widgets; wi++) { for (wi = 0; wi < wlist->num_widgets; wi++) {
widget = wlist->widgets[wi]; widget = wlist->widgets[wi];
snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol,
...@@ -689,7 +689,7 @@ static int gbaudio_tplg_create_kcontrol(struct gbaudio_module_info *gb, ...@@ -689,7 +689,7 @@ static int gbaudio_tplg_create_kcontrol(struct gbaudio_module_info *gb,
return -ENOMEM; return -ENOMEM;
ctldata->ctl_id = ctl->id; ctldata->ctl_id = ctl->id;
ctldata->data_cport = le16_to_cpu(ctl->data_cport); ctldata->data_cport = le16_to_cpu(ctl->data_cport);
ctldata->access = ctl->access; ctldata->access = le32_to_cpu(ctl->access);
ctldata->vcount = ctl->count_values; ctldata->vcount = ctl->count_values;
ctldata->info = &ctl->info; ctldata->info = &ctl->info;
*kctl = (struct snd_kcontrol_new) *kctl = (struct snd_kcontrol_new)
...@@ -744,10 +744,10 @@ static int gbcodec_enum_dapm_ctl_get(struct snd_kcontrol *kcontrol, ...@@ -744,10 +744,10 @@ static int gbcodec_enum_dapm_ctl_get(struct snd_kcontrol *kcontrol,
return ret; return ret;
} }
ucontrol->value.enumerated.item[0] = gbvalue.value.enumerated_item[0]; ucontrol->value.enumerated.item[0] = le32_to_cpu(gbvalue.value.enumerated_item[0]);
if (e->shift_l != e->shift_r) if (e->shift_l != e->shift_r)
ucontrol->value.enumerated.item[1] = ucontrol->value.enumerated.item[1] =
gbvalue.value.enumerated_item[1]; le32_to_cpu(gbvalue.value.enumerated_item[1]);
return 0; return 0;
} }
...@@ -800,11 +800,11 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol, ...@@ -800,11 +800,11 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol,
val = mux << e->shift_l; val = mux << e->shift_l;
mask = e->mask << e->shift_l; mask = e->mask << e->shift_l;
if (gbvalue.value.enumerated_item[0] != if (le32_to_cpu(gbvalue.value.enumerated_item[0]) !=
ucontrol->value.enumerated.item[0]) { ucontrol->value.enumerated.item[0]) {
change = 1; change = 1;
gbvalue.value.enumerated_item[0] = gbvalue.value.enumerated_item[0] =
ucontrol->value.enumerated.item[0]; cpu_to_le32(ucontrol->value.enumerated.item[0]);
} }
if (e->shift_l != e->shift_r) { if (e->shift_l != e->shift_r) {
...@@ -812,11 +812,11 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol, ...@@ -812,11 +812,11 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol,
return -EINVAL; return -EINVAL;
val |= ucontrol->value.enumerated.item[1] << e->shift_r; val |= ucontrol->value.enumerated.item[1] << e->shift_r;
mask |= e->mask << e->shift_r; mask |= e->mask << e->shift_r;
if (gbvalue.value.enumerated_item[1] != if (le32_to_cpu(gbvalue.value.enumerated_item[1]) !=
ucontrol->value.enumerated.item[1]) { ucontrol->value.enumerated.item[1]) {
change = 1; change = 1;
gbvalue.value.enumerated_item[1] = gbvalue.value.enumerated_item[1] =
ucontrol->value.enumerated.item[1]; cpu_to_le32(ucontrol->value.enumerated.item[1]);
} }
} }
...@@ -887,7 +887,7 @@ static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb, ...@@ -887,7 +887,7 @@ static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb,
return -ENOMEM; return -ENOMEM;
ctldata->ctl_id = ctl->id; ctldata->ctl_id = ctl->id;
ctldata->data_cport = le16_to_cpu(ctl->data_cport); ctldata->data_cport = le16_to_cpu(ctl->data_cport);
ctldata->access = ctl->access; ctldata->access = le32_to_cpu(ctl->access);
ctldata->vcount = ctl->count_values; ctldata->vcount = ctl->count_values;
ctldata->info = &ctl->info; ctldata->info = &ctl->info;
*kctl = (struct snd_kcontrol_new) *kctl = (struct snd_kcontrol_new)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment