From patchwork Tue Mar 14 10:26:31 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: 9622957 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 0791160492 for ; Tue, 14 Mar 2017 10:27:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC5D3283F3 for ; Tue, 14 Mar 2017 10:27:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE0BC28410; Tue, 14 Mar 2017 10:27:03 +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 73E9D283F3 for ; Tue, 14 Mar 2017 10:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750820AbdCNK1D (ORCPT ); Tue, 14 Mar 2017 06:27:03 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35481 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751080AbdCNK0p (ORCPT ); Tue, 14 Mar 2017 06:26:45 -0400 Received: by mail-lf0-f68.google.com with SMTP id v2so13766845lfi.2 for ; Tue, 14 Mar 2017 03:26:43 -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=406XFrSAflGfYaUX1y1c/GLFSRCMGK+UXpUzGt2/mgU=; b=N9YenDok7EyfMuhgkLHUHG8p/KNGusxsKW8yIkJmZgzHkv8a8WwXcKwz7LhMhybHgR Lm3ezt3o5PUjXPzq1mQwbtjTXxHD0kbePPH6H1rOKeHvN6kB32Bmmj6FBGe52G18Nhkz areusF9wvBwBKt8+dHD3imc+rqv0cZT4pKWDY= 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=406XFrSAflGfYaUX1y1c/GLFSRCMGK+UXpUzGt2/mgU=; b=To7S71dchDy7gEIZ9QjausLQhWwLhKP5Zhxi6fzKo4Rf359jpjC9ovhnCQSpA8p7Z8 KilCbLNCDRg+9StUZfEf1TIgdS5ko7DIWbNnoNP0oIz15q2o6EJvaWQ5kUzBaCXXVWpe hMFsgjqNZIfkFww2dddxYsSBysDWmTrqq5aB1heYlpLNw/i6qCY6YUKfnH2qvRp1wj76 RXTcQGNw1LiyIXsBwelgJdd9EpkAWbdisveP0/VVqaCnsoU80ZCpmRUKFAs0C7tCh31j +9X298EFoKdA21+LSKKBKn+gfxOZLIvrOihjtSyjIVy7x5MyCvtqDym39omFPiDAIkvV I2YQ== X-Gm-Message-State: AMke39n3Ha7QyOn4fClRzFSvgS9FE/J8d/UmS5nz/Hh2lE59K1KkXh/TV+1bCk5ZG2avHg== X-Received: by 10.25.160.132 with SMTP id j126mr8703230lfe.24.1489487202643; Tue, 14 Mar 2017 03:26:42 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 03:26:42 -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 5/5] platform/x86: fujitsu-laptop: remove pf_device field from struct fujitsu_bl Date: Tue, 14 Mar 2017 11:26:31 +0100 Message-Id: <20170314102631.8203-6-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 Both struct fujitsu_bl and struct fujitsu_laptop have a pf_device field. Up until now the latter has been redundant, which is logically incorrect because the primary function of the platform device created by fujitsu-laptop is to provide laptop-related (not brightness-related) attributes to userspace. Remove the pf_device field from struct fujitsu_bl and make all module code use the pf_device field of struct fujitsu_laptop instead. Suggested-by: Alan Jenkins Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index a2641cb79df9..f3ccef3d5a1e 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -138,7 +138,6 @@ struct fujitsu_bl { struct input_dev *input; char phys[32]; struct backlight_device *bl_device; - struct platform_device *pf_device; int keycode1, keycode2, keycode3, keycode4, keycode5; unsigned int max_brightness; @@ -769,15 +768,15 @@ static int fujitsu_laptop_platform_add(void) { int ret; - fujitsu_bl->pf_device = platform_device_alloc("fujitsu-laptop", -1); - if (!fujitsu_bl->pf_device) + fujitsu_laptop->pf_device = platform_device_alloc("fujitsu-laptop", -1); + if (!fujitsu_laptop->pf_device) return -ENOMEM; - ret = platform_device_add(fujitsu_bl->pf_device); + ret = platform_device_add(fujitsu_laptop->pf_device); if (ret) goto err_put_platform_device; - ret = sysfs_create_group(&fujitsu_bl->pf_device->dev.kobj, + ret = sysfs_create_group(&fujitsu_laptop->pf_device->dev.kobj, &fujitsu_pf_attribute_group); if (ret) goto err_del_platform_device; @@ -785,18 +784,18 @@ static int fujitsu_laptop_platform_add(void) return 0; err_del_platform_device: - platform_device_del(fujitsu_bl->pf_device); + platform_device_del(fujitsu_laptop->pf_device); err_put_platform_device: - platform_device_put(fujitsu_bl->pf_device); + platform_device_put(fujitsu_laptop->pf_device); return ret; } static void fujitsu_laptop_platform_remove(void) { - sysfs_remove_group(&fujitsu_bl->pf_device->dev.kobj, + sysfs_remove_group(&fujitsu_laptop->pf_device->dev.kobj, &fujitsu_pf_attribute_group); - platform_device_unregister(fujitsu_bl->pf_device); + platform_device_unregister(fujitsu_laptop->pf_device); } static int acpi_fujitsu_laptop_add(struct acpi_device *device) @@ -909,7 +908,7 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) #if IS_ENABLED(CONFIG_LEDS_CLASS) if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { - result = led_classdev_register(&fujitsu_bl->pf_device->dev, + result = led_classdev_register(&fujitsu_laptop->pf_device->dev, &logolamp_led); if (result == 0) { fujitsu_laptop->logolamp_registered = 1; @@ -921,7 +920,7 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) && (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) { - result = led_classdev_register(&fujitsu_bl->pf_device->dev, + result = led_classdev_register(&fujitsu_laptop->pf_device->dev, &kblamps_led); if (result == 0) { fujitsu_laptop->kblamps_registered = 1; @@ -938,7 +937,7 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) * that an RF LED is present. */ if (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) { - result = led_classdev_register(&fujitsu_bl->pf_device->dev, + result = led_classdev_register(&fujitsu_laptop->pf_device->dev, &radio_led); if (result == 0) { fujitsu_laptop->radio_led_registered = 1; @@ -955,7 +954,7 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) */ if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & BIT(14)) && (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) != UNSUPPORTED_CMD)) { - result = led_classdev_register(&fujitsu_bl->pf_device->dev, + result = led_classdev_register(&fujitsu_laptop->pf_device->dev, &eco_led); if (result == 0) { fujitsu_laptop->eco_led_registered = 1;