[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFBinCAUMNBeTABNeyOiYu9Gu8zWWmG3dBNJwFpop3QNp6ZG0g@mail.gmail.com>
Date: Mon, 11 Mar 2019 22:19:00 +0100
From: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
To: Neil Armstrong <narmstrong@...libre.com>
Cc: Chunfeng Yun <chunfeng.yun@...iatek.com>, balbi@...nel.org,
gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, kishon@...com, hminas@...opsys.com,
linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 8/8] usb: dwc3: Add Amlogic G12A DWC3 glue
On Thu, Mar 7, 2019 at 10:46 AM Neil Armstrong <narmstrong@...libre.com> wrote:
[...]
> >> + /* 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
Powered by blists - more mailing lists