From patchwork Wed Apr 5 06:49:01 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: 9663085 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 2E11C60364 for ; Wed, 5 Apr 2017 06:53:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F65D281B7 for ; Wed, 5 Apr 2017 06:53:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1408B284FE; Wed, 5 Apr 2017 06:53:14 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable 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 C504528507 for ; Wed, 5 Apr 2017 06:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754032AbdDEGxA (ORCPT ); Wed, 5 Apr 2017 02:53:00 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36806 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754010AbdDEGtQ (ORCPT ); Wed, 5 Apr 2017 02:49:16 -0400 Received: by mail-lf0-f68.google.com with SMTP id n78so353421lfi.3 for ; Tue, 04 Apr 2017 23:49:16 -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=UvNHzXSo1Ud3xlF7YjOpAwc/rduYl6/BRPigeOIB29E=; b=kzJgxnbI3gxVq1tvP7kEGPVC2znouEBXuBlSKn/Kc465TeKKPeum3DsWM2i4KcCiuz N/IIIFg7NRLrZIaQrkasICkjunV539tmLTRg5Z/tLIt33vTkFXbEC2KWkBdIZQ8bpddX K/OiJiu0Ttj/LK7iMBftOziMlyZjAo48RyIAc= 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=UvNHzXSo1Ud3xlF7YjOpAwc/rduYl6/BRPigeOIB29E=; b=Tz1pj4AUV68juV5c23nlR9WXkln86aO8fJ7QgbzuH09151i9leoasvjs+DvlF2ADC5 fyxLBGIQPLvw0X2gqUcA61NZwbesSQ0ozwrmucRtMW59ziLGZ6NEzeO/5l5YfOyRuJpm NyKICLt+5rwCeO9Ybk0MdoY/tZAOPSKmA2OkRPejTTuTUh3sQ7WdEUGGYK+xhU3DlQKz 8NBp9MuaH0nX2VhqH7nEDiGAEQGRoUglqOdsoV1iPeYE0P1wtXjLo6ZBRAKjsYrmtCFN n0Es72VeLqRctjOLkIsdjVjOWkjYHmyxCA+euXHot4vNPVH0kGeabXB9iQZnauZD582I hk8A== X-Gm-Message-State: AFeK/H1X9Q99n8Mcvd1k3MTgD6vgXvnZADvYb21jRCJpawaGMTt8TIB1UCJHWyHaEv2DIg== X-Received: by 10.46.71.206 with SMTP id u197mr695604lja.104.1491374955126; Tue, 04 Apr 2017 23:49:15 -0700 (PDT) Received: from ozzy.nask.waw.pl ([2001:a10:160:3::3]) by smtp.googlemail.com with ESMTPSA id o91sm3619921lfg.1.2017.04.04.23.49.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 23:49:14 -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 v2 02/11] platform/x86: fujitsu-laptop: switch to a managed backlight device Date: Wed, 5 Apr 2017 08:49:01 +0200 Message-Id: <20170405064910.3162-3-kernel@kempniu.pl> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170405064910.3162-1-kernel@kempniu.pl> References: <20170405064910.3162-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 Use a managed backlight device to get rid of acpi_fujitsu_bl_remove(). Change the parent of the backlight device from NULL to the FUJ02B1 ACPI device as the latter is required for the backlight device to work. Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 722250d1aa20..59107a599d22 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -565,17 +565,18 @@ static int acpi_fujitsu_bl_input_setup(struct acpi_device *device) return input_register_device(fujitsu_bl->input); } -static int fujitsu_backlight_register(void) +static int fujitsu_backlight_register(struct acpi_device *device) { - struct backlight_properties props = { + const struct backlight_properties props = { .brightness = fujitsu_bl->brightness_level, .max_brightness = fujitsu_bl->max_brightness - 1, .type = BACKLIGHT_PLATFORM }; struct backlight_device *bd; - bd = backlight_device_register("fujitsu-laptop", NULL, NULL, - &fujitsu_bl_ops, &props); + bd = devm_backlight_device_register(&device->dev, "fujitsu-laptop", + &device->dev, NULL, + &fujitsu_bl_ops, &props); if (IS_ERR(bd)) return PTR_ERR(bd); @@ -644,24 +645,13 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) fujitsu_bl->max_brightness = FUJITSU_LCD_N_LEVELS; get_lcd_level(); - error = fujitsu_backlight_register(); + error = fujitsu_backlight_register(device); if (error) return error; return 0; } -static int acpi_fujitsu_bl_remove(struct acpi_device *device) -{ - struct fujitsu_bl *fujitsu_bl = acpi_driver_data(device); - - backlight_device_unregister(fujitsu_bl->bl_device); - - fujitsu_bl->acpi_handle = NULL; - - return 0; -} - /* Brightness notify */ static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event) @@ -1092,7 +1082,6 @@ static struct acpi_driver acpi_fujitsu_bl_driver = { .ids = fujitsu_bl_device_ids, .ops = { .add = acpi_fujitsu_bl_add, - .remove = acpi_fujitsu_bl_remove, .notify = acpi_fujitsu_bl_notify, }, };