Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751271AbdCNK1m (ORCPT ); Tue, 14 Mar 2017 06:27:42 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36374 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992AbdCNK0n (ORCPT ); Tue, 14 Mar 2017 06:26:43 -0400 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 2/5] platform/x86: fujitsu-laptop: simplify platform device attribute definitions Date: Tue, 14 Mar 2017 11:26:28 +0100 Message-Id: <20170314102631.8203-3-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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2330 Lines: 70 Use the DEVICE_ATTR_RO() macro to get rid of ignore_store() and shorten attribute definitions. Adjust whitespace to make checkpatch happy. Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 9b9348af7626..9719c821d64f 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -480,16 +480,8 @@ static const struct backlight_ops fujitsu_bl_ops = { .update_status = bl_update_status, }; -static ssize_t -ignore_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - return count; -} - -static ssize_t -show_lid_state(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t lid_show(struct device *dev, struct device_attribute *attr, + char *buf) { if (!(fujitsu_laptop->flags_supported & FLAG_LID)) return sprintf(buf, "unknown\n"); @@ -499,9 +491,8 @@ show_lid_state(struct device *dev, return sprintf(buf, "closed\n"); } -static ssize_t -show_dock_state(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t dock_show(struct device *dev, struct device_attribute *attr, + char *buf) { if (!(fujitsu_laptop->flags_supported & FLAG_DOCK)) return sprintf(buf, "unknown\n"); @@ -511,9 +502,8 @@ show_dock_state(struct device *dev, return sprintf(buf, "undocked\n"); } -static ssize_t -show_radios_state(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t radios_show(struct device *dev, struct device_attribute *attr, + char *buf) { if (!(fujitsu_laptop->flags_supported & FLAG_RFKILL)) return sprintf(buf, "unknown\n"); @@ -523,9 +513,9 @@ show_radios_state(struct device *dev, return sprintf(buf, "killed\n"); } -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 DEVICE_ATTR_RO(lid); +static DEVICE_ATTR_RO(dock); +static DEVICE_ATTR_RO(radios); static struct attribute *fujitsu_pf_attributes[] = { &dev_attr_lid.attr, -- 2.12.0