From patchwork Fri May 15 06:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1290878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Ndgm0hgQz9sV0; Fri, 15 May 2020 16:25:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jZTmZ-0006Vh-SO; Fri, 15 May 2020 06:25:19 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jZTmQ-0006S8-7l for kernel-team@lists.ubuntu.com; Fri, 15 May 2020 06:25:10 +0000 Received: from mail-pg1-f198.google.com ([209.85.215.198]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jZTmP-0002ly-Qf for kernel-team@lists.ubuntu.com; Fri, 15 May 2020 06:25:10 +0000 Received: by mail-pg1-f198.google.com with SMTP id n14so1024668pgr.11 for ; Thu, 14 May 2020 23:25:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=gJ4mUnqF82BBwYOoBP5TOnuDQtTa9H6lrQmQQQOz+I8=; b=FVYm6cdfPMaw9iYkJbWDo7DlGkIntmY0SWm9zQFUkHV3OpK48kCjiKFC+j8lowJLst 1IXsh8984NhvHLxmXlubtJW5d4Zt4IFv1coHzUhp4vUPPkrsLf1t6hOQswGaPwvpxu6W Crmq1Gi6rbNXa1rN++KxCCvudyKRCrL8bBpa9BV7VQN+CczQ8c3kgNPatDcMHft0hCda dg4iaWWajkGozCroLjxMp5Xjs4uB06uajcQWtsLqvYhG5m9kXzMJqiQ4fho0OoSHQ/sN 4zNmATSDoglRGbQjrKTNS14kz9yIZcA+CSVdOVZgeTjBAXlbB9oHr9VhSZ6kquuLKU0S 0KbQ== X-Gm-Message-State: AOAM5328BEiBDCUuxFn8fFb9xOr7hrlBzLcoCA4v36fFz/qNrwyAD0k/ ms542MW1fotY/B3TSQSmdJ2DJlALmXf8t5ngoGAy0q3ftL7FBwAgm8M7ydMwOrXHkZHbYC+MT79 NTyTva0Pwrn6ce7qtupTXTFjzJ9x816BT14NZhS+cqA== X-Received: by 2002:a17:902:ab8d:: with SMTP id f13mr2280058plr.58.1589523908206; Thu, 14 May 2020 23:25:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx/lZ0nB/t3L55/KqR89ULBeeZl9EbRGS98wYyWMsPZVZcZFFBTE5AX/BKIZKZWK/Fy2Azkw== X-Received: by 2002:a17:902:ab8d:: with SMTP id f13mr2280045plr.58.1589523907855; Thu, 14 May 2020 23:25:07 -0700 (PDT) Received: from canonical.com (114-43-71-139.dynamic-ip.hinet.net. [114.43.71.139]) by smtp.gmail.com with ESMTPSA id j16sm957357pfa.179.2020.05.14.23.25.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 May 2020 23:25:07 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 1/1][SRU][OEM-OSP1-B] UBUNTU: SAUCE: platform/x86: dell-laptop: don't register platform::micmute if the related tokens don't exist Date: Fri, 15 May 2020 14:25:04 +0800 Message-Id: <20200515062504.6619-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200515062504.6619-1-koba.ko@canonical.com> References: <20200515062504.6619-1-koba.ko@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1877275 Error message is issued during boot up, "platform::micmute: Setting an LED's brightness failed (-19)", but there's no micmute led on the machine. Get the related tokens of SMBIOS, GLOBAL_MIC_MUTE_DISABLE/ENABLE. If one of two tokens doesn't exist, don't call led_classdev_register() for platform::micmute. After that, you wouldn't see the platform::micmute in /sys/class/leds/, and the error message wouldn't see in dmesg. Signed-off-by: Koba Ko Acked-By: AceLan Kao --- drivers/platform/x86/dell-laptop.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 1e46022fb2c5..53175bdfe166 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -2167,7 +2167,7 @@ static struct led_classdev micmute_led_cdev = { static int __init dell_init(void) { struct calling_interface_token *token; - int max_intensity = 0; + int max_intensity = 0, micmute_exists = 0; int ret; if (!dmi_check_system(dell_device_table)) @@ -2208,10 +2208,14 @@ static int __init dell_init(void) dell_laptop_register_notifier(&dell_laptop_notifier); - micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); - ret = led_classdev_register(&platform_device->dev, &micmute_led_cdev); - if (ret < 0) - goto fail_led; + if (dell_smbios_find_token(GLOBAL_MIC_MUTE_DISABLE) && + dell_smbios_find_token(GLOBAL_MIC_MUTE_ENABLE)) { + micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); + ret = led_classdev_register(&platform_device->dev, &micmute_led_cdev); + if (ret < 0) + goto fail_led; + micmute_exists = 1; + } if (acpi_video_get_backlight_type() != acpi_backlight_vendor) return 0; @@ -2258,7 +2262,8 @@ static int __init dell_init(void) fail_get_brightness: backlight_device_unregister(dell_backlight_device); fail_backlight: - led_classdev_unregister(&micmute_led_cdev); + if (micmute_exists) + led_classdev_unregister(&micmute_led_cdev); fail_led: dell_cleanup_rfkill(); fail_rfkill: