From patchwork Sat May 11 12:35:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 796717 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF8381A2C17 for ; Sat, 11 May 2024 12:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715430919; cv=none; b=S8QC2v+KX+PvblDUmrLPbebLzGzf4vjv4+WpfsMQusag2ipN6/RdFTGTYAAczG6nSLIG5N3A860gbzAL2JpfKclJx6Sl1w0DsLOdptb2JNOiq/QraGE8jsLKEHbzB71yzdn0ZI2Dbr4hnPRX1MgZHy9UvB5rDPJMsj5WUfyK+9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715430919; c=relaxed/simple; bh=tdF40W5/p7BNpqk7dLQhpUrEV33iYOSR9aYMnXyOXoY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bT1agAUeDwhidTZYysBv4yvhX7/43SfkTVbAvJkJhjOHu0xiOnEws4jlvOSa7WA3rovqJor9n5NihdQ4fYJD8PAZHeEgtvPoU+uEIgkaQ2OtgaOV6wNeyiwEhz89+d/WYvoe4pY9Uhi1sSy1TZdtpWpYCwRthWCWaEkZdUU3YPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SF7WIB3/; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SF7WIB3/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715430916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gLhuT+oWLYe8VAd+4kBJ2yh31MpICmbd3ylxkbHpSO0=; b=SF7WIB3/+oDlXw0Wbc+JK6YfgwOtkZa+obCqqdrIi4UzdlnZu9f1yNVkJKMmsaCIefvVnP nEnnms6NEBdC3rdnW8hxUtDkeesXCdnqPtJl1j38Fp/tKgbHeIGq/EdTj3gsi8zfnl68oS 2HJEakkN1S35pDNbv2U0ZXU3HBJVO/A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-578-cJlqn6TuOrqo0Sepr6n1eg-1; Sat, 11 May 2024 08:35:12 -0400 X-MC-Unique: cJlqn6TuOrqo0Sepr6n1eg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 04A4F80027F; Sat, 11 May 2024 12:35:12 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB02C2087D71; Sat, 11 May 2024 12:35:10 +0000 (UTC) From: Hans de Goede To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: Hans de Goede , Pavel Machek , Lee Jones , linux-leds@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: Use led_set_brightness() in LED trigger activate() callback Date: Sat, 11 May 2024 14:35:10 +0200 Message-ID: <20240511123510.22303-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 A LED trigger's activate() callback gets called when the LED trigger gets activated for a specific LED, so that the trigger code can ensure the LED state matches the current state of the trigger condition (LED_FULL when HCI_UP is set in this case). led_trigger_event() is intended for trigger condition state changes and iterates over _all_ LEDs which are controlled by this trigger changing the brightness of each of them. In the activate() case only the brightness of the LED which is being activated needs to change and that LED is passed as an argument to activate(), switch to led_set_brightness() to only change the brightness of the LED being activated. Note this is compile tested only. Signed-off-by: Hans de Goede --- net/bluetooth/leds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/leds.c b/net/bluetooth/leds.c index f46847632ffa..6e349704efe4 100644 --- a/net/bluetooth/leds.c +++ b/net/bluetooth/leds.c @@ -48,7 +48,7 @@ static int power_activate(struct led_classdev *led_cdev) htrig = to_hci_basic_led_trigger(led_cdev->trigger); powered = test_bit(HCI_UP, &htrig->hdev->flags); - led_trigger_event(led_cdev->trigger, powered ? LED_FULL : LED_OFF); + led_set_brightness(led_cdev, powered ? LED_FULL : LED_OFF); return 0; }