From patchwork Tue Mar 14 10:26:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 9622969 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DFF2960492 for ; Tue, 14 Mar 2017 10:28:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C43B22856A for ; Tue, 14 Mar 2017 10:28:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B953628573; Tue, 14 Mar 2017 10:28:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3222B284DC for ; Tue, 14 Mar 2017 10:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750992AbdCNK2B (ORCPT ); Tue, 14 Mar 2017 06:28:01 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33623 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824AbdCNK0l (ORCPT ); Tue, 14 Mar 2017 06:26:41 -0400 Received: by mail-lf0-f67.google.com with SMTP id r36so13781937lfi.0 for ; Tue, 14 Mar 2017 03:26:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pwsi0p/j3gRCjuyY+ZVH9GR59axoD7+ZU+7+WQXVY+o=; b=spZen00wPDAmKy+me7dHA6XXtU083xtbNGZ+ivRv/hLWILQ7iMZ98q6Q2wlHp4i20D KZfl3wUbHvvl3bJFi+ua01EgYPHohQvlGPZgCr3SOnnWOCIY9GBTexihElGRMxotOZJc obwbwDWgTjjkodX7UDQuQqsudlpLkdpqUrFQo= 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:mime-version:content-transfer-encoding; bh=Pwsi0p/j3gRCjuyY+ZVH9GR59axoD7+ZU+7+WQXVY+o=; b=bB/YeKUI2aZHRbgq9tm0M23OXqr0wzMtnSkDROTBbbavPZIZDbFv0uFj1mSIXbFTLd fUBh1BO/taRMrpa0AiDaylAZ608anftW3d93KXN4fowCFqpeP54Efm0qd8rvCcJyHMm1 5cS/faV5ulmfOgeukyhnmTJtkppI+Q/QPv3OQuwb9jPHH2lkmO6CxKLBvXLqcYY0CJaY tr2iCxYJgkNTBcZYkjIx/m2wubwhpBL/7plaH4WYmAIjdjJPv9y5IctZbZ7fv1psKSxz SCuZoUOMEYpU5PNHVwzO1exEKqxnImMO8/IEqPifqvSiT3dN9UebcAzX57NmG1xI+ojq Vzdg== X-Gm-Message-State: AMke39mIfU0Y5YyXAKzMVbItGX0tl4Ck3UXJIEBfQ20YQIh7A0ThxYR25QLi5/wNEJ7MhA== X-Received: by 10.25.163.193 with SMTP id m184mr9227044lfe.114.1489487199131; Tue, 14 Mar 2017 03:26:39 -0700 (PDT) Received: from ozzy.hq.kempniu.pl ([2001:a10:160:3::3]) by smtp.googlemail.com with ESMTPSA id h62sm4186154lfh.62.2017.03.14.03.26.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 03:26:38 -0700 (PDT) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] platform/x86: fujitsu-laptop: remove backlight-related attributes from the platform device Date: Tue, 14 Mar 2017 11:26:27 +0100 Message-Id: <20170314102631.8203-2-kernel@kempniu.pl> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170314102631.8203-1-kernel@kempniu.pl> References: <20170314102631.8203-1-kernel@kempniu.pl> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Setting backlight level using a vendor-specific interface should only be possible when using the latter is either explicitly requested by the user or automatically selected by the kernel. fujitsu-laptop violates that premise by unconditionally attaching three backlight-related attributes to the platform device it registers. Remove the offending attributes from the platform device. Update module comments to reflect this change. Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 90 ++--------------------------------- 1 file changed, 3 insertions(+), 87 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 3c795d591de0..9b9348af7626 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -32,18 +32,9 @@ * features made available on a range of Fujitsu laptops including the * P2xxx/P5xxx/S6xxx/S7xxx series. * - * This driver exports a few files in /sys/devices/platform/fujitsu-laptop/; - * others may be added at a later date. - * - * lcd_level - Screen brightness: contains a single integer in the - * range 0..7. (rw) - * - * In addition to these platform device attributes the driver - * registers itself in the Linux backlight control subsystem and is - * available to userspace under /sys/class/backlight/fujitsu-laptop/. - * - * Hotkeys present on certain Fujitsu laptops (eg: the S6xxx series) are - * also supported by this driver. + * This driver implements a vendor-specific backlight control interface for + * Fujitsu laptops and provides support for hotkeys present on certain Fujitsu + * laptops. * * This driver has been tested on a Fujitsu Lifebook S6410, S7020 and * P8010. It should work on most P-series and S-series Lifebooks, but @@ -489,74 +480,6 @@ static const struct backlight_ops fujitsu_bl_ops = { .update_status = bl_update_status, }; -/* Platform LCD brightness device */ - -static ssize_t -show_max_brightness(struct device *dev, - struct device_attribute *attr, char *buf) -{ - - int ret; - - ret = get_max_brightness(); - if (ret < 0) - return ret; - - return sprintf(buf, "%i\n", ret); -} - -static ssize_t -show_brightness_changed(struct device *dev, - struct device_attribute *attr, char *buf) -{ - - int ret; - - ret = fujitsu_bl->brightness_changed; - if (ret < 0) - return ret; - - return sprintf(buf, "%i\n", ret); -} - -static ssize_t show_lcd_level(struct device *dev, - struct device_attribute *attr, char *buf) -{ - - int ret; - - ret = get_lcd_level(); - if (ret < 0) - return ret; - - return sprintf(buf, "%i\n", ret); -} - -static ssize_t store_lcd_level(struct device *dev, - struct device_attribute *attr, const char *buf, - size_t count) -{ - - int level, ret; - - if (sscanf(buf, "%i", &level) != 1 - || (level < 0 || level >= fujitsu_bl->max_brightness)) - return -EINVAL; - - if (use_alt_lcd_levels) - ret = set_lcd_level_alt(level); - else - ret = set_lcd_level(level); - if (ret < 0) - return ret; - - ret = get_lcd_level(); - if (ret < 0) - return ret; - - return count; -} - static ssize_t ignore_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) @@ -600,18 +523,11 @@ show_radios_state(struct device *dev, return sprintf(buf, "killed\n"); } -static DEVICE_ATTR(max_brightness, 0444, show_max_brightness, ignore_store); -static DEVICE_ATTR(brightness_changed, 0444, show_brightness_changed, - ignore_store); -static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); static DEVICE_ATTR(lid, 0444, show_lid_state, ignore_store); static DEVICE_ATTR(dock, 0444, show_dock_state, ignore_store); static DEVICE_ATTR(radios, 0444, show_radios_state, ignore_store); static struct attribute *fujitsu_pf_attributes[] = { - &dev_attr_brightness_changed.attr, - &dev_attr_max_brightness.attr, - &dev_attr_lcd_level.attr, &dev_attr_lid.attr, &dev_attr_dock.attr, &dev_attr_radios.attr,