Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp186937imn; Wed, 27 Jul 2022 03:37:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1udY+IAmrCjRiFZOjW8gLVYc8tB5Z9wnT9yi2WwGcniBTvxb3BamUnoOaNRiGXdyACqomgE X-Received: by 2002:a17:906:9751:b0:72f:1b36:e1de with SMTP id o17-20020a170906975100b0072f1b36e1demr17533795ejy.451.1658918257779; Wed, 27 Jul 2022 03:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658918257; cv=none; d=google.com; s=arc-20160816; b=HujyCGpY/G1f8/I0vaqj6xjhLRi2ECEw6Yu3ZOIFIyuD/YVYoLXTq53bEGHrhduCfg VJU2ghfoiRyxGtQKSRWxQHiy0xfQCqT+UTI5cVeXcB0P4PakDDR/R7xAIFT0abnDvwz/ h1Ym6C88JXUktlbf4CYG4UptW1BzfPp7ibiWzyjxfOHVQNC62no4up+YZb4pR8RGm3fx kC8quW5q4ytmADpp/WzRVrfRxEUYqCYw0pIpFdLmLvViYQkBlNGdYglhBRamXSLZL9gI dU0k7j58vJY6j2tMChN+42k6jCwbhh3LpAAM31OQkL6hRPyjQnjkDV4equZKYUmHK0ky mn0Q== 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=B+itH6nCjnZkG3yJTUkgH3T3RkzlJIEijujwFkNTeHs=; b=iaGfb27je9L17ostgo9seQASCUyZMc9wq1SP914TtFpGHc2zBMK9dBfnG+//IZlNai /4UyYdh76tRzcSnbhj9G06tqAJp+VCKU7P+vl896aeMtZOYSP4izKSNLPMg7slpihDGR 4D/5Vc2PhQy5EjwKaYAsa3vS3C2Mz+afMs3bP/wjgVKrzOyU7Hzb//FBwJfkI6whRpDr xip2Lnm5jbNO7RfjGL4227h/20RsQpVmbl2ZGI4RkTE+m/FCzMJYWnaczpmO2tJ2BRAN 8kF6W9EIV3DmDG/Fh+fLI98nYYqIKLsF+hmmlgCCDYzEuVgeALNROR+NoS2zJPoEx4w/ RV4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="cG/IRfZw"; 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 j29-20020a056402239d00b0043bc859f01bsi16831726eda.186.2022.07.27.03.37.08; Wed, 27 Jul 2022 03:37:37 -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="cG/IRfZw"; 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 S231358AbiG0KEj (ORCPT + 99 others); Wed, 27 Jul 2022 06:04:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiG0KEi (ORCPT ); Wed, 27 Jul 2022 06:04:38 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8503D1707A; Wed, 27 Jul 2022 03:04:37 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id s9so1513421edd.8; Wed, 27 Jul 2022 03:04:37 -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=B+itH6nCjnZkG3yJTUkgH3T3RkzlJIEijujwFkNTeHs=; b=cG/IRfZwWO83wiK8SoAZgFegp/oSsSTdk6uMQXsyEzBbyDQ15vq0yzVYGG9pEdfz0Z ZOOouCQXEYxdPO6EleD7jGQocetQsqrcx2C7y57nBleaH3XWNh/p9EZXeeMxomYeea0n ccGpQbPM3KyJhbgX8FqfpXge+UD+lyXVuyBlv7AUvzyTYioFKkLUVdtqpGd8x6O73yOd o3BHcOkkAf6zj76YWhjS7ePObKwBxNP5KslRU9Zg6sRbYapoWTeSb3rLO4m4qR/dd5mY Xo/AD9faus7q33rPJGp/5b3BvXu4+tVOAzawSfBgIW64yo4mi098uiZmqwCRYHPukGG4 n1TA== 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=B+itH6nCjnZkG3yJTUkgH3T3RkzlJIEijujwFkNTeHs=; b=WZvdnm+5h1mw7E7184OppTLgdI+dpROLmMCyx5DBGjK/s80lN7hvcVQI+oj4ijVu/Q U4dDqaslZPcIQSTZTNBqHNyt7PlVm51pJDfIFXczr6RwYbT0QHOvS04HopHySpRF5UCq 9c8dP2KT5jWGqgSq9Q9C04l4sp7OzPGptXAsbRD04zI/TV//5afpOaB1k+CRyfw/pUre bC1L8TGz5SzKC7rm7Fga6ocYtemAPWsqUcgc62QBKsh0cJVAuTnYlWsXWvnbysMBOi/L 6fwPu65OLjoeDnX9yCYsccd5hQMQ4zmMiR/jV9lHcNxucQblpkj6aAxQh0RHmBtdb7Dr VzbA== X-Gm-Message-State: AJIora8gA4iaqKaVRMNGG8fVnCyEJHFxIQO4B38XkaQtAB3q4kbM+SkH l5KStbo1QYRQPa3HInvHJTaz5Z1pCP6Cg2eppd0= X-Received: by 2002:a05:6402:501d:b0:437:e000:a898 with SMTP id p29-20020a056402501d00b00437e000a898mr22474219eda.265.1658916275876; Wed, 27 Jul 2022 03:04:35 -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: Wed, 27 Jul 2022 12:03:59 +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 Wed, Jul 27, 2022 at 9:37 AM ChiaEn Wu wrote: > On Tue, Jul 26, 2022 at 8:18 PM Andy Shevchenko > wrote: > > ... > > > > 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. > > > > Ummm... from my understanding, > if the colors of these four LEDs are set to 'LED_COLOR_ID_RGB' or > 'LED_COLOR_ID_MULTI' in DT, > their 'led->index' will be set to 'MT6370_VIRTUAL_MULTICOLOR' in > 'mt6370_leds_probe()'. > If so, these led devices will be set as 'struct led_classdev_mc' and > use related ops functions in 'mt6370_init_led_properties()'. > Instead, they whose 'led->index' is not 'MT6370_VIRTUAL_MULTICOLOR' > will be set as 'struct led_classdev'. > So, maybe the member 'index' of the 'struct mt6370_led' is what you > describe the information of which field of the union is in use? From this description it sounds like it is. > I will add the proper comment here to describe this thing. I'm so > sorry for misunderstanding your mean last time. Yes, please add a compressed version of what you said above to the code. -- With Best Regards, Andy Shevchenko