Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp554263pxu; Sun, 22 Nov 2020 19:24:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEyQtLBZ4GF292E4ncYpumLhxBWrF7ISJU29Dheo8TqwiS9eUJg4nYIn8GhjlWTO5s+GXC X-Received: by 2002:a17:906:dbd6:: with SMTP id yc22mr22505117ejb.252.1606101853603; Sun, 22 Nov 2020 19:24:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606101853; cv=none; d=google.com; s=arc-20160816; b=Y3opxbG5Lp0TMopbAi5ZO1ldjmpzQ8N4fMwmA5a7fok7Iu1ckiVRNNV1JT5PoQjv6M ZZeJzVEXXIhvw7vdhbg4a+agRR6/IugPGuAZAfISeJLlXdGhJLKSUUiNcwe0zeG2FD0V 9+1/fHZKFaxvzrw/8+oGcSF1A4/60iTM/vngx1WT5sucpsILZ2bOOjTPjFDG1/IVa2Uh GbwR7dRnI6tOvJ00lCXTM5iEg2xF7WzIRZVbPCdd2/ymVMFYAgeiND42QkhOvkx/pYsJ c9+ntDR+FYyzTN873PMoyX0FV+/yYEvjfa0/J16tsJi6AT9eUoELHF+QI3hZFqyQDUMf 8KtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=rmUZ/LefwZKjwq5aooyNQE4MC8myDjdpN3Ckl6d1zcs=; b=tPS3SeQlRFdppcZPTOWTwGzVQbTF4LrIyUH2JCohX4EiRfs7JAvVS66T7wd3y+RY/F qgVQAyrUhh23m4GxyxX/6mHBA8DfSIISBKpWUvdkdEqewFT33fAwnbZTscc7b5SG+E41 TTTtJtxRNf7gena8y2WaVs5BwzguRl+8hl3ZDTWJKhDT8/M41KgrK8Pl/vBaD0BTiUvi nWslOE7VEhw6CdhXhTFQREv4CE+QkSe8S42Y7VhHPYNOBtc6znO4P4H3S77LNIWJcB/M h22wMmrIf/0cHufZ0rF4m51zwTN2q9aHm9+X8x/fv63zJa07mjzinVbbjtSALtA05a0+ sKyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oEv9koOs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 1si5766808ejy.385.2020.11.22.19.23.50; Sun, 22 Nov 2020 19:24:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oEv9koOs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727557AbgKWDUO (ORCPT + 99 others); Sun, 22 Nov 2020 22:20:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbgKWDUN (ORCPT ); Sun, 22 Nov 2020 22:20:13 -0500 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D8A8C0613CF; Sun, 22 Nov 2020 19:20:13 -0800 (PST) Received: by mail-ot1-x341.google.com with SMTP id 11so2104897oty.9; Sun, 22 Nov 2020 19:20:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rmUZ/LefwZKjwq5aooyNQE4MC8myDjdpN3Ckl6d1zcs=; b=oEv9koOsTJ2WOd46od2F9FFUSIWNHZbckGQwAdsWs4zZMift70bSlIYBmW6NcPSNFI XpztoiWYbYV4m3jqG/OSoeB49QZPVIVn1jiLAcm2csSnc4bHTOWrW8d453rNs0noabG2 N9o/EKno/E5fZ+6BIt8xTEaw/LaiJtng4+KFNXdVeBgw6zS+hb6qvK+adFKA6sIt8QFx jlkzXUFzQYGTCQkjDv/FNFx2zTgvGDOeE7Gat+aUkF8/kdRpzB6wC1M6749W2c9E+2D3 nneZ9pEgN3CQxCAfAxeHc+2iJk4t+dxHC7/BX/8RZXi3VcnoAF2F5Y6xD2e6y3z/QGlu 5s2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=rmUZ/LefwZKjwq5aooyNQE4MC8myDjdpN3Ckl6d1zcs=; b=ToZQ+3B9i90jH7uyNGAjC0X3KspVDwxZWTHpWCJDouF7YS5YsebPhg8I/pmsNmplsF bASPKJ39pefGQsfpfvXJRG0I5UBZ/vPYKiaz4ME77fYYbzYKKNG3C6C3klZe9zVkiNh4 x4clRNeyQ8IxPJZq9AUZBP5WrTsH1Mwd42YFqLR0jUuXUkGaUzBJjeB/rNzVpcfeRezJ 1E7P4ZQ7TX6DKIx/gB9N4b2aj1NAUK8u4Cbznu9cW3Hyd/lBOS40swIqcPtfYJInDT5g ig5z+toyKDoVcZRjCbh3m2TycvhRnSdb61OXYv2pAklX4TGUuyW2APcd/E7Z6FYiBnCF yEeg== X-Gm-Message-State: AOAM531Oh+DuLHrndtuvsquRNY8HOz6XHt4zJmcW1lUYMhpxBaFo88g2 NYbHDf3QctRNefaZyO5nVqDLxJanNHuVHNWxzzwozvr3 X-Received: by 2002:a9d:6c99:: with SMTP id c25mr22827600otr.327.1606101613081; Sun, 22 Nov 2020 19:20:13 -0800 (PST) MIME-Version: 1.0 References: <1605696462-391-1-git-send-email-gene.chen.richtek@gmail.com> <1605696462-391-2-git-send-email-gene.chen.richtek@gmail.com> <3164b1ed-9e47-88cd-d492-ff5a9243e5ef@gmail.com> In-Reply-To: <3164b1ed-9e47-88cd-d492-ff5a9243e5ef@gmail.com> From: Gene Chen Date: Mon, 23 Nov 2020 11:20:03 +0800 Message-ID: Subject: Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH To: Jacek Anaszewski Cc: Pavel Machek , Rob Herring , Matthias Brugger , Dan Murphy , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Gene Chen , Wilma.Wu@mediatek.com, shufan_lee@richtek.com, cy_huang@richtek.com, benjamin.chao@mediatek.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jacek Anaszewski =E6=96=BC 2020=E5=B9=B411=E6= =9C=8820=E6=97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8A=E5=8D=886:29=E5=AF=AB=E9=81= =93=EF=BC=9A > > Hi Gene, > > On 11/18/20 11:47 AM, Gene Chen wrote: > > From: Gene Chen > > > > Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH > > > > Signed-off-by: Gene Chen > > --- > > include/linux/led-class-flash.h | 36 ++++++++++++++++++++++++++++++++= ++++ > > 1 file changed, 36 insertions(+) > > > > diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-= flash.h > > index 21a3358..4f56c28 100644 > > --- a/include/linux/led-class-flash.h > > +++ b/include/linux/led-class-flash.h > > @@ -85,6 +85,7 @@ static inline struct led_classdev_flash *lcdev_to_flc= dev( > > return container_of(lcdev, struct led_classdev_flash, led_cdev); > > } > > > > +#if IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) > > /** > > * led_classdev_flash_register_ext - register a new object of LED cla= ss with > > * init data and with support for flash= LEDs > > @@ -127,6 +128,41 @@ static inline int devm_led_classdev_flash_register= (struct device *parent, > > void devm_led_classdev_flash_unregister(struct device *parent, > > struct led_classdev_flash *fled_c= dev); > > > > +#else > > + > > +static inline int led_classdev_flash_register_ext(struct device *paren= t, > > + struct led_classdev_flash *fled_cdev, > > + struct led_init_data *init_data) > > +{ > > + return -EINVAL; > > s/-EINVAL/0/ > > The goal here is to assure that client will not fail when using no-op. > > > +} > > + > > +static inline int led_classdev_flash_register(struct device *parent, > > + struct led_classdev_flash *fle= d_cdev) > > +{ > > + return led_classdev_flash_register_ext(parent, fled_cdev, NULL); > > +} > > This function should be placed after #ifdef block because its > shape is the same for both cases. > > > +static inline void led_classdev_flash_unregister(struct led_classdev_f= lash *fled_cdev) {}; > > +static inline int devm_led_classdev_flash_register_ext(struct device *= parent, > > + struct led_classdev_flash *fled_cdev= , > > + struct led_init_data *init_data) > > +{ > > + return -EINVAL; > > /-EINVAL/0/ > > Please do the same fix in all no-ops in the led-class-multicolor.h, > as we've discussed. > I think return -EINVAL is correct, because I should register flash light device if I define FLED in DTS node. > > +} > > + > > +static inline int devm_led_classdev_flash_register(struct device *pare= nt, > > + struct led_classdev_flash *fled_cdev= ) > > +{ > > + return devm_led_classdev_flash_register_ext(parent, fled_cdev, NU= LL); > > +} > > > This function should also be placed after #ifdef block. > Please make the same optimizations in the led-class-multicolor.h as you > are at it. > > > + > > +void devm_led_classdev_flash_unregister(struct device *parent, > > s/void/static inline void/ > > That's the reason why you got warning from buildbot. > ACK > > + struct led_classdev_flash *fled_c= dev) > > +{}; > > + > > +#endif /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */ > > + > > /** > > * led_set_flash_strobe - setup flash strobe > > * @fled_cdev: the flash LED to set strobe on > > > > -- > Best regards, > Jacek Anaszewski