Skip to contentSkip to conversation

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

PATCH Superseded Mats Karrman 4 participants 7 messages Apr 24, 2017 – Apr 25, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: typec: Don't prevent using constant typec_mode_desc initializers

From 98ff2be4de83f4d4b5293bfa424c274b25400e1e Mon Sep 17 00:00:00 2001
From: Mats Karrman <[email protected]>
Date: Mon, 24 Apr 2017 15:21:39 +0200
Subject: [PATCH] usb: typec: Don't prevent using constant typec_mode_desc initializers

---
 drivers/usb/typec/typec.c | 11 ++++++-----
 include/linux/usb/typec.h |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/usb/typec/typec.c +6 -5
index 89e540b..db5ee73 100644
@@ -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);
 }
include/linux/usb/typec.h +3 -3
index ec78204..d1d2ebc 100644
@@ -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);
Signature · 1 line
2.1.4
#1 lore raw

Hi Mats,

Quoted 26 lines · Mats Karrman

From 98ff2be4de83f4d4b5293bfa424c274b25400e1e Mon Sep 17 00:00:00 2001
From: Mats Karrman <[email protected]>
Date: Mon, 24 Apr 2017 15:21:39 +0200
Subject: [PATCH] usb: typec: Don't prevent using constant typec_mode_desc initializers

---
 drivers/usb/typec/typec.c | 11 ++++++-----
 include/linux/usb/typec.h |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/usb/typec/typec.c +1 -1
index 89e540b..db5ee73 100644
@@ -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;

drivers/usb/typec/typec.c static const struct device_type typec_altmode_dev_type = · line 384

Quoted 8 lines
drivers/usb/typec/typec.c +2 -1
@@ -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)

Unfortunately, this patch is whitespace damaged.

Thanks,
Guenter

Quoted 54 lines
drivers/usb/typec/typec.c +0 -0
 {
     struct typec_altmode *alt;
     int ret;
drivers/usb/typec/typec.c +3 -3
@@ -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);
 }
include/linux/usb/typec.h +3 -4
index ec78204..d1d2ebc 100644
@@ -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);
--

2.1.4

#2 lore raw

PATCH v2 1/1 usb: typec: Don't prevent using constant typec_mode_desc initializers

In reply to Mats Karrman

---
v2:
- Fixed damaged white-space
- Added signed-off-by

 drivers/usb/typec/typec.c | 11 ++++++-----
 include/linux/usb/typec.h |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/usb/typec/typec.c +6 -5
index 89e540b..db5ee73 100644
@@ -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);
 }
include/linux/usb/typec.h +3 -3
index ec78204..d1d2ebc 100644
@@ -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);
Signature · 1 line
2.1.4
#3 lore raw

PATCH v3 1/1 usb: typec: Don't prevent using constant typec_mode_desc initializers

---
v3:
- Fixed damaged white-space, finally?

v2:
- Fixed damaged white-space
- Added signed-off-by

 drivers/usb/typec/typec.c | 11 ++++++-----
 include/linux/usb/typec.h |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/usb/typec/typec.c +6 -5
index 89e540b..db5ee73 100644
@@ -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);
 }
include/linux/usb/typec.h +3 -3
index ec78204..d1d2ebc 100644
@@ -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);
Signature · 1 line
2.1.4
Reviewed-by on v3 1/1
#4 lore raw
Quoted 5 lines · Mats Karrman

---
v3:
- Fixed damaged white-space, finally?

Yes, this one finally applied. Some description in addition to the subject line might be nice. Other than that,

Guenter

Quoted 82 lines

v2:
- Fixed damaged white-space
- Added signed-off-by

 drivers/usb/typec/typec.c | 11 ++++++-----
 include/linux/usb/typec.h |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/usb/typec/typec.c +6 -5
index 89e540b..db5ee73 100644
@@ -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);
 }
include/linux/usb/typec.h +3 -4
index ec78204..d1d2ebc 100644
@@ -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);
--

2.1.4

#6 lore raw
In reply to Mats Karrman

Hi,

Quoted 6 lines · Mats Karrman

From 98ff2be4de83f4d4b5293bfa424c274b25400e1e Mon Sep 17 00:00:00 2001
From: Mats Karrman <[email protected]>
Date: Mon, 24 Apr 2017 15:21:39 +0200
Subject: [PATCH] usb: typec: Don't prevent using constant typec_mode_desc initializers

Unfortunately this is not how you send a proper patch :-) Have a read at Documentation/process/submitting-patches.rst and many questions will be answered.

Signature · 1 line
balbi