From patchwork Tue Mar 14 10:26:28 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: 9622967 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 DA3C060492 for ; Tue, 14 Mar 2017 10:28:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD1FF283F3 for ; Tue, 14 Mar 2017 10:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B23482856A; Tue, 14 Mar 2017 10:28:00 +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 6E27E283F3 for ; Tue, 14 Mar 2017 10:28:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750909AbdCNK17 (ORCPT ); Tue, 14 Mar 2017 06:27:59 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33829 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750964AbdCNK0m (ORCPT ); Tue, 14 Mar 2017 06:26:42 -0400 Received: by mail-lf0-f68.google.com with SMTP id y193so13745318lfd.1 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=kMx+glvygJPbQyx4QHnSDKP+tOogn3/GfM8oGTgkjbo=; b=Lus21yJLcjd3aKl6nSdmeXv43RidM8RKG9x2dH61W6a48AR6xJ5SK9NCitU0/BM5Zc L+NgiaB2sFDivWveSOjnVST5N9vTj8CdsYvAUBr1cinmE+HT/PBie7o1+vSxxpZlOmbY 4b3zrGntT1KsdqC/FwtYfFE//Euqj7/NiJ66k= 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=kMx+glvygJPbQyx4QHnSDKP+tOogn3/GfM8oGTgkjbo=; b=Kt0ED3HT6V7dVRCZpI2GKCHQmvnQWzVlBdGgsgxJzjYpehkhscpHagsex2ZqXXJ+p2 EIqr+F4CFexQAzU2DwLt0ABBi1Iyvb9B7/3SwhfNDXKyIe+HLpqlrnX0elgrTMFHcZp8 V/qZCuBSXU8BPU8XKWsIVJKSpIqziA8hlzvxcA/A4LQunblF4llo0u4PBMqDkaj6Ui3Z 2DOyC56/zW+mzX5VOupRQZqle2TPw8UWJgkJp4ToBGWu+sABVWPekWcwu+OgES+y1cHN u4isfOC8+EahbktlboRfn2DLUOANyAn19NyX0svm/bZDlM0HfbIH6CWEqOhWTJoLWuZh ElJw== X-Gm-Message-State: AMke39khTb1cC4WEaddZqgiXKKg/cTRU5wO9tKIu/7XhvFj3W+/MAm9zyK+II0gTLSdFiQ== X-Received: by 10.25.20.198 with SMTP id 67mr8621351lfu.78.1489487199974; 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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 03:26:39 -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 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 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 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,