Skip to contentSkip to conversation

usb: dwc3: use proper initializers for property entries

PATCH Applied Dmitry Torokhov 5 participants 5 messages Dec 13, 2019 – Jan 9, 2020

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

PATCH 1/1 usb: dwc3: use proper initializers for property entries

We should not be reaching into property entries and initialize them by hand, but rather use proper initializer macros. This way we can alter internal representation of property entries with no visible changes to their users.

---

It would be good if this could go through Rafael's tree as it is needed for the rest of my software_node/property_entry rework patch series which I would love not to delay till 5.6.

Thanks!

 drivers/usb/dwc3/host.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/host.c +3 -3
index 5567ed2cddbec..fa252870c926f 100644
@@ -88,10 +88,10 @@ int dwc3_host_init(struct dwc3 *dwc)
 	memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
 
 	if (dwc->usb3_lpm_capable)
-		props[prop_idx++].name = "usb3-lpm-capable";
+		props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable");
 
 	if (dwc->usb2_lpm_disable)
-		props[prop_idx++].name = "usb2-lpm-disable";
+		props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable");
 
 	/**
 	 * WORKAROUND: dwc3 revisions <=3.00a have a limitation
@@ -103,7 +103,7 @@ int dwc3_host_init(struct dwc3 *dwc)
 	 * This following flag tells XHCI to do just that.
 	 */
 	if (dwc->revision <= DWC3_REVISION_300A)
-		props[prop_idx++].name = "quirk-broken-port-ped";
+		props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped");
 
 	if (prop_idx) {
 		ret = platform_device_add_properties(xhci, props);
Signature · 5 lines
2.24.1.735.g03f4e72817-goog


-- 
Dmitry
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 5 lines · Dmitry Torokhov

We should not be reaching into property entries and initialize them by hand, but rather use proper initializer macros. This way we can alter internal representation of property entries with no visible changes to their users.

Quoted 8 lines

---

It would be good if this could go through Rafael's tree as it is needed for the rest of my software_node/property_entry rework patch series which I would love not to delay till 5.6.

Patch looks good to me:

Regards,

Hans

Quoted 33 lines

Thanks!

  drivers/usb/dwc3/host.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/host.c +3 -3
index 5567ed2cddbec..fa252870c926f 100644
@@ -88,10 +88,10 @@ int dwc3_host_init(struct dwc3 *dwc)
  	memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
 
  	if (dwc->usb3_lpm_capable)
-		props[prop_idx++].name = "usb3-lpm-capable";
+		props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable");
 
  	if (dwc->usb2_lpm_disable)
-		props[prop_idx++].name = "usb2-lpm-disable";
+		props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable");
 
  	/**
  	 * WORKAROUND: dwc3 revisions <=3.00a have a limitation
@@ -103,7 +103,7 @@ int dwc3_host_init(struct dwc3 *dwc)
  	 * This following flag tells XHCI to do just that.
  	 */
  	if (dwc->revision <= DWC3_REVISION_300A)
-		props[prop_idx++].name = "quirk-broken-port-ped";
+		props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped");
 
  	if (prop_idx) {
  		ret = platform_device_add_properties(xhci, props);
#2 lore raw

Hi All,

Quoted 13 lines · Hans de Goede

Hi,

Quoted 10 lines · Dmitry Torokhov

We should not be reaching into property entries and initialize them by hand, but rather use proper initializer macros. This way we can alter internal representation of property entries with no visible changes to their users.

---

Quoted 7 lines
Quoted 3 lines

It would be good if this could go through Rafael's tree as it is needed for the rest of my software_node/property_entry rework patch series which I would love not to delay till 5.6.

Patch looks good to me:

This patch is instantly needed as the issue it fixes is again triggered in current (20200107) linux-next by commit e6bff4665c59 "software node:
replace is_array with is_inline".

Felipe: could You ack it, so it could be merged via Rafael's tree together with related device property changes?

Quoted 21 lines
Quoted 21 lines

  drivers/usb/dwc3/host.c | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/host.c +0 -0
index 5567ed2cddbec..fa252870c926f 100644
@@ -88,10 +88,10 @@ int dwc3_host_init(struct dwc3 *dwc)

      memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
        if (dwc->usb3_lpm_capable)
-        props[prop_idx++].name = "usb3-lpm-capable";
+        props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable"); if (dwc->usb2_lpm_disable)
-        props[prop_idx++].name = "usb2-lpm-disable";
+        props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable"); /**
       * WORKAROUND: dwc3 revisions <=3.00a have a limitation

drivers/usb/dwc3/host.c +0 -0
@@ -103,7 +103,7 @@ int dwc3_host_init(struct dwc3 *dwc)
        * This following flag tells XHCI to do just that.
Quoted 9 lines

drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) · line 109

Quoted 8 lines
drivers/usb/dwc3/host.c +1 -1
        */
       if (dwc->revision <= DWC3_REVISION_300A)
-        props[prop_idx++].name = "quirk-broken-port-ped";
+        props[prop_idx++] = 
 PROPERTY_ENTRY_BOOL("quirk-broken-port-ped");
         if (prop_idx) {
           ret = platform_device_add_properties(xhci, props);

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Acked-by
#3 lore raw

Hi,

Quoted 22 lines · Marek Szyprowski

Hi All,

Quoted 19 lines · Hans de Goede

Hi,

Quoted 5 lines · Dmitry Torokhov

We should not be reaching into property entries and initialize them by hand, but rather use proper initializer macros. This way we can alter internal representation of property entries with no visible changes to their users.

Quoted 8 lines

---

It would be good if this could go through Rafael's tree as it is needed for the rest of my software_node/property_entry rework patch series which I would love not to delay till 5.6.

Patch looks good to me:

Quoted 8 lines
Quoted 1 line

This patch is instantly needed as the issue it fixes is again triggered in current (20200107) linux-next by commit e6bff4665c59 "software node:
replace is_array with is_inline".

Felipe: could You ack it, so it could be merged via Rafael's tree together with related device property changes?

Here you go:

cheers

Signature · 1 line
balbi
#4 lore raw
Quoted 34 lines · Felipe Balbi

Hi,

Quoted 28 lines · Marek Szyprowski

Hi All,

Quoted 13 lines · Hans de Goede

Hi,

Quoted 10 lines · Dmitry Torokhov

We should not be reaching into property entries and initialize them by hand, but rather use proper initializer macros. This way we can alter internal representation of property entries with no visible changes to their users.

---

Quoted 7 lines
Quoted 3 lines

It would be good if this could go through Rafael's tree as it is needed for the rest of my software_node/property_entry rework patch series which I would love not to delay till 5.6.

Patch looks good to me:

This patch is instantly needed as the issue it fixes is again triggered in current (20200107) linux-next by commit e6bff4665c59 "software node:
replace is_array with is_inline".

Quoted 6 lines
Quoted 2 lines

Felipe: could You ack it, so it could be merged via Rafael's tree together with related device property changes?

Here you go:

Thanks, applied.