From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0947C3F6B0 for ; Wed, 27 Jul 2022 10:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbiG0KEj (ORCPT ); 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-Google-Smtp-Source: AGRyM1uwEejs5nDWqG+s979XFdwYwQmE2ZsEpW0n4nQQ7TCJsCqlYSNktlo34cJclnigei8K3rZk9qCXUcGHByv5Ilw= 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" Precedence: bulk List-ID: X-Mailing-List: linux-leds@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94140C04A68 for ; Wed, 27 Jul 2022 10:04:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA487C4542; Wed, 27 Jul 2022 10:04:38 +0000 (UTC) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by gabe.freedesktop.org (Postfix) with ESMTPS id 93251C4546 for ; Wed, 27 Jul 2022 10:04:37 +0000 (UTC) Received: by mail-ed1-x534.google.com with SMTP id z15so8934765edc.7 for ; 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=lHax0NMtzAJkVw7163yJ6I/lKZ8yjARgOWEUrEPD/wP8dPATM3GpHBxiWuQkKGBfWp 76epGyf5wkifbhrvCEmIBlRa4viGuljgi85c/2fmlLunBG5YaDcikn9q6OzgYoDJfPan dlN1ZVMMLRTXKUE+NuHb8PV73JKjh/RRv17HV/W6Lc+SyEEP7+ofVtEdKFlx+ew0dEU+ tK1wYvkBIj5o98EE309pDdMnJvV0ix7NltTwz8pbosAOo5k1Bure9pdzQ3CM9BC0bI2/ mkxgIKimgjxHXXi6FE7e5DK/QNS6tw3WJUTAHTLYCyRYzo8tfGh96Zd5y05QoCsEp8Y1 dUjw== X-Gm-Message-State: AJIora9q4AfxCKGeGLyUEc5wkrdSGhZPbKkLjEyVooR7VELAmmtCog+s 7l/Wu5GZSFhGOiUBgnIVAKNOmYlWtfrk8xfW5Uc= X-Google-Smtp-Source: AGRyM1uwEejs5nDWqG+s979XFdwYwQmE2ZsEpW0n4nQQ7TCJsCqlYSNktlo34cJclnigei8K3rZk9qCXUcGHByv5Ilw= 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 Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:FRAMEBUFFER LAYER" , "Krogerus, Heikki" , Krzysztof Kozlowski , Alice Chen , linux-iio , dri-devel , Liam Girdwood , cy_huang , Pavel Machek , Lee Jones , Linux LED Subsystem , Daniel Thompson , Helge Deller , Rob Herring , Chunfeng Yun , Guenter Roeck , devicetree , Linux PM , szuni chen , Mark Brown , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , linux-arm Mailing List , Jingoo Han , USB , Sebastian Reichel , Linux Kernel Mailing List , ChiaEn Wu , Greg Kroah-Hartman , Jonathan Cameron Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06725C04A68 for ; Wed, 27 Jul 2022 10:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6+Teo1rcIxQcV9bM+Cl1689S8tIWa/b7uuYaqzSGwz8=; b=fsnbJ/YOz0munZ 4mgfezH5Ulgq3K7xlEPbHq8Qb/zSbtuikNp1I7RsFm6V70+YwpS8t0qovS/Tou0PmQe626hh8Ps4N 8YTqthuHbPAYKuK/gwYAVPoW9a1kzJgm2nws2iOj3MZGKPW8JW0E0V6DZImY4XJdUG+vOBjl0+mXy pttdpF8MYJHKAxed6GhHkysCUo890Fbo3hxaY+JoBYb20QW180lyMBkHzRfBWvtN4vpNVw35PB3Mb np6KZq5k4Qona53gGcfqH1eUwUXNcqJshX3Y32ESvl7FxoF4fgndAtH9b4UIHq+brnOhcAbC5sGvQ GYpDynmPN4h6SByZmt5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oGduE-00C9K7-KL; Wed, 27 Jul 2022 10:04:42 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oGduA-00C9FG-RF; Wed, 27 Jul 2022 10:04:40 +0000 Received: by mail-ed1-x534.google.com with SMTP id w5so8314560edd.13; 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=x8lyF4jKAnKIXAX95vx19Ymp274oOEsBZzt8aPG7VzbW1D0mjseA81YVt9v9qkhprm ppiVPzxo4dKajhILrzHGEvy41xy4d2zOZC/00T/zbdFZr7BqciVSXVJ51AYIOI7BOpfA LeqNDpon85qkA/8EM48Z/wrRmQ4JogrcKLedoueyQ5576DVj0HvZcSNb41WA8E9t+2oe pUdQt8X7skBoWRWaIBvdWDiX6A203dPZrLsK9tOktCGsMtmenTJO8L3mFKBPN9RsEZWu sCd7RpUmz7kREmFGrzGq2Ln8yhnhsOwFZi/b0JvFBr65oytQQci1E+fcPKqpD5kT2pdl Ed6w== X-Gm-Message-State: AJIora9Lb0UjrDRpupNkfXt0mQJC5ubXRNgWa1dOurEvUYgA4Bppe6KU 9yJs47EN60wT6ajenhqBpe1uml8NYqCYR3MHazo= X-Google-Smtp-Source: AGRyM1uwEejs5nDWqG+s979XFdwYwQmE2ZsEpW0n4nQQ7TCJsCqlYSNktlo34cJclnigei8K3rZk9qCXUcGHByv5Ilw= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220727_030438_912440_DFF3F700 X-CRM114-Status: GOOD ( 28.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel