Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp632287imn; Tue, 26 Jul 2022 05:33:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLTRulct9IW1sfOvCuTHCu8oDJXSv54mDPhWhzKbSXXluuafyuCi4ZTqgGM2VsNMuJvfvb X-Received: by 2002:a05:6830:4427:b0:61c:bdf4:215b with SMTP id q39-20020a056830442700b0061cbdf4215bmr6022217otv.268.1658838801540; Tue, 26 Jul 2022 05:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658838801; cv=none; d=google.com; s=arc-20160816; b=gwKsRYOSVSeXoXtwrPlA/QyR3IxmQXqxBIyBOheh9OHYp8m242p/nfMTA0lcjtGKq/ p+09euKcJj3Dvs8iERrJg14MmPO2pePhh2Ol63MOCElGVDeScZFRZg7kzFGqqYgXP9/T 0AjdIRFJ9CmJNx0AlsyFP3pvb7Y8ytdllYO9qaW9W0dooLRdNfRMpVL1UFtcPRwJJMLF oajhNiFy9lAczLz9dYli51xV+a8xD2YqsZKrg+smZsDFA9/TOutbDp0An1E/PUUyVi2Y tdCor5uHDOk51yShq702TH8uS362V8o7D/UJXxJ1a14Nu2ytiWKLPa8Fc/aBBohIju0a DOFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=uFNBuksRAUHG8SQKGfIMoqHF0ZeQIQql/Pes//0/1FE=; b=eCry9fgxbQWJyEMqP+6bdvKEPii07vugSs8tV0rp+6nwWDJdvII0jsRHjtzLSerJQu N/h5RkCam2KiUJMfNB0Yk/BIKFBi3ftZYK08sQkqANPZPAES1DYrT8PNOgmOG8aGsQ9i P75pI7AM3nVPL8etm+UExqXetEQfL+UtmPIwmuSL4rw0QG8YuNzurJg20dYzcxAKgM/B kvSHerb4cm+8D3ElgQfW4JBrhk8vJfVGu9G94k/yTMMoPvTv6YhD/NuxxeKnUSlYSvva Y0KhmUFWbzFrx8S3SyRP3gW++qUlkAOHb3RBYzEcRid0QgBYGGhJaUYrAy5Taf4vle5v K5hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p25ViQRA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a056870a69000b00101ab201826si11150381oam.253.2022.07.26.05.33.07; Tue, 26 Jul 2022 05:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p25ViQRA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238644AbiGZMS0 (ORCPT + 99 others); Tue, 26 Jul 2022 08:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231981AbiGZMSZ (ORCPT ); Tue, 26 Jul 2022 08:18:25 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D142E13F9E; Tue, 26 Jul 2022 05:18:22 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id i13so8372689edj.11; Tue, 26 Jul 2022 05:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uFNBuksRAUHG8SQKGfIMoqHF0ZeQIQql/Pes//0/1FE=; b=p25ViQRAGjIzoqbyw32XacT85JsM0ATOnc/aJ7f4OQUM+aio/Y993fmTKcDeocHCd9 Ip6z+1IDcK1emNmby8GCnHh8nTAZJOit+jilIBMN3MN8BHArbq5Y7jX0AdPoo5PJRGP+ qBAvo4C0uBT25Q/8kqgwUa9AThgrYs6OVHHMaOpyea8oHPpg79QNvmgM1Uz/oDBPwnAl AufVZdMZG9DZBf3rhJ84O3aYj5LM94YzLZW6y/dSBdJHdO6Du6+eIPe3NFTEc8T9fHX5 OTqmGMZhfJaXrcwzJtTP8MEOT5b0nUwAv/+Z19lTei3pSAbzl6AU10dk5npcBMsgvF/p dQxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uFNBuksRAUHG8SQKGfIMoqHF0ZeQIQql/Pes//0/1FE=; b=cNPpWFqrhdUYHBqsgEaKSBbbCWj+L+Ph7rG5Vg/7tJqlHs9dmJPxGmZAUZLAI3R4Ik LQNHuKIA+fNSCbYisXlsazusZ18iTXASS+Xw0fUFivYKXPm3I5ESHF3u6pVcO+Dqs5DX EzKjBjWvyXHgqqHff8Kqt5vRgEv0s93RtydqdX4/F7wWDygs95G/ytCu2dTC8J8sREI0 iWWz1brG+cEbncvzjLJ1Ep5lEVqRdHDDLlgqgiJdRBgxqSO9cB9XmoLOCPCc6NOFIjsJ eRBoOct2RcXQE9Rlb6hZQQt6x03vQpSpYdZWNXIw8wc49M3/zyIGiYbhFsGwcmWK84Ku GnEQ== X-Gm-Message-State: AJIora9udDXmKi0XUWumhr7oTYzH83T+bzAVHWjLznKPMo+0lGED8+7i KnuVjbACRyRoSw2A6Eg3XQwXUwwa4f0Au59k6rY= X-Received: by 2002:a05:6402:50c9:b0:43c:163a:4d5f with SMTP id h9-20020a05640250c900b0043c163a4d5fmr7812854edb.386.1658837901255; Tue, 26 Jul 2022 05:18:21 -0700 (PDT) MIME-Version: 1.0 References: <20220722102407.2205-1-peterwu.pub@gmail.com> <20220722102407.2205-12-peterwu.pub@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Tue, 26 Jul 2022 14:17:44 +0200 Message-ID: Subject: Re: [PATCH v6 11/13] leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support To: ChiaEn Wu Cc: Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sebastian Reichel , Chunfeng Yun , Greg Kroah-Hartman , Jonathan Cameron , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Guenter Roeck , "Krogerus, Heikki" , Helge Deller , ChiaEn Wu , Alice Chen , cy_huang , dri-devel , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Linux PM , USB , linux-iio , "open list:FRAMEBUFFER LAYER" , szuni chen Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 26, 2022 at 1:46 PM ChiaEn Wu wrote: > On Mon, Jul 25, 2022 at 4:41 PM Andy Shevchenko > wrote: ... > > > +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