Commit a86c309e authored by Mats Karrman's avatar Mats Karrman Committed by Greg Kroah-Hartman

usb: typec: Don't prevent using constant typec_mode_desc initializers

In some situations, e.g. when registering alternate modes for local typec
ports, it may be handy to use constant mode descriptors. Allow this by
changing the mode descriptor arguments of typec_port_register_altmode()
et.al. to using const pointers.
Signed-off-by: default avatarMats Karrman <mats.dev.list@gmail.com>
Reviewed-by: default avatarGuenter Roeck <groeck@chromium.org>
Acked-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 614536da
......@@ -291,7 +291,7 @@ typec_altmode_roles_show(struct device *dev, struct device_attribute *attr,
}
static void typec_init_modes(struct typec_altmode *alt,
struct typec_mode_desc *desc, bool is_port)
const struct typec_mode_desc *desc, bool is_port)
{
int i;
......@@ -378,7 +378,8 @@ static const struct device_type typec_altmode_dev_type = {
};
static struct typec_altmode *
typec_register_altmode(struct device *parent, struct typec_altmode_desc *desc)
typec_register_altmode(struct device *parent,
const struct typec_altmode_desc *desc)
{
struct typec_altmode *alt;
int ret;
......@@ -495,7 +496,7 @@ EXPORT_SYMBOL_GPL(typec_partner_set_identity);
*/
struct typec_altmode *
typec_partner_register_altmode(struct typec_partner *partner,
struct typec_altmode_desc *desc)
const struct typec_altmode_desc *desc)
{
return typec_register_altmode(&partner->dev, desc);
}
......@@ -590,7 +591,7 @@ static const struct device_type typec_plug_dev_type = {
*/
struct typec_altmode *
typec_plug_register_altmode(struct typec_plug *plug,
struct typec_altmode_desc *desc)
const struct typec_altmode_desc *desc)
{
return typec_register_altmode(&plug->dev, desc);
}
......@@ -1159,7 +1160,7 @@ EXPORT_SYMBOL_GPL(typec_set_pwr_opmode);
*/
struct typec_altmode *
typec_port_register_altmode(struct typec_port *port,
struct typec_altmode_desc *desc)
const struct typec_altmode_desc *desc)
{
return typec_register_altmode(&port->dev, desc);
}
......
......@@ -117,13 +117,13 @@ struct typec_altmode_desc {
struct typec_altmode
*typec_partner_register_altmode(struct typec_partner *partner,
struct typec_altmode_desc *desc);
const struct typec_altmode_desc *desc);
struct typec_altmode
*typec_plug_register_altmode(struct typec_plug *plug,
struct typec_altmode_desc *desc);
const struct typec_altmode_desc *desc);
struct typec_altmode
*typec_port_register_altmode(struct typec_port *port,
struct typec_altmode_desc *desc);
const struct typec_altmode_desc *desc);
void typec_unregister_altmode(struct typec_altmode *altmode);
struct typec_port *typec_altmode2port(struct typec_altmode *alt);
......
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