Commit f70d436f authored by Heikki Krogerus's avatar Heikki Krogerus Committed by Greg Kroah-Hartman

usb: typec: Declare the typec_class static

This is only to make the handling of the class consistent
with the two other susbsystems - the alt mode bus and the
mux class.
Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20210401105847.13026-3-heikki.krogerus@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1e2ed7b2
...@@ -17,7 +17,11 @@ ...@@ -17,7 +17,11 @@
#include "class.h" #include "class.h"
static DEFINE_IDA(typec_index_ida); static DEFINE_IDA(typec_index_ida);
static struct class *typec_class;
static struct class typec_class = {
.name = "typec",
.owner = THIS_MODULE,
};
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* Common attributes */ /* Common attributes */
...@@ -551,7 +555,7 @@ typec_register_altmode(struct device *parent, ...@@ -551,7 +555,7 @@ typec_register_altmode(struct device *parent,
/* Plug alt modes need a class to generate udev events. */ /* Plug alt modes need a class to generate udev events. */
if (is_typec_plug(parent)) if (is_typec_plug(parent))
alt->adev.dev.class = typec_class; alt->adev.dev.class = &typec_class;
ret = device_register(&alt->adev.dev); ret = device_register(&alt->adev.dev);
if (ret) { if (ret) {
...@@ -815,7 +819,7 @@ struct typec_partner *typec_register_partner(struct typec_port *port, ...@@ -815,7 +819,7 @@ struct typec_partner *typec_register_partner(struct typec_port *port,
partner->identity = desc->identity; partner->identity = desc->identity;
} }
partner->dev.class = typec_class; partner->dev.class = &typec_class;
partner->dev.parent = &port->dev; partner->dev.parent = &port->dev;
partner->dev.type = &typec_partner_dev_type; partner->dev.type = &typec_partner_dev_type;
dev_set_name(&partner->dev, "%s-partner", dev_name(&port->dev)); dev_set_name(&partner->dev, "%s-partner", dev_name(&port->dev));
...@@ -967,7 +971,7 @@ struct typec_plug *typec_register_plug(struct typec_cable *cable, ...@@ -967,7 +971,7 @@ struct typec_plug *typec_register_plug(struct typec_cable *cable,
ida_init(&plug->mode_ids); ida_init(&plug->mode_ids);
plug->num_altmodes = -1; plug->num_altmodes = -1;
plug->index = desc->index; plug->index = desc->index;
plug->dev.class = typec_class; plug->dev.class = &typec_class;
plug->dev.parent = &cable->dev; plug->dev.parent = &cable->dev;
plug->dev.type = &typec_plug_dev_type; plug->dev.type = &typec_plug_dev_type;
dev_set_name(&plug->dev, "%s-%s", dev_name(cable->dev.parent), name); dev_set_name(&plug->dev, "%s-%s", dev_name(cable->dev.parent), name);
...@@ -1132,7 +1136,7 @@ struct typec_cable *typec_register_cable(struct typec_port *port, ...@@ -1132,7 +1136,7 @@ struct typec_cable *typec_register_cable(struct typec_port *port,
cable->identity = desc->identity; cable->identity = desc->identity;
} }
cable->dev.class = typec_class; cable->dev.class = &typec_class;
cable->dev.parent = &port->dev; cable->dev.parent = &port->dev;
cable->dev.type = &typec_cable_dev_type; cable->dev.type = &typec_cable_dev_type;
dev_set_name(&cable->dev, "%s-cable", dev_name(&port->dev)); dev_set_name(&cable->dev, "%s-cable", dev_name(&port->dev));
...@@ -1986,7 +1990,7 @@ struct typec_port *typec_register_port(struct device *parent, ...@@ -1986,7 +1990,7 @@ struct typec_port *typec_register_port(struct device *parent,
port->prefer_role = cap->prefer_role; port->prefer_role = cap->prefer_role;
device_initialize(&port->dev); device_initialize(&port->dev);
port->dev.class = typec_class; port->dev.class = &typec_class;
port->dev.parent = parent; port->dev.parent = parent;
port->dev.fwnode = cap->fwnode; port->dev.fwnode = cap->fwnode;
port->dev.type = &typec_port_dev_type; port->dev.type = &typec_port_dev_type;
...@@ -2049,11 +2053,9 @@ static int __init typec_init(void) ...@@ -2049,11 +2053,9 @@ static int __init typec_init(void)
if (ret) if (ret)
goto err_unregister_bus; goto err_unregister_bus;
typec_class = class_create(THIS_MODULE, "typec"); ret = class_register(&typec_class);
if (IS_ERR(typec_class)) { if (ret)
ret = PTR_ERR(typec_class);
goto err_unregister_mux_class; goto err_unregister_mux_class;
}
return 0; return 0;
...@@ -2069,7 +2071,7 @@ subsys_initcall(typec_init); ...@@ -2069,7 +2071,7 @@ subsys_initcall(typec_init);
static void __exit typec_exit(void) static void __exit typec_exit(void)
{ {
class_destroy(typec_class); class_unregister(&typec_class);
ida_destroy(&typec_index_ida); ida_destroy(&typec_index_ida);
bus_unregister(&typec_bus); bus_unregister(&typec_bus);
class_unregister(&typec_mux_class); class_unregister(&typec_mux_class);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment