[PATCH v2] usb: gadget: u_audio: Use C99 syntax for array initializers

Abhishek Tamboli posted 1 patch 3 months ago
drivers/usb/gadget/function/u_audio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
[PATCH v2] usb: gadget: u_audio: Use C99 syntax for array initializers
Posted by Abhishek Tamboli 3 months ago
Convert array initializers to C99 syntax by adding the '=' after
each designated initializer.

Fix the following smatch warnings:

drivers/usb/gadget/function/u_audio.c:1117:20:
warning: obsolete array initializer, use C99 syntax
drivers/usb/gadget/function/u_audio.c:1124:28:
warning: obsolete array initializer, use C99 syntax
drivers/usb/gadget/function/u_audio.c:1131:19:
warning: obsolete array initializer, use C99 syntax
drivers/usb/gadget/function/u_audio.c:1138:27:
warning: obsolete array initializer, use C99 syntax
drivers/usb/gadget/function/u_audio.c:1145:25:
warning: obsolete array initializer, use C99 syntax

Also, fix two checkpatch.pl warnings:

WARNING: please, no spaces at the start of a line
+  [UAC_FBACK_CTRL] = {$

WARNING: please, no spaces at the start of a line
+  [UAC_MUTE_CTRL] = {$

Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com>
---
Changes in v2:
- Wrapped commit log to 75 columns
- Fix checkpatch.pl warnings

 drivers/usb/gadget/function/u_audio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
index 89af0feb7512..0b3b8adf00c0 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -1114,35 +1114,35 @@ static int u_audio_rate_get(struct snd_kcontrol *kcontrol,
 }

 static struct snd_kcontrol_new u_audio_controls[]  = {
-  [UAC_FBACK_CTRL] {
+	[UAC_FBACK_CTRL] = {
     .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
     .name =         "Capture Pitch 1000000",
     .info =         u_audio_pitch_info,
     .get =          u_audio_pitch_get,
     .put =          u_audio_pitch_put,
   },
-	[UAC_P_PITCH_CTRL] {
+	[UAC_P_PITCH_CTRL] = {
 		.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
 		.name =         "Playback Pitch 1000000",
 		.info =         u_audio_pitch_info,
 		.get =          u_audio_pitch_get,
 		.put =          u_audio_pitch_put,
 	},
-  [UAC_MUTE_CTRL] {
+	[UAC_MUTE_CTRL] = {
 		.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
 		.name =		"", /* will be filled later */
 		.info =		u_audio_mute_info,
 		.get =		u_audio_mute_get,
 		.put =		u_audio_mute_put,
 	},
-	[UAC_VOLUME_CTRL] {
+	[UAC_VOLUME_CTRL] = {
 		.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
 		.name =		"", /* will be filled later */
 		.info =		u_audio_volume_info,
 		.get =		u_audio_volume_get,
 		.put =		u_audio_volume_put,
 	},
-	[UAC_RATE_CTRL] {
+	[UAC_RATE_CTRL] = {
 		.iface =	SNDRV_CTL_ELEM_IFACE_PCM,
 		.name =		"", /* will be filled later */
 		.access =	SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
--
2.34.1
Re: [PATCH v2] usb: gadget: u_audio: Use C99 syntax for array initializers
Posted by Ricardo B. Marliere 3 months ago
On  2 Aug 24 00:32, Abhishek Tamboli wrote:
> Convert array initializers to C99 syntax by adding the '=' after
> each designated initializer.
> 
> Fix the following smatch warnings:
> 
> drivers/usb/gadget/function/u_audio.c:1117:20:
> warning: obsolete array initializer, use C99 syntax
> drivers/usb/gadget/function/u_audio.c:1124:28:
> warning: obsolete array initializer, use C99 syntax
> drivers/usb/gadget/function/u_audio.c:1131:19:
> warning: obsolete array initializer, use C99 syntax
> drivers/usb/gadget/function/u_audio.c:1138:27:
> warning: obsolete array initializer, use C99 syntax
> drivers/usb/gadget/function/u_audio.c:1145:25:
> warning: obsolete array initializer, use C99 syntax
> 
> Also, fix two checkpatch.pl warnings:
> 
> WARNING: please, no spaces at the start of a line
> +  [UAC_FBACK_CTRL] = {$
> 
> WARNING: please, no spaces at the start of a line
> +  [UAC_MUTE_CTRL] = {$
> 
> Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com>

Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net>

> ---
> Changes in v2:
> - Wrapped commit log to 75 columns
> - Fix checkpatch.pl warnings
> 
>  drivers/usb/gadget/function/u_audio.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
> index 89af0feb7512..0b3b8adf00c0 100644
> --- a/drivers/usb/gadget/function/u_audio.c
> +++ b/drivers/usb/gadget/function/u_audio.c
> @@ -1114,35 +1114,35 @@ static int u_audio_rate_get(struct snd_kcontrol *kcontrol,
>  }
> 
>  static struct snd_kcontrol_new u_audio_controls[]  = {
> -  [UAC_FBACK_CTRL] {
> +	[UAC_FBACK_CTRL] = {
>      .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
>      .name =         "Capture Pitch 1000000",
>      .info =         u_audio_pitch_info,
>      .get =          u_audio_pitch_get,
>      .put =          u_audio_pitch_put,
>    },
> -	[UAC_P_PITCH_CTRL] {
> +	[UAC_P_PITCH_CTRL] = {
>  		.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
>  		.name =         "Playback Pitch 1000000",
>  		.info =         u_audio_pitch_info,
>  		.get =          u_audio_pitch_get,
>  		.put =          u_audio_pitch_put,
>  	},
> -  [UAC_MUTE_CTRL] {
> +	[UAC_MUTE_CTRL] = {
>  		.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
>  		.name =		"", /* will be filled later */
>  		.info =		u_audio_mute_info,
>  		.get =		u_audio_mute_get,
>  		.put =		u_audio_mute_put,
>  	},
> -	[UAC_VOLUME_CTRL] {
> +	[UAC_VOLUME_CTRL] = {
>  		.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
>  		.name =		"", /* will be filled later */
>  		.info =		u_audio_volume_info,
>  		.get =		u_audio_volume_get,
>  		.put =		u_audio_volume_put,
>  	},
> -	[UAC_RATE_CTRL] {
> +	[UAC_RATE_CTRL] = {
>  		.iface =	SNDRV_CTL_ELEM_IFACE_PCM,
>  		.name =		"", /* will be filled later */
>  		.access =	SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
> --
> 2.34.1
> 
>