diff mbox series

[v3] usb: gadget: f_uac1: Change volume name and remove alt names

Message ID 20240804002912.3293177-2-crwulff@gmail.com
State New
Headers show
Series [v3] usb: gadget: f_uac1: Change volume name and remove alt names | expand

Commit Message

Chris Wulff Aug. 4, 2024, 12:29 a.m. UTC
From: Chris Wulff <crwulff@gmail.com>

This changes the UAPI to align with disussion of alt settings work.

fu_name is renamed to fu_vol_name, and alt settings mode names
are removed for now in favor of future work where they will be
settable in subdirectories for each alt mode.

discussion thread for api changes for alt mode settings:
https://lore.kernel.org/linux-usb/35be4668-58d3-894a-72cf-de1afaacae45@ivitera.com/T/

Signed-off-by: Chris Wulff <crwulff@gmail.com>
---
v3: Corrected semantics of c_/p_ strings to match other c_/p_ settings.
v2: Moved discussion thread tidbit into commit message
https://lore.kernel.org/all/20240803232722.3220995-2-crwulff@gmail.com/
v1: https://lore.kernel.org/all/20240803155215.2746444-2-crwulff@gmail.com/
---
 .../ABI/testing/configfs-usb-gadget-uac1      |  8 +--
 Documentation/usb/gadget-testing.rst          |  8 +--
 drivers/usb/gadget/function/f_uac1.c          | 64 ++++++++-----------
 drivers/usb/gadget/function/u_uac1.h          |  8 +--
 4 files changed, 32 insertions(+), 56 deletions(-)

Comments

gregkh@linuxfoundation.org Aug. 13, 2024, 8:34 a.m. UTC | #1
On Sat, Aug 03, 2024 at 08:29:13PM -0400, crwulff@gmail.com wrote:
> From: Chris Wulff <crwulff@gmail.com>
> 
> This changes the UAPI to align with disussion of alt settings work.
> 
> fu_name is renamed to fu_vol_name, and alt settings mode names
> are removed for now in favor of future work where they will be
> settable in subdirectories for each alt mode.
> 
> discussion thread for api changes for alt mode settings:
> https://lore.kernel.org/linux-usb/35be4668-58d3-894a-72cf-de1afaacae45@ivitera.com/T/

What is now going to break due to this change?  What userspace tools use
the old names that need to be changed?

Are you _SURE_ that you can rename external files like this and
everything will keep on working?

thanks,

greg k-h
Chris Wulff Aug. 13, 2024, 12:56 p.m. UTC | #2
On Tue, Aug 13, 2024 at 4:34 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Sat, Aug 03, 2024 at 08:29:13PM -0400, crwulff@gmail.com wrote:
> > From: Chris Wulff <crwulff@gmail.com>
> >
> > This changes the UAPI to align with disussion of alt settings work.
> >
> > fu_name is renamed to fu_vol_name, and alt settings mode names
> > are removed for now in favor of future work where they will be
> > settable in subdirectories for each alt mode.
> >
> > discussion thread for api changes for alt mode settings:
> > https://lore.kernel.org/linux-usb/35be4668-58d3-894a-72cf-de1afaacae45@ivitera.com/T/
>
> What is now going to break due to this change?  What userspace tools use
> the old names that need to be changed?
>
> Are you _SURE_ that you can rename external files like this and
> everything will keep on working?

Nothing is using them, since they were just introduced. I wanted to get
the API changed before they make it to mainline and somebody starts
using them.

You just applied the patch that introduced them into usb-next on 7/31/2024,
just after v6.11-rc1 so they haven't yet made it to the mainline kernel.

This is the patch that introduces them:

https://lore.kernel.org/all/CO1PR17MB541911B0C80D21E4B575E48CE1112@CO1PR17MB5419.namprd17.prod.outlook.com/

>
> thanks,
>
> greg k-h
gregkh@linuxfoundation.org Aug. 13, 2024, 4:12 p.m. UTC | #3
On Tue, Aug 13, 2024 at 08:56:26AM -0400, Chris Wulff wrote:
> On Tue, Aug 13, 2024 at 4:34 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Sat, Aug 03, 2024 at 08:29:13PM -0400, crwulff@gmail.com wrote:
> > > From: Chris Wulff <crwulff@gmail.com>
> > >
> > > This changes the UAPI to align with disussion of alt settings work.
> > >
> > > fu_name is renamed to fu_vol_name, and alt settings mode names
> > > are removed for now in favor of future work where they will be
> > > settable in subdirectories for each alt mode.
> > >
> > > discussion thread for api changes for alt mode settings:
> > > https://lore.kernel.org/linux-usb/35be4668-58d3-894a-72cf-de1afaacae45@ivitera.com/T/
> >
> > What is now going to break due to this change?  What userspace tools use
> > the old names that need to be changed?
> >
> > Are you _SURE_ that you can rename external files like this and
> > everything will keep on working?
> 
> Nothing is using them, since they were just introduced. I wanted to get
> the API changed before they make it to mainline and somebody starts
> using them.
> 
> You just applied the patch that introduced them into usb-next on 7/31/2024,
> just after v6.11-rc1 so they haven't yet made it to the mainline kernel.
> 
> This is the patch that introduces them:
> 
> https://lore.kernel.org/all/CO1PR17MB541911B0C80D21E4B575E48CE1112@CO1PR17MB5419.namprd17.prod.outlook.com/

Ah, thanks, I totally forgot that.  Remember, I deal with about 1000+
patches a week...

thanks,

greg k-h
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac1 b/Documentation/ABI/testing/configfs-usb-gadget-uac1
index cf93b98b274d..64188a85592b 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-uac1
+++ b/Documentation/ABI/testing/configfs-usb-gadget-uac1
@@ -33,13 +33,9 @@  Description:
 		p_it_name		playback input terminal name
 		p_it_ch_name		playback channels name
 		p_ot_name		playback output terminal name
-		p_fu_name		playback functional unit name
-		p_alt0_name		playback alt mode 0 name
-		p_alt1_name		playback alt mode 1 name
+		p_fu_vol_name		playback mute/volume functional unit name
 		c_it_name		capture input terminal name
 		c_it_ch_name		capture channels name
 		c_ot_name		capture output terminal name
-		c_fu_name		capture functional unit name
-		c_alt0_name		capture alt mode 0 name
-		c_alt1_name		capture alt mode 1 name
+		c_fu_vol_name		capture mute/volume functional unit name
 		=====================	=======================================
diff --git a/Documentation/usb/gadget-testing.rst b/Documentation/usb/gadget-testing.rst
index a89b49e639c3..7a94490fb2fd 100644
--- a/Documentation/usb/gadget-testing.rst
+++ b/Documentation/usb/gadget-testing.rst
@@ -960,15 +960,11 @@  The uac1 function provides these attributes in its function directory:
 	p_it_name        playback input terminal name
 	p_it_ch_name     playback channels name
 	p_ot_name        playback output terminal name
-	p_fu_name        playback functional unit name
-	p_alt0_name      playback alt mode 0 name
-	p_alt1_name      playback alt mode 1 name
+	p_fu_vol_name    playback mute/volume functional unit name
 	c_it_name        capture input terminal name
 	c_it_ch_name     capture channels name
 	c_ot_name        capture output terminal name
-	c_fu_name        capture functional unit name
-	c_alt0_name      capture alt mode 0 name
-	c_alt1_name      capture alt mode 1 name
+	c_fu_vol_name    capture mute/volume functional unit name
 	================ ====================================================
 
 The attributes have sane default values.
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 06a220fb7a87..c87e74afc881 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -1251,19 +1251,19 @@  static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
 
 	strings_uac1[STR_AC_IF].s = audio_opts->function_name;
 
-	strings_uac1[STR_USB_OUT_IT].s = audio_opts->p_it_name;
-	strings_uac1[STR_USB_OUT_IT_CH_NAMES].s = audio_opts->p_it_ch_name;
-	strings_uac1[STR_IO_OUT_OT].s = audio_opts->p_ot_name;
-	strings_uac1[STR_FU_OUT].s = audio_opts->p_fu_name;
-	strings_uac1[STR_AS_OUT_IF_ALT0].s = audio_opts->p_alt0_name;
-	strings_uac1[STR_AS_OUT_IF_ALT1].s = audio_opts->p_alt1_name;
-
-	strings_uac1[STR_IO_IN_IT].s = audio_opts->c_it_name;
-	strings_uac1[STR_IO_IN_IT_CH_NAMES].s = audio_opts->c_it_ch_name;
-	strings_uac1[STR_USB_IN_OT].s = audio_opts->c_ot_name;
-	strings_uac1[STR_FU_IN].s = audio_opts->c_fu_name;
-	strings_uac1[STR_AS_IN_IF_ALT0].s = audio_opts->c_alt0_name;
-	strings_uac1[STR_AS_IN_IF_ALT1].s = audio_opts->c_alt1_name;
+	strings_uac1[STR_USB_OUT_IT].s = audio_opts->c_it_name;
+	strings_uac1[STR_USB_OUT_IT_CH_NAMES].s = audio_opts->c_it_ch_name;
+	strings_uac1[STR_IO_OUT_OT].s = audio_opts->c_ot_name;
+	strings_uac1[STR_FU_OUT].s = audio_opts->c_fu_vol_name;
+	strings_uac1[STR_AS_OUT_IF_ALT0].s = "Playback Inactive";
+	strings_uac1[STR_AS_OUT_IF_ALT1].s = "Playback Active";
+
+	strings_uac1[STR_IO_IN_IT].s = audio_opts->p_it_name;
+	strings_uac1[STR_IO_IN_IT_CH_NAMES].s = audio_opts->p_it_ch_name;
+	strings_uac1[STR_USB_IN_OT].s = audio_opts->p_ot_name;
+	strings_uac1[STR_FU_IN].s = audio_opts->p_fu_vol_name;
+	strings_uac1[STR_AS_IN_IF_ALT0].s = "Capture Inactive";
+	strings_uac1[STR_AS_IN_IF_ALT1].s = "Capture Active";
 
 	us = usb_gstrings_attach(cdev, uac1_strings, ARRAY_SIZE(strings_uac1));
 	if (IS_ERR(us))
@@ -1687,16 +1687,12 @@  UAC1_ATTRIBUTE_STRING(function_name);
 UAC1_ATTRIBUTE_STRING(p_it_name);
 UAC1_ATTRIBUTE_STRING(p_it_ch_name);
 UAC1_ATTRIBUTE_STRING(p_ot_name);
-UAC1_ATTRIBUTE_STRING(p_fu_name);
-UAC1_ATTRIBUTE_STRING(p_alt0_name);
-UAC1_ATTRIBUTE_STRING(p_alt1_name);
+UAC1_ATTRIBUTE_STRING(p_fu_vol_name);
 
 UAC1_ATTRIBUTE_STRING(c_it_name);
 UAC1_ATTRIBUTE_STRING(c_it_ch_name);
 UAC1_ATTRIBUTE_STRING(c_ot_name);
-UAC1_ATTRIBUTE_STRING(c_fu_name);
-UAC1_ATTRIBUTE_STRING(c_alt0_name);
-UAC1_ATTRIBUTE_STRING(c_alt1_name);
+UAC1_ATTRIBUTE_STRING(c_fu_vol_name);
 
 static struct configfs_attribute *f_uac1_attrs[] = {
 	&f_uac1_opts_attr_c_chmask,
@@ -1724,16 +1720,12 @@  static struct configfs_attribute *f_uac1_attrs[] = {
 	&f_uac1_opts_attr_p_it_name,
 	&f_uac1_opts_attr_p_it_ch_name,
 	&f_uac1_opts_attr_p_ot_name,
-	&f_uac1_opts_attr_p_fu_name,
-	&f_uac1_opts_attr_p_alt0_name,
-	&f_uac1_opts_attr_p_alt1_name,
+	&f_uac1_opts_attr_p_fu_vol_name,
 
 	&f_uac1_opts_attr_c_it_name,
 	&f_uac1_opts_attr_c_it_ch_name,
 	&f_uac1_opts_attr_c_ot_name,
-	&f_uac1_opts_attr_c_fu_name,
-	&f_uac1_opts_attr_c_alt0_name,
-	&f_uac1_opts_attr_c_alt1_name,
+	&f_uac1_opts_attr_c_fu_vol_name,
 
 	NULL,
 };
@@ -1789,19 +1781,15 @@  static struct usb_function_instance *f_audio_alloc_inst(void)
 
 	scnprintf(opts->function_name, sizeof(opts->function_name), "AC Interface");
 
-	scnprintf(opts->p_it_name, sizeof(opts->p_it_name), "Playback Input terminal");
-	scnprintf(opts->p_it_ch_name, sizeof(opts->p_it_ch_name), "Playback Channels");
-	scnprintf(opts->p_ot_name, sizeof(opts->p_ot_name), "Playback Output terminal");
-	scnprintf(opts->p_fu_name, sizeof(opts->p_fu_name), "Playback Volume");
-	scnprintf(opts->p_alt0_name, sizeof(opts->p_alt0_name), "Playback Inactive");
-	scnprintf(opts->p_alt1_name, sizeof(opts->p_alt1_name), "Playback Active");
-
-	scnprintf(opts->c_it_name, sizeof(opts->c_it_name), "Capture Input terminal");
-	scnprintf(opts->c_it_ch_name, sizeof(opts->c_it_ch_name), "Capture Channels");
-	scnprintf(opts->c_ot_name, sizeof(opts->c_ot_name), "Capture Output terminal");
-	scnprintf(opts->c_fu_name, sizeof(opts->c_fu_name), "Capture Volume");
-	scnprintf(opts->c_alt0_name, sizeof(opts->c_alt0_name), "Capture Inactive");
-	scnprintf(opts->c_alt1_name, sizeof(opts->c_alt1_name), "Capture Active");
+	scnprintf(opts->p_it_name, sizeof(opts->p_it_name), "Capture Input terminal");
+	scnprintf(opts->p_it_ch_name, sizeof(opts->p_it_ch_name), "Capture Channels");
+	scnprintf(opts->p_ot_name, sizeof(opts->p_ot_name), "Capture Output terminal");
+	scnprintf(opts->p_fu_vol_name, sizeof(opts->p_fu_vol_name), "Capture Volume");
+
+	scnprintf(opts->c_it_name, sizeof(opts->c_it_name), "Playback Input terminal");
+	scnprintf(opts->c_it_ch_name, sizeof(opts->c_it_ch_name), "Playback Channels");
+	scnprintf(opts->c_ot_name, sizeof(opts->c_ot_name), "Playback Output terminal");
+	scnprintf(opts->c_fu_vol_name, sizeof(opts->c_fu_vol_name), "Playback Volume");
 
 	return &opts->func_inst;
 }
diff --git a/drivers/usb/gadget/function/u_uac1.h b/drivers/usb/gadget/function/u_uac1.h
index 67784de9782b..feb6eb76462f 100644
--- a/drivers/usb/gadget/function/u_uac1.h
+++ b/drivers/usb/gadget/function/u_uac1.h
@@ -57,16 +57,12 @@  struct f_uac1_opts {
 	char			p_it_name[USB_MAX_STRING_LEN];
 	char			p_it_ch_name[USB_MAX_STRING_LEN];
 	char			p_ot_name[USB_MAX_STRING_LEN];
-	char			p_fu_name[USB_MAX_STRING_LEN];
-	char			p_alt0_name[USB_MAX_STRING_LEN];
-	char			p_alt1_name[USB_MAX_STRING_LEN];
+	char			p_fu_vol_name[USB_MAX_STRING_LEN];
 
 	char			c_it_name[USB_MAX_STRING_LEN];
 	char			c_it_ch_name[USB_MAX_STRING_LEN];
 	char			c_ot_name[USB_MAX_STRING_LEN];
-	char			c_fu_name[USB_MAX_STRING_LEN];
-	char			c_alt0_name[USB_MAX_STRING_LEN];
-	char			c_alt1_name[USB_MAX_STRING_LEN];
+	char			c_fu_vol_name[USB_MAX_STRING_LEN];
 
 	struct mutex			lock;
 	int				refcnt;