Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4579883pxu; Wed, 9 Dec 2020 23:24:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1tphbqndeFW46LdyY/4XSN3sVC+ClR7El4Nh6qGUldxBfeuxClky7v7VToqUSWakJsBYM X-Received: by 2002:aa7:d75a:: with SMTP id a26mr5315275eds.230.1607585073276; Wed, 09 Dec 2020 23:24:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607585073; cv=none; d=google.com; s=arc-20160816; b=TtgpX5rBmbUnRlqinvI37k9396nt1755P7hZd0j52WTtUYhxZ92iMTNjEudcB50/LF pmQ5097YPzJm3e0hOafByQ7Td707ShIZYT2gqDJTNSyEujqeWfOjMM3UiR0km8GaHFYC b0Rqg3/dFnxoWFK7iqOtMueU2O8k150eosGOlj/xvFYNrZM5d01wRTH/UiQlqt0L8/Xf RCEaNcvoNDZ/j7ZPC3akosuTZbrSI40FG/2wS5wQKTRBpBzqtKfLXNHp5+xLSPbjaIrX QjFY+ujq8Fvx2mqwWXCCbuZ4iM8GI2k82uIq4dcBIsEBvt71x1WvfQyqrWY0PNqdc07o zqLw== 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=k28J2jbSx0LWGRCq5sfHmPURKoHkUqf/hVUqIJuLkazbFCqrgRyYfBx/L9SHOjVYGr +xa5mbcVBZ5PN3L+E5cfzSe2sAoUoekozKdUPgp8r7bBXdb5vS5r00Ny/TDaz+k52B/G DOtUu9aCnl/HZczSRxfbD/JEWTwDOjYIx5Td2INH+BIL98MwnnBvURXYjGS5Dg9dWDHe OxXybwRppZJ2F4PImsSgtbTd93JnC+Qdmdcq9D9s2kUxkAfW8EKECqbgByqifEX6kIiu XopINiQvBNz8RkpZ6GEJUXAhKOEVKUalhfOdpUPQAQbYbaxrU+AD9kVtoA1KA8+wuw9A u4jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gkGXerWD; 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 s11si2298361edy.18.2020.12.09.23.24.10; Wed, 09 Dec 2020 23:24:33 -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=gkGXerWD; 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 S1732920AbgLJGCl (ORCPT + 99 others); Thu, 10 Dec 2020 01:02:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727004AbgLJGCZ (ORCPT ); Thu, 10 Dec 2020 01:02:25 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A1D4C061793; Wed, 9 Dec 2020 22:01:45 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id d2so3035459pfq.5; Wed, 09 Dec 2020 22:01:45 -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=gkGXerWDDA3tvkrgZg4BEvG6viwI789Ynn/xm8OyQRtkugou/GXF3z6jdSCs8NVC/r 8uRz9LBLxUo5h+hIXOtWHxE4e/6Ur3IR7gBJ4Kf8BIhFHAtbuI82xZdANjhSLZmgtyZq zl4I0Hd7TpXPMlAiD01D+NC1oiuQGSdw01MPWXMxG1KGTgQMe024aTf/+YP9LISI9biS C7rR64jMWalq2oT+eW2rCCC2r3p0vre11naZkAYNPMp7H45tiODd2yWgyG9+owJ945h0 UsknU8PBZeeM+binvxaOpN+7JZIq4RUj3Cwvt9grVH3pwUa5SJc9ZJSZfgzOP+nYArsf QsIg== 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=Pyc5GN4ZyyElz6/kC4YkXY1lEUrXAoUZe/Lw4REnbDVxIr7A0BUHPcX6MAnRdInEN1 K9Q5lLAfKj75oPrXiq2M5scrduOjZJ1tPHofQ8ZxCPdjCHC+aO2pxTc5WQt5uU1/yiB+ Fq5YbJMrkv8q/ewv2VKzYXmV3A3rDwI/Jr/fV72KI1GPm+IerVX+AUPEpb6T+l85xPaG 5iLbe/NbjM59316/QR+GGY+QWuwMZr/BbktE1ikM4c61O7MWdoU82Ty/obpeacycdAeI aNeOhe9qjzAJMufgGV7GrwQzfznbDId9DU4TnwJhPYDN/AQysxpqHsTVQNGNUNZArPe1 U76w== X-Gm-Message-State: AOAM5317X8g/P0jrP1+/4gN6Y7qGOwSjXzxpWbupA5l5cXfU7QCQJXXs CIJRDayifsrSNgGEpViT2AE= X-Received: by 2002:a62:1a47:0:b029:19b:c093:2766 with SMTP id a68-20020a621a470000b029019bc0932766mr5436901pfa.10.1607580104907; Wed, 09 Dec 2020 22:01:44 -0800 (PST) Received: from localhost.localdomain ([2402:7500:568:b3ad:229b:9ee7:b946:7876]) by smtp.gmail.com with ESMTPSA id j19sm4355377pff.74.2020.12.09.22.01.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2020 22:01:44 -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 v12 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH Date: Thu, 10 Dec 2020 14:00:53 +0800 Message-Id: <1607580057-4408-2-git-send-email-gene.chen.richtek@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607580057-4408-1-git-send-email-gene.chen.richtek@gmail.com> References: <1607580057-4408-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