Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp108585imn; Wed, 27 Jul 2022 00:45:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1th0H63T8VHysP4qZCogLwvIu+uPFe3FwUBwK1CT3vfB6WRJIgiU9MqtU2/oNCSRN0iekGp X-Received: by 2002:a05:6402:3217:b0:43b:dee8:4cb6 with SMTP id g23-20020a056402321700b0043bdee84cb6mr20391543eda.157.1658907943954; Wed, 27 Jul 2022 00:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658907943; cv=none; d=google.com; s=arc-20160816; b=oBbTaHtS+ufngFiskuvaOKrvmTlz6iKEhw/4kNT8ZEO0VyLOAaJFM4gQ+WdAsCl+zq LGYvgSw2VU3CJFrkt33uU5EO6DNHU9K/AGZ8W/G5GkwYeJ0VZAKqZ/HPH7Gsg6+gI8s5 fBAyzAUzxWhhRxhoXeBMBuW+HsxJO0fpqSVInopZEArvNrIeiQvUmhtCUmixQvrleuBb PhJxPCysXdaJcbK1Xcriy8IinJ4u22SG8T2PsymzBC2vh1Q7sMp7FCgJ/Zz+lbshxGeV GGd5Es9wIt/mLT0BOIBx/1FB4Bv03gec8RKkQIrbuR8rM7qOrzjHWZ/19oayiGR6fuXx /Zsg== 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=7wBtopi5nrrnF3/tK6d3mUXKRzW2T+DIHWRi/Z/g55U=; b=Ko3ylkUklJ0+LHL7KC0MHYeDRDzWVEQMrB6/ZoN583jX60iRbHu7vfkD5+dTyfVFGs gRp8KStgcdrO58DoGmRFwzGdlRI5PJNYLn5FwWYR3VLT6L4uqKP5i+OFWq3/YpP9Y7fQ SpDGsX7PwXQ3zkDzWp60iaV8QL8uL/Wm8/vwsslAsU9ecSUAXONbW4U8bAq6sJJLN6YS DkexCCBXDaGeUPKuRUA7hziLPCBI8H9qm9/n9DQHtW6c8orBrHa/tETfPVreVtev+dss cPQ+D/U8Rl0f2hMubeqJv8C812y1hFLTCoEaaXHUP0hWFUK8OWMmM3MkjyZeF+FFfvCL TUUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JrXv07Sn; 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 dk14-20020a0564021d8e00b0043a10e5e81asi4382747edb.66.2022.07.27.00.45.19; Wed, 27 Jul 2022 00:45:43 -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=JrXv07Sn; 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 S230388AbiG0Hhk (ORCPT + 99 others); Wed, 27 Jul 2022 03:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiG0Hhh (ORCPT ); Wed, 27 Jul 2022 03:37:37 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D27D63B950; Wed, 27 Jul 2022 00:37:36 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id y9so12106192qtv.5; Wed, 27 Jul 2022 00:37:36 -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=7wBtopi5nrrnF3/tK6d3mUXKRzW2T+DIHWRi/Z/g55U=; b=JrXv07SnypKXIiO9c1hDaO1ve2XFoCQh3YJA9N0xzJ8VKdcy+NOWbVByEfE93yA1bT Tl79vU21bY1Riyh5vdmQjiXNRM6Y+lisVzjlFGA12N5TkfsJVvBTZVM+DXhLMCRLgtAT CWazI0B5gaYgTPfT/LBhBjVu7eM5hrdl/RUhg4FDmsUWR19oAbFy6HoE9edFHPyenD8T Qf2WPKI/e5SPnIeUMPrpopEK3VVMRKkcz81I6LE01vsC+va5BFGobzRlWIltgg+x4gCQ EHVJv70L2zauSaiZEF5yiD6RME26xNIBHXc93G+wfeZxZyIdgW4ZKl6QFkorqrFDfTKD 6LhA== 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=7wBtopi5nrrnF3/tK6d3mUXKRzW2T+DIHWRi/Z/g55U=; b=6Jat2MyN2X/bCcy4KChsFEgToktjw+TM2nIp1GsWV6ZzmD6Rvuyrj1WVCZLEay7Yy8 q74Yij3pzdIaz/b3Dx1814Y7F7SZ4G/HV33u1NUwo1HFCib9KKUGzmTEDTFzeUjfU0Bs QX31Xn8Ix8XeXydaf8AcdSF3TvwfwPs2BaLCmimOEG8poqkdfChiJgGU3sbSMzaEOAPp tjrZy4no79UXKPkp/eBai9E81Hw5Bzcf2HNvuOYOYl0cPXcPSChnTM9IDK5Jn7McZXoP xHO/bCA9YNSGqGzehOVJ5hVsFJnBC1xruUQWUOhNGDVuRflhxLBmPlRaFHVf97VUhQHe GsuA== X-Gm-Message-State: AJIora+ycXd0R3vO91GJKaKDVU9HJPaB0TnRR6u89peGwkCT5WgXMS1m XRVpcxeT3Rf2n10XEOj8napxn7O9AWFngkOo0UeP0b2UjH0= X-Received: by 2002:a05:622a:6098:b0:2f0:f0d2:b5f0 with SMTP id hf24-20020a05622a609800b002f0f0d2b5f0mr17361865qtb.583.1658907456035; Wed, 27 Jul 2022 00:37:36 -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: ChiaEn Wu Date: Wed, 27 Jul 2022 15:36:59 +0800 Message-ID: Subject: Re: [PATCH v6 11/13] leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support To: Andy Shevchenko 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 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? I will add the proper comment here to describe this thing. I'm so sorry for misunderstanding your mean last time. Thanks again for your review. -- Best Regards, ChiaEn Wu