From: "Michał Kępień" <kernel@kempniu.pl>
To: Jonathan Woithe <jwoithe@just42.net>,
Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>
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 [thread overview]
Message-ID: <20170314102631.8203-3-kernel@kempniu.pl> (raw)
In-Reply-To: <20170314102631.8203-1-kernel@kempniu.pl>
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ń <kernel@kempniu.pl>
---
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
next prev parent reply other threads:[~2017-03-14 10:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 10:26 [PATCH 0/5] fujitsu-laptop: platform device code cleanup Michał Kępień
2017-03-14 10:26 ` [PATCH 1/5] platform/x86: fujitsu-laptop: remove backlight-related attributes from the platform device Michał Kępień
2017-03-14 10:26 ` Michał Kępień [this message]
2017-03-14 10:26 ` [PATCH 3/5] platform/x86: fujitsu-laptop: add and remove platform device in separate functions Michał Kępień
2017-03-14 10:26 ` [PATCH 4/5] platform/x86: fujitsu-laptop: only register platform device if FUJ02E3 is present Michał Kępień
2017-03-14 10:26 ` [PATCH 5/5] platform/x86: fujitsu-laptop: remove pf_device field from struct fujitsu_bl Michał Kępień
2017-03-15 0:19 ` [PATCH 0/5] fujitsu-laptop: platform device code cleanup Jonathan Woithe
2017-03-15 23:39 ` Darren Hart
2017-03-18 11:40 ` Jonathan Woithe
2017-03-22 16:01 ` Darren Hart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170314102631.8203-3-kernel@kempniu.pl \
--to=kernel@kempniu.pl \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=jwoithe@just42.net \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox