From patchwork Mon Aug 3 12:02:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 255463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9A8FC433DF for ; Mon, 3 Aug 2020 12:02:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4FF120678 for ; Mon, 3 Aug 2020 12:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbgHCMCc (ORCPT ); Mon, 3 Aug 2020 08:02:32 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:35260 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbgHCMC0 (ORCPT ); Mon, 3 Aug 2020 08:02:26 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id DD1991C0BD4; Mon, 3 Aug 2020 14:02:22 +0200 (CEST) Date: Mon, 3 Aug 2020 14:02:22 +0200 From: Pavel Machek To: marek.behun@nic.cz, jacek.anaszewski@gmail.com, dmurphy@ti.com, linux-leds@vger.kernel.org Subject: [PATCH] leds: disallow /sys/class/leds/*:multi:* for now Message-ID: <20200803120222.3x3irmbmomebkfqw@duo.ucw.cz> References: <20200727084500.GA15237@amd> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200727084500.GA15237@amd> User-Agent: NeoMutt/20180716 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org commit 77dce3a22e8941552a15046d4113df9ce132fb3d Author: Pavel Machek Date: Mon Aug 3 14:00:06 2020 +0200 leds: disallow /sys/class/leds/*:multi:* for now All the LEDs in the queue are RGB, so they should not use multi for their color. Make sure we don't add such LED by mistake (and make it part of ABI). Signed-off-by: Pavel Machek diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index a6dce01dbd5e..c4e780bdb385 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c @@ -425,6 +425,10 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data, struct fwnode_handle *fwnode = init_data->fwnode; const char *devicename = init_data->devicename; + /* We want to label LEDs that can produce full range of colors + * as RGB, not multicolor */ + BUG_ON(props.color == LED_COLOR_ID_MULTI); + if (!led_classdev_name) return -EINVAL;