Commit 9d11b134 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

USB: mark all struct bus_type as const



Now that the driver core can properly handle constant struct bus_type,
move all of the USB subsystem struct bus_type structures as const,
placing them into read-only memory which can not be modified at runtime.

Cc: Johan Hovold <johan@kernel.org>
Cc: Evan Green <evgreen@chromium.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
Acked-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230313182918.1312597-36-gregkh@linuxfoundation.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d492cc25
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ static void ulpi_remove(struct device *dev)
		drv->remove(to_ulpi_dev(dev));
}

static struct bus_type ulpi_bus = {
static const struct bus_type ulpi_bus = {
	.name = "ulpi",
	.match = ulpi_match,
	.uevent = ulpi_uevent,
+1 −1
Original line number Diff line number Diff line
@@ -2025,7 +2025,7 @@ int usb_disable_usb2_hardware_lpm(struct usb_device *udev)

#endif /* CONFIG_PM */

struct bus_type usb_bus_type = {
const struct bus_type usb_bus_type = {
	.name =		"usb",
	.match =	usb_device_match,
	.uevent =	usb_uevent,
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ static inline int usb_disable_usb2_hardware_lpm(struct usb_device *udev)

#endif

extern struct bus_type usb_bus_type;
extern const struct bus_type usb_bus_type;
extern struct mutex usb_port_peer_mutex;
extern struct device_type usb_device_type;
extern struct device_type usb_if_device_type;
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@

static DEFINE_IDA(gadget_id_numbers);

static struct bus_type gadget_bus_type;
static const struct bus_type gadget_bus_type;

/**
 * struct usb_udc - describes one usb device controller
@@ -1747,7 +1747,7 @@ static int usb_udc_uevent(const struct device *dev, struct kobj_uevent_env *env)
	return 0;
}

static struct bus_type gadget_bus_type = {
static const struct bus_type gadget_bus_type = {
	.name = "gadget",
	.probe = gadget_bind_driver,
	.remove = gadget_unbind_driver,
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ static void free_dynids(struct usb_serial_driver *drv)
	spin_unlock(&drv->dynids.lock);
}

struct bus_type usb_serial_bus_type = {
const struct bus_type usb_serial_bus_type = {
	.name =		"usb-serial",
	.match =	usb_serial_device_match,
	.probe =	usb_serial_device_probe,
Loading