Re: [PATCH v2 2/2] usb: gadget: f_uac2: Populate SS descriptors' wBytesPerInterval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jack,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on peter.chen-usb/for-usb-next linus/master next-20210909]
[cannot apply to v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jack-Pham/usb-gadget-f_uac2-Fixes-for-SuperSpeed/20210909-162955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-randconfig-a016-20210908 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/f262014b234c389fc10439b7c11aa10ea84270f6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jack-Pham/usb-gadget-f_uac2-Fixes-for-SuperSpeed/20210909-162955
        git checkout f262014b234c389fc10439b7c11aa10ea84270f6
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/usb/gadget/function/f_uac2.c:1181:19: error: member reference type 'struct usb_ss_ep_comp_descriptor' is not a pointer; did you mean to use '.'?
           ss_epin_desc_comp->wBytesPerInterval = ss_epin_desc->wMaxPacketSize;
           ~~~~~~~~~~~~~~~~~^~
                            .
>> drivers/usb/gadget/function/f_uac2.c:1181:53: error: member reference type 'struct usb_endpoint_descriptor' is not a pointer; did you mean to use '.'?
           ss_epin_desc_comp->wBytesPerInterval = ss_epin_desc->wMaxPacketSize;
                                                  ~~~~~~~~~~~~^~
                                                              .
>> drivers/usb/gadget/function/f_uac2.c:1181:39: error: expression is not assignable
           ss_epin_desc_comp->wBytesPerInterval = ss_epin_desc->wMaxPacketSize;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
   drivers/usb/gadget/function/f_uac2.c:1182:20: error: member reference type 'struct usb_ss_ep_comp_descriptor' is not a pointer; did you mean to use '.'?
           ss_epout_desc_comp->wBytesPerInterval = ss_epout_desc->wMaxPacketSize;
           ~~~~~~~~~~~~~~~~~~^~
                             .
   drivers/usb/gadget/function/f_uac2.c:1182:55: error: member reference type 'struct usb_endpoint_descriptor' is not a pointer; did you mean to use '.'?
           ss_epout_desc_comp->wBytesPerInterval = ss_epout_desc->wMaxPacketSize;
                                                   ~~~~~~~~~~~~~^~
                                                                .
   drivers/usb/gadget/function/f_uac2.c:1182:40: error: expression is not assignable
           ss_epout_desc_comp->wBytesPerInterval = ss_epout_desc->wMaxPacketSize;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
   6 errors generated.


vim +1181 drivers/usb/gadget/function/f_uac2.c

   939	
   940	static int
   941	afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
   942	{
   943		struct f_uac2 *uac2 = func_to_uac2(fn);
   944		struct g_audio *agdev = func_to_g_audio(fn);
   945		struct usb_composite_dev *cdev = cfg->cdev;
   946		struct usb_gadget *gadget = cdev->gadget;
   947		struct device *dev = &gadget->dev;
   948		struct f_uac2_opts *uac2_opts = g_audio_to_uac2_opts(agdev);
   949		struct usb_string *us;
   950		int ret;
   951	
   952		ret = afunc_validate_opts(agdev, dev);
   953		if (ret)
   954			return ret;
   955	
   956		us = usb_gstrings_attach(cdev, fn_strings, ARRAY_SIZE(strings_fn));
   957		if (IS_ERR(us))
   958			return PTR_ERR(us);
   959	
   960		if (FUOUT_EN(uac2_opts)) {
   961			out_feature_unit_desc = build_fu_desc(uac2_opts->c_chmask);
   962			if (!out_feature_unit_desc)
   963				return -ENOMEM;
   964		}
   965		if (FUIN_EN(uac2_opts)) {
   966			in_feature_unit_desc = build_fu_desc(uac2_opts->p_chmask);
   967			if (!in_feature_unit_desc) {
   968				ret = -ENOMEM;
   969				goto err_free_fu;
   970			}
   971		}
   972	
   973		iad_desc.iFunction = us[STR_ASSOC].id;
   974		std_ac_if_desc.iInterface = us[STR_IF_CTRL].id;
   975		in_clk_src_desc.iClockSource = us[STR_CLKSRC_IN].id;
   976		out_clk_src_desc.iClockSource = us[STR_CLKSRC_OUT].id;
   977		usb_out_it_desc.iTerminal = us[STR_USB_IT].id;
   978		io_in_it_desc.iTerminal = us[STR_IO_IT].id;
   979		usb_in_ot_desc.iTerminal = us[STR_USB_OT].id;
   980		io_out_ot_desc.iTerminal = us[STR_IO_OT].id;
   981		std_as_out_if0_desc.iInterface = us[STR_AS_OUT_ALT0].id;
   982		std_as_out_if1_desc.iInterface = us[STR_AS_OUT_ALT1].id;
   983		std_as_in_if0_desc.iInterface = us[STR_AS_IN_ALT0].id;
   984		std_as_in_if1_desc.iInterface = us[STR_AS_IN_ALT1].id;
   985	
   986		if (FUOUT_EN(uac2_opts)) {
   987			u8 *i_feature = (u8 *)out_feature_unit_desc +
   988					out_feature_unit_desc->bLength - 1;
   989			*i_feature = us[STR_FU_OUT].id;
   990		}
   991		if (FUIN_EN(uac2_opts)) {
   992			u8 *i_feature = (u8 *)in_feature_unit_desc +
   993					in_feature_unit_desc->bLength - 1;
   994			*i_feature = us[STR_FU_IN].id;
   995		}
   996	
   997	
   998		/* Initialize the configurable parameters */
   999		usb_out_it_desc.bNrChannels = num_channels(uac2_opts->c_chmask);
  1000		usb_out_it_desc.bmChannelConfig = cpu_to_le32(uac2_opts->c_chmask);
  1001		io_in_it_desc.bNrChannels = num_channels(uac2_opts->p_chmask);
  1002		io_in_it_desc.bmChannelConfig = cpu_to_le32(uac2_opts->p_chmask);
  1003		as_out_hdr_desc.bNrChannels = num_channels(uac2_opts->c_chmask);
  1004		as_out_hdr_desc.bmChannelConfig = cpu_to_le32(uac2_opts->c_chmask);
  1005		as_in_hdr_desc.bNrChannels = num_channels(uac2_opts->p_chmask);
  1006		as_in_hdr_desc.bmChannelConfig = cpu_to_le32(uac2_opts->p_chmask);
  1007		as_out_fmt1_desc.bSubslotSize = uac2_opts->c_ssize;
  1008		as_out_fmt1_desc.bBitResolution = uac2_opts->c_ssize * 8;
  1009		as_in_fmt1_desc.bSubslotSize = uac2_opts->p_ssize;
  1010		as_in_fmt1_desc.bBitResolution = uac2_opts->p_ssize * 8;
  1011		if (FUOUT_EN(uac2_opts)) {
  1012			__le32 *bma = (__le32 *)&out_feature_unit_desc->bmaControls[0];
  1013			u32 control = 0;
  1014	
  1015			if (uac2_opts->c_mute_present)
  1016				control |= CONTROL_RDWR << FU_MUTE_CTRL;
  1017			if (uac2_opts->c_volume_present)
  1018				control |= CONTROL_RDWR << FU_VOL_CTRL;
  1019			*bma = cpu_to_le32(control);
  1020		}
  1021		if (FUIN_EN(uac2_opts)) {
  1022			__le32 *bma = (__le32 *)&in_feature_unit_desc->bmaControls[0];
  1023			u32 control = 0;
  1024	
  1025			if (uac2_opts->p_mute_present)
  1026				control |= CONTROL_RDWR << FU_MUTE_CTRL;
  1027			if (uac2_opts->p_volume_present)
  1028				control |= CONTROL_RDWR << FU_VOL_CTRL;
  1029			*bma = cpu_to_le32(control);
  1030		}
  1031	
  1032		snprintf(clksrc_in, sizeof(clksrc_in), "%uHz", uac2_opts->p_srate);
  1033		snprintf(clksrc_out, sizeof(clksrc_out), "%uHz", uac2_opts->c_srate);
  1034	
  1035		ret = usb_interface_id(cfg, fn);
  1036		if (ret < 0) {
  1037			dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1038			goto err_free_fu;
  1039		}
  1040		iad_desc.bFirstInterface = ret;
  1041	
  1042		std_ac_if_desc.bInterfaceNumber = ret;
  1043		uac2->ac_intf = ret;
  1044		uac2->ac_alt = 0;
  1045	
  1046		if (EPOUT_EN(uac2_opts)) {
  1047			ret = usb_interface_id(cfg, fn);
  1048			if (ret < 0) {
  1049				dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1050				goto err_free_fu;
  1051			}
  1052			std_as_out_if0_desc.bInterfaceNumber = ret;
  1053			std_as_out_if1_desc.bInterfaceNumber = ret;
  1054			uac2->as_out_intf = ret;
  1055			uac2->as_out_alt = 0;
  1056	
  1057			if (EPOUT_FBACK_IN_EN(uac2_opts)) {
  1058				fs_epout_desc.bmAttributes =
  1059				  USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC;
  1060				hs_epout_desc.bmAttributes =
  1061				  USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC;
  1062				ss_epout_desc.bmAttributes =
  1063				  USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC;
  1064				std_as_out_if1_desc.bNumEndpoints++;
  1065			} else {
  1066				fs_epout_desc.bmAttributes =
  1067				  USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE;
  1068				hs_epout_desc.bmAttributes =
  1069				  USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE;
  1070				ss_epout_desc.bmAttributes =
  1071				  USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE;
  1072			}
  1073		}
  1074	
  1075		if (EPIN_EN(uac2_opts)) {
  1076			ret = usb_interface_id(cfg, fn);
  1077			if (ret < 0) {
  1078				dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1079				goto err_free_fu;
  1080			}
  1081			std_as_in_if0_desc.bInterfaceNumber = ret;
  1082			std_as_in_if1_desc.bInterfaceNumber = ret;
  1083			uac2->as_in_intf = ret;
  1084			uac2->as_in_alt = 0;
  1085		}
  1086	
  1087		if (FUOUT_EN(uac2_opts) || FUIN_EN(uac2_opts)) {
  1088			uac2->int_ep = usb_ep_autoconfig(gadget, &fs_ep_int_desc);
  1089			if (!uac2->int_ep) {
  1090				dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1091				ret = -ENODEV;
  1092				goto err_free_fu;
  1093			}
  1094	
  1095			std_ac_if_desc.bNumEndpoints = 1;
  1096		}
  1097	
  1098		/* Calculate wMaxPacketSize according to audio bandwidth */
  1099		ret = set_ep_max_packet_size(uac2_opts, &fs_epin_desc, USB_SPEED_FULL,
  1100					     true);
  1101		if (ret < 0) {
  1102			dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1103			return ret;
  1104		}
  1105	
  1106		ret = set_ep_max_packet_size(uac2_opts, &fs_epout_desc, USB_SPEED_FULL,
  1107					     false);
  1108		if (ret < 0) {
  1109			dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1110			return ret;
  1111		}
  1112	
  1113		ret = set_ep_max_packet_size(uac2_opts, &hs_epin_desc, USB_SPEED_HIGH,
  1114					     true);
  1115		if (ret < 0) {
  1116			dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1117			return ret;
  1118		}
  1119	
  1120		ret = set_ep_max_packet_size(uac2_opts, &hs_epout_desc, USB_SPEED_HIGH,
  1121					     false);
  1122		if (ret < 0) {
  1123			dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1124			return ret;
  1125		}
  1126	
  1127		ret = set_ep_max_packet_size(uac2_opts, &ss_epin_desc, USB_SPEED_SUPER,
  1128					     true);
  1129		if (ret < 0) {
  1130			dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1131			return ret;
  1132		}
  1133	
  1134		ret = set_ep_max_packet_size(uac2_opts, &ss_epout_desc, USB_SPEED_SUPER,
  1135					     false);
  1136		if (ret < 0) {
  1137			dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1138			return ret;
  1139		}
  1140	
  1141		if (EPOUT_EN(uac2_opts)) {
  1142			agdev->out_ep = usb_ep_autoconfig(gadget, &fs_epout_desc);
  1143			if (!agdev->out_ep) {
  1144				dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1145				ret = -ENODEV;
  1146				goto err_free_fu;
  1147			}
  1148			if (EPOUT_FBACK_IN_EN(uac2_opts)) {
  1149				agdev->in_ep_fback = usb_ep_autoconfig(gadget,
  1150							       &fs_epin_fback_desc);
  1151				if (!agdev->in_ep_fback) {
  1152					dev_err(dev, "%s:%d Error!\n",
  1153						__func__, __LINE__);
  1154					ret = -ENODEV;
  1155					goto err_free_fu;
  1156				}
  1157			}
  1158		}
  1159	
  1160		if (EPIN_EN(uac2_opts)) {
  1161			agdev->in_ep = usb_ep_autoconfig(gadget, &fs_epin_desc);
  1162			if (!agdev->in_ep) {
  1163				dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
  1164				ret = -ENODEV;
  1165				goto err_free_fu;
  1166			}
  1167		}
  1168	
  1169		agdev->in_ep_maxpsize = max_t(u16,
  1170					le16_to_cpu(fs_epin_desc.wMaxPacketSize),
  1171					le16_to_cpu(hs_epin_desc.wMaxPacketSize));
  1172		agdev->out_ep_maxpsize = max_t(u16,
  1173					le16_to_cpu(fs_epout_desc.wMaxPacketSize),
  1174					le16_to_cpu(hs_epout_desc.wMaxPacketSize));
  1175	
  1176		agdev->in_ep_maxpsize = max_t(u16, agdev->in_ep_maxpsize,
  1177					le16_to_cpu(ss_epin_desc.wMaxPacketSize));
  1178		agdev->out_ep_maxpsize = max_t(u16, agdev->out_ep_maxpsize,
  1179					le16_to_cpu(ss_epout_desc.wMaxPacketSize));
  1180	
> 1181		ss_epin_desc_comp->wBytesPerInterval = ss_epin_desc->wMaxPacketSize;
  1182		ss_epout_desc_comp->wBytesPerInterval = ss_epout_desc->wMaxPacketSize;
  1183	
  1184		// HS and SS endpoint addresses are copied from autoconfigured FS descriptors
  1185		hs_ep_int_desc.bEndpointAddress = fs_ep_int_desc.bEndpointAddress;
  1186		hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress;
  1187		hs_epin_fback_desc.bEndpointAddress = fs_epin_fback_desc.bEndpointAddress;
  1188		hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
  1189		ss_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress;
  1190		ss_epin_fback_desc.bEndpointAddress = fs_epin_fback_desc.bEndpointAddress;
  1191		ss_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
  1192		ss_ep_int_desc.bEndpointAddress = fs_ep_int_desc.bEndpointAddress;
  1193	
  1194		setup_descriptor(uac2_opts);
  1195	
  1196		ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, ss_audio_desc,
  1197					     ss_audio_desc);
  1198		if (ret)
  1199			goto err_free_fu;
  1200	
  1201		agdev->gadget = gadget;
  1202	
  1203		agdev->params.p_chmask = uac2_opts->p_chmask;
  1204		agdev->params.p_srate = uac2_opts->p_srate;
  1205		agdev->params.p_ssize = uac2_opts->p_ssize;
  1206		if (FUIN_EN(uac2_opts)) {
  1207			agdev->params.p_fu.id = USB_IN_FU_ID;
  1208			agdev->params.p_fu.mute_present = uac2_opts->p_mute_present;
  1209			agdev->params.p_fu.volume_present = uac2_opts->p_volume_present;
  1210			agdev->params.p_fu.volume_min = uac2_opts->p_volume_min;
  1211			agdev->params.p_fu.volume_max = uac2_opts->p_volume_max;
  1212			agdev->params.p_fu.volume_res = uac2_opts->p_volume_res;
  1213		}
  1214		agdev->params.c_chmask = uac2_opts->c_chmask;
  1215		agdev->params.c_srate = uac2_opts->c_srate;
  1216		agdev->params.c_ssize = uac2_opts->c_ssize;
  1217		if (FUOUT_EN(uac2_opts)) {
  1218			agdev->params.c_fu.id = USB_OUT_FU_ID;
  1219			agdev->params.c_fu.mute_present = uac2_opts->c_mute_present;
  1220			agdev->params.c_fu.volume_present = uac2_opts->c_volume_present;
  1221			agdev->params.c_fu.volume_min = uac2_opts->c_volume_min;
  1222			agdev->params.c_fu.volume_max = uac2_opts->c_volume_max;
  1223			agdev->params.c_fu.volume_res = uac2_opts->c_volume_res;
  1224		}
  1225		agdev->params.req_number = uac2_opts->req_number;
  1226		agdev->params.fb_max = uac2_opts->fb_max;
  1227	
  1228		if (FUOUT_EN(uac2_opts) || FUIN_EN(uac2_opts))
  1229	    agdev->notify = afunc_notify;
  1230	
  1231		ret = g_audio_setup(agdev, "UAC2 PCM", "UAC2_Gadget");
  1232		if (ret)
  1233			goto err_free_descs;
  1234	
  1235		return 0;
  1236	
  1237	err_free_descs:
  1238		usb_free_all_descriptors(fn);
  1239		agdev->gadget = NULL;
  1240	err_free_fu:
  1241		kfree(out_feature_unit_desc);
  1242		out_feature_unit_desc = NULL;
  1243		kfree(in_feature_unit_desc);
  1244		in_feature_unit_desc = NULL;
  1245		return ret;
  1246	}
  1247	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux