Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4edfa24 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: Update functions for SSP descriptors"

parents 1efffc4b c632135a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -638,7 +638,7 @@ static int ccid_function_bind(struct usb_configuration *c,
					ccid_fs_notify_desc.bEndpointAddress;

	ret = usb_assign_descriptors(f, ccid_fs_descs, ccid_hs_descs,
						ccid_ss_descs, NULL);
						ccid_ss_descs, ccid_ss_descs);
	if (ret)
		goto ep_auto_out_fail;

+2 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2011, 2013-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2011, 2013-2018, The Linux Foundation. All rights reserved.
 * Linux Foundation chooses to take subject only to the GPLv2 license terms,
 * and distributes only under these terms.
 *
@@ -793,7 +793,7 @@ static int usb_cser_bind(struct usb_configuration *c, struct usb_function *f)
	}

	status = usb_assign_descriptors(f, cser_fs_function, cser_hs_function,
			cser_ss_function, NULL);
			cser_ss_function, cser_ss_function);
	if (status)
		goto fail;

+14 −41
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
 * Diag Function Device - Route ARM9 and ARM11 DIAG messages
 * between HOST and DEVICE.
 * Copyright (C) 2007 Google, Inc.
 * Copyright (c) 2008-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2018, The Linux Foundation. All rights reserved.
 * Author: Brian Swetland <swetland@google.com>
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -728,12 +728,7 @@ static void diag_function_unbind(struct usb_configuration *c,
	struct diag_context *ctxt = func_to_diag(f);
	unsigned long flags;

	if (gadget_is_superspeed(c->cdev->gadget))
		usb_free_descriptors(f->ss_descriptors);
	if (gadget_is_dualspeed(c->cdev->gadget))
		usb_free_descriptors(f->hs_descriptors);

	usb_free_descriptors(f->fs_descriptors);
	usb_free_all_descriptors(f);

	/*
	 * Channel priv_usb may point to other diag function.
@@ -773,35 +768,19 @@ static int diag_function_bind(struct usb_configuration *c,
	ctxt->out = ep;
	ep->driver_data = ctxt;

	status = -ENOMEM;
	/* copy descriptors, and track endpoint copies */
	f->fs_descriptors = usb_copy_descriptors(fs_diag_desc);
	if (!f->fs_descriptors)
		goto fail;

	if (gadget_is_dualspeed(c->cdev->gadget)) {
	hs_bulk_in_desc.bEndpointAddress =
			fs_bulk_in_desc.bEndpointAddress;
	hs_bulk_out_desc.bEndpointAddress =
			fs_bulk_out_desc.bEndpointAddress;

		/* copy descriptors, and track endpoint copies */
		f->hs_descriptors = usb_copy_descriptors(hs_diag_desc);
		if (!f->hs_descriptors)
			goto fail;
	}

	if (gadget_is_superspeed(c->cdev->gadget)) {
	ss_bulk_in_desc.bEndpointAddress =
			fs_bulk_in_desc.bEndpointAddress;
	ss_bulk_out_desc.bEndpointAddress =
			fs_bulk_out_desc.bEndpointAddress;

		/* copy descriptors, and track endpoint copies */
		f->ss_descriptors = usb_copy_descriptors(ss_diag_desc);
		if (!f->ss_descriptors)
	status = usb_assign_descriptors(f, fs_diag_desc, hs_diag_desc,
				ss_diag_desc, ss_diag_desc);
	if (status)
		goto fail;
	}

	/* Allow only first diag channel to update pid and serial no */
	if (ctxt == list_first_entry(&diag_dev_list,
@@ -810,12 +789,6 @@ static int diag_function_bind(struct usb_configuration *c,

	return 0;
fail:
	if (f->ss_descriptors)
		usb_free_descriptors(f->ss_descriptors);
	if (f->hs_descriptors)
		usb_free_descriptors(f->hs_descriptors);
	if (f->fs_descriptors)
		usb_free_descriptors(f->fs_descriptors);
	if (ctxt->out)
		ctxt->out->driver_data = NULL;
	if (ctxt->in)
+2 −0
Original line number Diff line number Diff line
@@ -3331,6 +3331,7 @@ static int _ffs_func_bind(struct usb_configuration *c,
			ret = ss_len;
			goto error;
		}
		func->function.ssp_descriptors = func->function.ss_descriptors;
	} else {
		ss_len = 0;
	}
@@ -3791,6 +3792,7 @@ static void ffs_func_unbind(struct usb_configuration *c,
	func->function.fs_descriptors = NULL;
	func->function.hs_descriptors = NULL;
	func->function.ss_descriptors = NULL;
	func->function.ssp_descriptors = NULL;
	func->interfaces_nums = NULL;

	ffs_event_add(ffs, FUNCTIONFS_UNBIND);
+25 −54
Original line number Diff line number Diff line
@@ -2466,59 +2466,35 @@ static int gsi_update_function_bind_params(struct f_gsi *gsi,
	spin_lock_init(&gsi->d_port.evt_q.q_lock);
	gsi->d_port.evt_q.head = gsi->d_port.evt_q.tail = MAXQUEUELEN - 1;

	/* copy descriptors, and track endpoint copies */
	f->fs_descriptors = usb_copy_descriptors(info->fs_desc_hdr);
	if (!gsi->function.fs_descriptors)
		goto fail;

	/* support all relevant hardware speeds... we expect that when
	 * hardware is dual speed, all bulk-capable endpoints work at
	 * both speeds
	 */
	if (gadget_is_dualspeed(cdev->gadget)) {
		if (info->fs_in_desc)
	if (info->fs_in_desc) {
		info->hs_in_desc->bEndpointAddress =
			info->fs_in_desc->bEndpointAddress;
		if (info->fs_out_desc)
			info->hs_out_desc->bEndpointAddress =
					info->fs_out_desc->bEndpointAddress;
		if (info->fs_notify_desc)
			info->hs_notify_desc->bEndpointAddress =
					info->fs_notify_desc->bEndpointAddress;

		/* copy descriptors, and track endpoint copies */
		f->hs_descriptors = usb_copy_descriptors(info->hs_desc_hdr);
		if (!f->hs_descriptors)
			goto fail;
	}

	if (gadget_is_superspeed(cdev->gadget)) {
		if (info->fs_in_desc)
		info->ss_in_desc->bEndpointAddress =
			info->fs_in_desc->bEndpointAddress;
	}

		if (info->fs_out_desc)
	if (info->fs_out_desc) {
		info->hs_out_desc->bEndpointAddress =
			info->fs_out_desc->bEndpointAddress;
		info->ss_out_desc->bEndpointAddress =
			info->fs_out_desc->bEndpointAddress;
		if (info->fs_notify_desc)
	}

	if (info->fs_notify_desc) {
		info->hs_notify_desc->bEndpointAddress =
			info->fs_notify_desc->bEndpointAddress;
		info->ss_notify_desc->bEndpointAddress =
			info->fs_notify_desc->bEndpointAddress;
	}

		/* copy descriptors, and track endpoint copies */
		f->ss_descriptors = usb_copy_descriptors(info->ss_desc_hdr);
		if (!f->ss_descriptors)
	status = usb_assign_descriptors(f, info->fs_desc_hdr, info->hs_desc_hdr,
					info->ss_desc_hdr, info->ss_desc_hdr);
	if (status)
		goto fail;
	}

	return 0;

fail:
	if (gadget_is_superspeed(cdev->gadget) && f->ss_descriptors)
		usb_free_descriptors(f->ss_descriptors);
	if (gadget_is_dualspeed(cdev->gadget) && f->hs_descriptors)
		usb_free_descriptors(f->hs_descriptors);
	if (f->fs_descriptors)
		usb_free_descriptors(f->fs_descriptors);
	if (gsi->c_port.notify_req) {
		kfree(gsi->c_port.notify_req->buf);
		usb_ep_free_request(gsi->c_port.notify, gsi->c_port.notify_req);
@@ -2930,16 +2906,11 @@ static void gsi_unbind(struct usb_configuration *c, struct usb_function *f)
	if (gsi->prot_id == IPA_USB_MBIM)
		mbim_gsi_ext_config_desc.function.subCompatibleID[0] = 0;

	if (gadget_is_superspeed(c->cdev->gadget)) {
		usb_free_descriptors(f->ss_descriptors);
		f->ss_descriptors = NULL;
	}
	if (gadget_is_dualspeed(c->cdev->gadget)) {
		usb_free_descriptors(f->hs_descriptors);
	usb_free_all_descriptors(f);
	f->hs_descriptors = NULL;
	}
	usb_free_descriptors(f->fs_descriptors);
	f->fs_descriptors = NULL;
	f->ss_descriptors = NULL;
	f->ssp_descriptors = NULL;

	if (gsi->c_port.notify) {
		kfree(gsi->c_port.notify_req->buf);
Loading