Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4045153pxu; Mon, 21 Dec 2020 02:55:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0oEm/+YCyp+zu7jZgE+oFNFAJw5gZqpMcgdZTBZpkQ1G0l7qS0mMJp0Wivy+z2Twlm9iO X-Received: by 2002:a17:906:edc2:: with SMTP id sb2mr4854002ejb.159.1608548117419; Mon, 21 Dec 2020 02:55:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608548117; cv=none; d=google.com; s=arc-20160816; b=bk6LUHCKA6u/fqzZ4HcXGvR4yyNtcMUjNbl4aeo5O/E3eLhF7xIBX/MdfGMrQEC+Rx wL6XlNaafJG0+qy5eRddZ6V1L/s1/o7qTIVpInQV/HjPVd6RCo2MImMOUxuVL5r09eSk UgQyPkuATp/nFD/FkqnPYwODtrf32h5vyoLphJhhPYryPIa8/2zkuq8j06lUGd1jgpr4 OKyiV1QAhq8F1qXEqC4/IYwbAUzo3snHa1WSvsdOLgy/DD1Top5/ZCJomG3z1THFln0U g6vvlVkMeBi1JzavnbJS9zd4reMbcvaIX7dASgUQGW3Wfybf1b9hR9fF4jXaTgLeDlGk aZUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=4grD7Th+x9uvL3+IHonwI2oI5c9zZZYb+5MfV4KDZ/E=; b=rQcBVF5j1lYG8E0uIVIJNCqnXODdFqI3l8TwSqJIVWM5UED1HNXfv1CMXbwx3JDdC0 o1BQoMHxZ4ZB+2/DpL+pHGWm+ObV+dgzpBeToXt9GxR1SGRYppPdpyQuVsebunhq7WCs hC+3hpom/ZcoSvrRJZ6X9mZMuG2CqO7Ofsc90M3LuXFzO2Z+h0izvJM4AP4BPTDGObzH 1q9CPgalRTRCLngnRIuEOeXM/Asw5gN4xkBzfIObVvnVuK0y6vHCQMr/BEP91754p+WL l0hDBQcAvD/J4Br5fG+OWudJQOQGSi0NdjaKJjNT1ExbSzHuNegZ/CiTdsAOcW9lvhh3 lneQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OuyMMqDu; 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 l11si9815818ejx.183.2020.12.21.02.54.54; Mon, 21 Dec 2020 02:55:17 -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=OuyMMqDu; 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 S1725968AbgLUKwZ (ORCPT + 99 others); Mon, 21 Dec 2020 05:52:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbgLUKwY (ORCPT ); Mon, 21 Dec 2020 05:52:24 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC55EC0613D6; Mon, 21 Dec 2020 02:51:44 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id z21so6135281pgj.4; Mon, 21 Dec 2020 02:51:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4grD7Th+x9uvL3+IHonwI2oI5c9zZZYb+5MfV4KDZ/E=; b=OuyMMqDuTq2byb20apbddLdGFxSeRNXUBWUDt7ZPrUCwmfuGJvSwkqN3XHSILxNH5o TgGkd4Uv/Acian7iXIwlICc3cI1kiRYP+DOPyoNWCvIu/CQm56a9h1q2tpGWPDOu/IR1 NL+HuhEgYD+cRXwayONn9n8WDTXYu4Y6EZ/26Bzt04piTgCKQ1T7IZXokLQK3ca6eNQn GtJ97so95DVzQh4a7Noop5WBYganYhbd0hsB2qvghEfFTkcLA3rZGlmAaIxJByLmYrfD SVknbsZ3+W/IxipsBjJ0p7Eess1TigPDPJXzQiADFUAHUXa5lMmY7C4Wi7clzgByZcrA oiiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4grD7Th+x9uvL3+IHonwI2oI5c9zZZYb+5MfV4KDZ/E=; b=CScE/81cJnSMQLsszueF+Fd4EeaWMLSnsdYMlxAAnsPB5vD0Rb1HtIiqwXXD2rDkD4 MxgF4c3mefrsbsmW3Ln7VvFt3yYN8rVXkpnJ8nD/f31vuZs6XKy/QUqA1Wc+LbH94VSJ by8vEIH5cEf6kpcQXhR8bsEijU4I8nGxk7VCpVR0OiZr+flh6ULQhIpXONnrFBQl954j D9ZFYA+TSu3aON5VbjfSTDsXMM7sbZINUC9x1xs7GV3TEdEEOxJNTx1EURqdvdg2Mbbw Rqn/KBUsbUgv2X9/0tcB6YSfwfHBDJyANN931O/r9eyQ1RlqvxSHkxJ+Z/22+JgNyWfc Z8EA== X-Gm-Message-State: AOAM533kEDjDlCAm/RNjO52ZDyTbmsTRpiTeSFZ3jVWRGDn1fMMyzjyv gzu8LfLifCohI+W++APNeZA= X-Received: by 2002:a63:e108:: with SMTP id z8mr11633102pgh.363.1608547904359; Mon, 21 Dec 2020 02:51:44 -0800 (PST) Received: from localhost.localdomain ([2402:7500:469:a113:4308:e075:646d:7374]) by smtp.gmail.com with ESMTPSA id p4sm15364193pjl.30.2020.12.21.02.51.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 02:51:43 -0800 (PST) From: Gene Chen To: jacek.anaszewski@gmail.com, pavel@ucw.cz, robh+dt@kernel.org, matthias.bgg@gmail.com Cc: dmurphy@ti.com, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, gene_chen@richtek.com, Wilma.Wu@mediatek.com, shufan_lee@richtek.com, cy_huang@richtek.com, benjamin.chao@mediatek.com Subject: [PATCH v13 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH Date: Mon, 21 Dec 2020 18:45:50 +0800 Message-Id: <1608547554-6602-2-git-send-email-gene.chen.richtek@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608547554-6602-1-git-send-email-gene.chen.richtek@gmail.com> References: <1608547554-6602-1-git-send-email-gene.chen.richtek@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gene Chen Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH, and move the same registration functions outside of #ifdef block. Signed-off-by: Gene Chen Acked-by: Jacek Anaszewski --- include/linux/led-class-flash.h | 42 ++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flash.h index 21a3358..612b4ca 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_flcdev( 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 class with * init data and with support for flash LEDs @@ -98,12 +99,6 @@ int led_classdev_flash_register_ext(struct device *parent, struct led_classdev_flash *fled_cdev, struct led_init_data *init_data); -static inline int led_classdev_flash_register(struct device *parent, - struct led_classdev_flash *fled_cdev) -{ - return led_classdev_flash_register_ext(parent, fled_cdev, NULL); -} - /** * led_classdev_flash_unregister - unregisters an object of led_classdev class * with support for flash LEDs @@ -118,15 +113,44 @@ int devm_led_classdev_flash_register_ext(struct device *parent, struct led_init_data *init_data); +void devm_led_classdev_flash_unregister(struct device *parent, + struct led_classdev_flash *fled_cdev); + +#else + +static inline int led_classdev_flash_register_ext(struct device *parent, + struct led_classdev_flash *fled_cdev, + struct led_init_data *init_data) +{ + return 0; +} + +static inline void led_classdev_flash_unregister(struct led_classdev_flash *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 0; +} + +static inline void devm_led_classdev_flash_unregister(struct device *parent, + struct led_classdev_flash *fled_cdev) +{}; + +#endif /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */ + +static inline int led_classdev_flash_register(struct device *parent, + struct led_classdev_flash *fled_cdev) +{ + return led_classdev_flash_register_ext(parent, fled_cdev, NULL); +} + static inline int devm_led_classdev_flash_register(struct device *parent, struct led_classdev_flash *fled_cdev) { return devm_led_classdev_flash_register_ext(parent, fled_cdev, NULL); } -void devm_led_classdev_flash_unregister(struct device *parent, - struct led_classdev_flash *fled_cdev); - /** * led_set_flash_strobe - setup flash strobe * @fled_cdev: the flash LED to set strobe on -- 2.7.4