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

Commit d9a7ecac authored by Jim Radford's avatar Jim Radford Committed by Greg Kroah-Hartman
Browse files

usb-serial: fix shutdown / device_unregister order



Ensure that the ->port_remove() callbacks get called before the
->shutdown() callback which makeing the order symmetric with
->attach() being called before ->port_probe().

Signed-off-by: default avatarJim Radford <radford@blackbean.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4eaf60e0
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -135,11 +135,6 @@ static void destroy_serial(struct kref *kref)


	dbg("%s - %s", __FUNCTION__, serial->type->description);
	dbg("%s - %s", __FUNCTION__, serial->type->description);


	serial->type->shutdown(serial);

	/* return the minor range that this device had */
	return_serial(serial);

	for (i = 0; i < serial->num_ports; ++i)
	for (i = 0; i < serial->num_ports; ++i)
		serial->port[i]->open_count = 0;
		serial->port[i]->open_count = 0;


@@ -150,6 +145,12 @@ static void destroy_serial(struct kref *kref)
			serial->port[i] = NULL;
			serial->port[i] = NULL;
		}
		}


	if (serial->type->shutdown)
		serial->type->shutdown(serial);

	/* return the minor range that this device had */
	return_serial(serial);

	/* If this is a "fake" port, we have to clean it up here, as it will
	/* If this is a "fake" port, we have to clean it up here, as it will
	 * not get cleaned up in port_release() as it was never registered with
	 * not get cleaned up in port_release() as it was never registered with
	 * the driver core */
	 * the driver core */