mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frans Klaver <fransklaver@gmail.com>
To: Darren Hart <dvhart@infradead.org>
Cc: Frans Klaver <fransklaver@gmail.com>,
	Corentin Chary <corentin.chary@gmail.com>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	acpi4asus-user@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/9] eeepc-laptop: change sysfs function names to API expectations
Date: Wed, 17 Sep 2014 23:47:20 +0200	[thread overview]
Message-ID: <1410990447-3210-3-git-send-email-fransklaver@gmail.com> (raw)
In-Reply-To: <1410990447-3210-1-git-send-email-fransklaver@gmail.com>

The eeepc-laptop driver follows the function naming convention
<action>_<attrname>(), while the sysfs macros are built around the
convention <attrname>_<action>(). Rename the sysfs functions to the
convention used by sysfs. This makes it easier to use the available API
later on.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
---
 drivers/platform/x86/eeepc-laptop.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 653999e..0094449 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -296,13 +296,13 @@ static ssize_t show_sys_acpi(struct device *dev, int cm, char *buf)
 }
 
 #define EEEPC_CREATE_DEVICE_ATTR(_name, _mode, _cm)			\
-	static ssize_t show_##_name(struct device *dev,			\
+	static ssize_t _name##_show(struct device *dev,			\
 				    struct device_attribute *attr,	\
 				    char *buf)				\
 	{								\
 		return show_sys_acpi(dev, _cm, buf);			\
 	}								\
-	static ssize_t store_##_name(struct device *dev,		\
+	static ssize_t _name##_store(struct device *dev,		\
 				     struct device_attribute *attr,	\
 				     const char *buf, size_t count)	\
 	{								\
@@ -312,8 +312,8 @@ static ssize_t show_sys_acpi(struct device *dev, int cm, char *buf)
 		.attr = {						\
 			.name = __stringify(_name),			\
 			.mode = _mode },				\
-		.show   = show_##_name,					\
-		.store  = store_##_name,				\
+		.show   = _name##_show,					\
+		.store  = _name##_store,				\
 	}
 
 EEEPC_CREATE_DEVICE_ATTR(camera, 0644, CM_ASL_CAMERA);
@@ -335,7 +335,7 @@ static int get_cpufv(struct eeepc_laptop *eeepc, struct eeepc_cpufv *c)
 	return 0;
 }
 
-static ssize_t show_available_cpufv(struct device *dev,
+static ssize_t available_cpufv_show(struct device *dev,
 				    struct device_attribute *attr,
 				    char *buf)
 {
@@ -352,7 +352,7 @@ static ssize_t show_available_cpufv(struct device *dev,
 	return len;
 }
 
-static ssize_t show_cpufv(struct device *dev,
+static ssize_t cpufv_show(struct device *dev,
 			  struct device_attribute *attr,
 			  char *buf)
 {
@@ -364,7 +364,7 @@ static ssize_t show_cpufv(struct device *dev,
 	return sprintf(buf, "%#x\n", (c.num << 8) | c.cur);
 }
 
-static ssize_t store_cpufv(struct device *dev,
+static ssize_t cpufv_store(struct device *dev,
 			   struct device_attribute *attr,
 			   const char *buf, size_t count)
 {
@@ -385,7 +385,7 @@ static ssize_t store_cpufv(struct device *dev,
 	return count;
 }
 
-static ssize_t show_cpufv_disabled(struct device *dev,
+static ssize_t cpufv_disabled_show(struct device *dev,
 			  struct device_attribute *attr,
 			  char *buf)
 {
@@ -394,7 +394,7 @@ static ssize_t show_cpufv_disabled(struct device *dev,
 	return sprintf(buf, "%d\n", eeepc->cpufv_disabled);
 }
 
-static ssize_t store_cpufv_disabled(struct device *dev,
+static ssize_t cpufv_disabled_store(struct device *dev,
 			   struct device_attribute *attr,
 			   const char *buf, size_t count)
 {
@@ -424,23 +424,23 @@ static struct device_attribute dev_attr_cpufv = {
 	.attr = {
 		.name = "cpufv",
 		.mode = 0644 },
-	.show   = show_cpufv,
-	.store  = store_cpufv
+	.show   = cpufv_show,
+	.store  = cpufv_store
 };
 
 static struct device_attribute dev_attr_available_cpufv = {
 	.attr = {
 		.name = "available_cpufv",
 		.mode = 0444 },
-	.show   = show_available_cpufv
+	.show   = available_cpufv_show
 };
 
 static struct device_attribute dev_attr_cpufv_disabled = {
 	.attr = {
 		.name = "cpufv_disabled",
 		.mode = 0644 },
-	.show   = show_cpufv_disabled,
-	.store  = store_cpufv_disabled
+	.show   = cpufv_disabled_show,
+	.store  = cpufv_disabled_store
 };
 
 
-- 
2.1.0


  parent reply	other threads:[~2014-09-17 21:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 21:47 [PATCH v2 0/9] eeepc cleanup Frans Klaver
2014-09-17 21:47 ` [PATCH 1/9] eeepc-laptop: clean up coding style Frans Klaver
2014-09-17 22:06   ` Joe Perches
2014-09-18  5:01     ` Frans Klaver
2014-09-19 16:46       ` Darren Hart
2014-09-19 17:17         ` Frans Klaver
2014-09-19 16:43   ` Darren Hart
2014-09-17 21:47 ` Frans Klaver [this message]
2014-09-17 21:47 ` [PATCH 3/9] eeepc-laptop: use DEVICE_ATTR* to instantiate device_attributes Frans Klaver
2014-09-17 22:06   ` Greg Kroah-Hartman
2014-09-17 21:47 ` [PATCH 4/9] eeepc-laptop: pull out ACPI_STORE_FUNC and ACPI_SHOW_FUNC macros Frans Klaver
2014-09-17 21:47 ` [PATCH 5/9] eeepc-laptop: tell sysfs that the disp attribute is write-only Frans Klaver
2014-09-17 22:07   ` Greg Kroah-Hartman
2014-09-18  5:04     ` Frans Klaver
2014-09-17 21:47 ` [PATCH 6/9] eeepc-laptop: pull out SENSOR_STORE_FUNC and SENSOR_SHOW_FUNC macros Frans Klaver
2014-09-17 21:47 ` [PATCH 7/9] eeepc-laptop: make fan1_input really read-only Frans Klaver
2014-09-17 21:47 ` [PATCH 8/9] eeepc-laptop: check proper return values in get_cpufv Frans Klaver
2014-09-17 21:47 ` [PATCH 9/9] eeepc-laptop: store_cpufv: return error if set_acpi fails Frans Klaver
2014-09-19 17:25 ` [PATCH v2 0/9] eeepc cleanup Darren Hart
2014-09-19 17:33   ` Frans Klaver

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=1410990447-3210-3-git-send-email-fransklaver@gmail.com \
    --to=fransklaver@gmail.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentin.chary@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /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

Powered by JetHome