Thread (27 messages) 27 messages, 4 authors, 2019-03-13

Re: [PATCH v2 8/8] usb: dwc3: Add Amlogic G12A DWC3 glue

From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date: 2019-03-11 21:19:14
Also in: linux-amlogic, linux-usb, lkml

On Thu, Mar 7, 2019 at 10:46 AM Neil Armstrong [off-list ref] wrote:
[...]
quoted
quoted
+    /* Setup role switcher */
+    priv->switch_desc.usb2_port = dwc3_meson_g12_find_child(dev,
+                                                            "snps,dwc3");
+    priv->switch_desc.udc = dwc3_meson_g12_find_child(dev, "snps,dwc2");
+    priv->switch_desc.allow_userspace_control = true;
+    priv->switch_desc.set = dwc3_meson_g12a_role_set;
+    priv->switch_desc.get = dwc3_meson_g12a_role_get;
to me, use a local variable for switch_desc
I'm never fan of changing a local global variable for a driver instance,
is it strictly required ?
usb_role_switch_register (which is called a few lines below this)
copies all data from "struct usb_role_switch_desc" to a newly
allocated "struct usb_role_switch"
in other words: you could make it a stack-variable

personally I have no preference so I leave the decision up to you


Regards
Martin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help