Skip to contentSkip to conversation

linux-next: build failure after merge of the usb-gadget tree

PATCH Stephen Rothwell 3 participants 4 messages Mar 16, 2020

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

Hi all,

After merging the usb-gadget tree, today's linux-next build (arm multi_v7_defconfig) failed like this:

drivers/usb/dwc3/drd.c: In function 'dwc3_setup_role_switch':
drivers/usb/dwc3/drd.c:551:23: error: assignment to 'usb_role_switch_set_t' {aka 'int (*)(struct usb_role_switch *, enum usb_role)'} from incompatible pointer type 'int (*)(struct device *, enum usb_role)' [-Werror=incompatible-pointer-types]
551 | dwc3_role_switch.set = dwc3_usb_role_switch_set;
| ^
drivers/usb/dwc3/drd.c:552:23: error: assignment to 'usb_role_switch_get_t' {aka 'enum usb_role (*)(struct usb_role_switch *)'} from incompatible pointer type 'enum usb_role (*)(struct device *)' [-Werror=incompatible-pointer-types]
552 | dwc3_role_switch.get = dwc3_usb_role_switch_get;
| ^

Caused by commit

8a0a13799744 ("usb: dwc3: Registering a role switch in the DRD code.")

interacting with commit

bce3052f0c16 ("usb: roles: Provide the switch drivers handle to the switch in the API")

from the usb tree.

I have added the following merge fix patch (which may need more work):

From: Stephen Rothwell <[email protected]>
Date: Mon, 16 Mar 2020 14:34:31 +1100
Subject: [PATCH] usb: dwc3: fix up for role switch API change

---
 drivers/usb/dwc3/drd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/usb/dwc3/drd.c +6 -4
index db68d48c2267..7db1ffc92bbd 100644
@@ -478,9 +478,10 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
 
 #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
 #define ROLE_SWITCH 1
-static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
+static int dwc3_usb_role_switch_set(struct usb_role_switch *sw,
+				    enum usb_role role)
 {
-	struct dwc3 *dwc = dev_get_drvdata(dev);
+	struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
 	u32 mode;
 
 	switch (role) {
@@ -502,9 +503,9 @@ static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
 	return 0;
 }
 
-static enum usb_role dwc3_usb_role_switch_get(struct device *dev)
+static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
 {
-	struct dwc3 *dwc = dev_get_drvdata(dev);
+	struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
 	unsigned long flags;
 	enum usb_role role;
 
@@ -550,6 +551,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
 	dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
 	dwc3_role_switch.set = dwc3_usb_role_switch_set;
 	dwc3_role_switch.get = dwc3_usb_role_switch_get;
+	dwc3_role_switch.driver_data = dwc;
 	dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
 	if (IS_ERR(dwc->role_sw))
 		return PTR_ERR(dwc->role_sw);
Signature · 5 lines
2.25.0

-- 
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 63 lines · Stephen Rothwell

After merging the usb-gadget tree, today's linux-next build (arm multi_v7_defconfig) failed like this:

drivers/usb/dwc3/drd.c: In function 'dwc3_setup_role_switch':
drivers/usb/dwc3/drd.c:551:23: error: assignment to 'usb_role_switch_set_t' {aka 'int (*)(struct usb_role_switch *, enum usb_role)'} from incompatible pointer type 'int (*)(struct device *, enum usb_role)' [-Werror=incompatible-pointer-types]
551 | dwc3_role_switch.set = dwc3_usb_role_switch_set;
| ^
drivers/usb/dwc3/drd.c:552:23: error: assignment to 'usb_role_switch_get_t' {aka 'enum usb_role (*)(struct usb_role_switch *)'} from incompatible pointer type 'enum usb_role (*)(struct device *)' [-Werror=incompatible-pointer-types]
552 | dwc3_role_switch.get = dwc3_usb_role_switch_get;
| ^

Caused by commit

8a0a13799744 ("usb: dwc3: Registering a role switch in the DRD code.")

interacting with commit

bce3052f0c16 ("usb: roles: Provide the switch drivers handle to the switch in the API")

from the usb tree.

I have added the following merge fix patch (which may need more work):

From: Stephen Rothwell <[email protected]>
Date: Mon, 16 Mar 2020 14:34:31 +1100
Subject: [PATCH] usb: dwc3: fix up for role switch API change

---
 drivers/usb/dwc3/drd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/usb/dwc3/drd.c +5 -4
index db68d48c2267..7db1ffc92bbd 100644
@@ -478,9 +478,10 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
 
 #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
 #define ROLE_SWITCH 1
-static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
+static int dwc3_usb_role_switch_set(struct usb_role_switch *sw,
+                                   enum usb_role role)
 {
-       struct dwc3 *dwc = dev_get_drvdata(dev);
+       struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
        u32 mode;
 
        switch (role) {
@@ -502,9 +503,9 @@ static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
        return 0;
 }
 
-static enum usb_role dwc3_usb_role_switch_get(struct device *dev)
+static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
 {
-       struct dwc3 *dwc = dev_get_drvdata(dev);
+       struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
        unsigned long flags;
        enum usb_role role;
 

drivers/usb/dwc3/drd.c static int dwc3_setup_role_switch(struct dwc3 *dwc) · line 557

Quoted 7 lines
drivers/usb/dwc3/drd.c +1 -0
@@ -550,6 +551,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
        dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
        dwc3_role_switch.set = dwc3_usb_role_switch_set;
        dwc3_role_switch.get = dwc3_usb_role_switch_get;
+       dwc3_role_switch.driver_data = dwc;
        dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
        if (IS_ERR(dwc->role_sw))
                return PTR_ERR(dwc->role_sw);

Yes, thanks. Bryan pointed out there was a problem with the internal api change in -next, and I intended to resend the set this week. Your solution looks like what I have in my tree at first glance, but I'll double check to be sure.

Thanks so much!
-john

Acked-by
#2 lore raw
Quoted 64 lines · John Stultz
Quoted 62 lines · Stephen Rothwell

After merging the usb-gadget tree, today's linux-next build (arm multi_v7_defconfig) failed like this:

drivers/usb/dwc3/drd.c: In function 'dwc3_setup_role_switch':
drivers/usb/dwc3/drd.c:551:23: error: assignment to 'usb_role_switch_set_t' {aka 'int (*)(struct usb_role_switch *, enum usb_role)'} from incompatible pointer type 'int (*)(struct device *, enum usb_role)' [-Werror=incompatible-pointer-types]
551 | dwc3_role_switch.set = dwc3_usb_role_switch_set;
| ^
drivers/usb/dwc3/drd.c:552:23: error: assignment to 'usb_role_switch_get_t' {aka 'enum usb_role (*)(struct usb_role_switch *)'} from incompatible pointer type 'enum usb_role (*)(struct device *)' [-Werror=incompatible-pointer-types]
552 | dwc3_role_switch.get = dwc3_usb_role_switch_get;
| ^

Caused by commit

8a0a13799744 ("usb: dwc3: Registering a role switch in the DRD code.")

interacting with commit

bce3052f0c16 ("usb: roles: Provide the switch drivers handle to the switch in the API")

from the usb tree.

I have added the following merge fix patch (which may need more work):

From: Stephen Rothwell <[email protected]>
Date: Mon, 16 Mar 2020 14:34:31 +1100
Subject: [PATCH] usb: dwc3: fix up for role switch API change

---
 drivers/usb/dwc3/drd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/usb/dwc3/drd.c +5 -4
index db68d48c2267..7db1ffc92bbd 100644
@@ -478,9 +478,10 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
 
 #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
 #define ROLE_SWITCH 1
-static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
+static int dwc3_usb_role_switch_set(struct usb_role_switch *sw,
+                                   enum usb_role role)
 {
-       struct dwc3 *dwc = dev_get_drvdata(dev);
+       struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
        u32 mode;
 
        switch (role) {
@@ -502,9 +503,9 @@ static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
        return 0;
 }
 
-static enum usb_role dwc3_usb_role_switch_get(struct device *dev)
+static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
 {
-       struct dwc3 *dwc = dev_get_drvdata(dev);
+       struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
        unsigned long flags;
        enum usb_role role;
 
Quoted 13 lines

drivers/usb/dwc3/drd.c static int dwc3_setup_role_switch(struct dwc3 *dwc) · line 557

Quoted 8 lines
drivers/usb/dwc3/drd.c +1 -0
@@ -550,6 +551,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
        dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
        dwc3_role_switch.set = dwc3_usb_role_switch_set;
        dwc3_role_switch.get = dwc3_usb_role_switch_get;
+       dwc3_role_switch.driver_data = dwc;
        dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
        if (IS_ERR(dwc->role_sw))
                return PTR_ERR(dwc->role_sw);

Yes, thanks. Bryan pointed out there was a problem with the internal api change in -next, and I intended to resend the set this week. Your solution looks like what I have in my tree at first glance, but I'll double check to be sure.

Yes. Just confirmed its the same as what I had in my tree.

Greg: Could you pull Stephen's fix into your tree?

thanks
-john

#3 lore raw
Quoted 79 lines · John Stultz
Quoted 64 lines · John Stultz
Quoted 62 lines · Stephen Rothwell

After merging the usb-gadget tree, today's linux-next build (arm multi_v7_defconfig) failed like this:

drivers/usb/dwc3/drd.c: In function 'dwc3_setup_role_switch':
drivers/usb/dwc3/drd.c:551:23: error: assignment to 'usb_role_switch_set_t' {aka 'int (*)(struct usb_role_switch *, enum usb_role)'} from incompatible pointer type 'int (*)(struct device *, enum usb_role)' [-Werror=incompatible-pointer-types]
551 | dwc3_role_switch.set = dwc3_usb_role_switch_set;
| ^
drivers/usb/dwc3/drd.c:552:23: error: assignment to 'usb_role_switch_get_t' {aka 'enum usb_role (*)(struct usb_role_switch *)'} from incompatible pointer type 'enum usb_role (*)(struct device *)' [-Werror=incompatible-pointer-types]
552 | dwc3_role_switch.get = dwc3_usb_role_switch_get;
| ^

Caused by commit

8a0a13799744 ("usb: dwc3: Registering a role switch in the DRD code.")

interacting with commit

bce3052f0c16 ("usb: roles: Provide the switch drivers handle to the switch in the API")

from the usb tree.

I have added the following merge fix patch (which may need more work):

From: Stephen Rothwell <[email protected]>
Date: Mon, 16 Mar 2020 14:34:31 +1100
Subject: [PATCH] usb: dwc3: fix up for role switch API change

---
 drivers/usb/dwc3/drd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/usb/dwc3/drd.c +5 -4
index db68d48c2267..7db1ffc92bbd 100644
@@ -478,9 +478,10 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
 
 #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
 #define ROLE_SWITCH 1
-static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
+static int dwc3_usb_role_switch_set(struct usb_role_switch *sw,
+                                   enum usb_role role)
 {
-       struct dwc3 *dwc = dev_get_drvdata(dev);
+       struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
        u32 mode;
 
        switch (role) {
@@ -502,9 +503,9 @@ static int dwc3_usb_role_switch_set(struct device *dev, enum usb_role role)
        return 0;
 }
 
-static enum usb_role dwc3_usb_role_switch_get(struct device *dev)
+static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
 {
-       struct dwc3 *dwc = dev_get_drvdata(dev);
+       struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
        unsigned long flags;
        enum usb_role role;
 
Quoted 13 lines

drivers/usb/dwc3/drd.c static int dwc3_setup_role_switch(struct dwc3 *dwc) · line 557

Quoted 8 lines
drivers/usb/dwc3/drd.c +1 -0
@@ -550,6 +551,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
        dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
        dwc3_role_switch.set = dwc3_usb_role_switch_set;
        dwc3_role_switch.get = dwc3_usb_role_switch_get;
+       dwc3_role_switch.driver_data = dwc;
        dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
        if (IS_ERR(dwc->role_sw))
                return PTR_ERR(dwc->role_sw);

Yes, thanks. Bryan pointed out there was a problem with the internal api change in -next, and I intended to resend the set this week. Your solution looks like what I have in my tree at first glance, but I'll double check to be sure.

Quoted 5 lines

Yes. Just confirmed its the same as what I had in my tree.

Greg: Could you pull Stephen's fix into your tree?

It's been there for many hours now :)