Re: [PATCH v6 11/13] leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support

From
Andy Shevchenko <hidden>
Date
2022-07-26 12:18:29
Also in
dri-devel, linux-arm-kernel, linux-devicetree, linux-iio, linux-leds, linux-mediatek, linux-pm, linux-usb, lkml
Reply to
ChiaEn Wu, 2022-07-26
On Tue, Jul 26, 2022 at 1:46 PM ChiaEn Wu [off-list ref] wrote:
On Mon, Jul 25, 2022 at 4:41 PM Andy Shevchenko
[off-list ref] wrote:
...
quoted
quoted
+struct mt6370_led {
+       union {
+               struct led_classdev isink;
+               struct led_classdev_mc mc;
+       };
Where is the field that makes union work?
Just for saving memory space.
Because these led_classdevs do not be used at the same time.
Or do you think it would be better to rewrite it as follows?
-------------------------------------------------------------------------------------
struct mt6370_led {
       struct led_classdev isink;
       struct led_classdev_mc mc;
       struct mt6370_priv *priv;
       u32 default_state;
       u32 index;
};
-------------------------------------------------------------------------------------
You obviously didn't get what I'm talking about...
Each union to work properly should have an associated variable that
holds the information of which field of the union is in use. Do you
have such a variable? If not, how does your code know which one to
use? If yes, add a proper comment there.

-- 
With Best Regards,
Andy Shevchenko
Thread (52 messages) 52 messages, 8 authors, last reply 2022-08-04
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help