public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yani Ioannou <yani.ioannou@gmail.com>
To: Greg KH <greg@kroah.com>,
	LM Sensors <sensors@stimpy.netroedge.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.12-rc4 1/3] (dynamic sysfs callbacks) device_attribute
Date: Wed, 11 May 2005 03:56:55 -0400	[thread overview]
Message-ID: <2538186705051100563e884f2f@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 627 bytes --]

Hi,

This patch adds support to the sysfs device_attribute to pass the new
void * attribute member to it's callback functions. The device
attribute will benefit the most from the dynamic sysfs callback patch
compared to the other attributes simply because of it's greater usage.

The first patch simply adds the void * parameter to the device
attribute function types and passes them when calling the callbacks.

Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>

Thanks,
Yani

---
 drivers/base/core.c    |    4 ++--
 include/linux/device.h |    5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

[-- Attachment #2: patch-linux-2.6.12-rc4-sysfsdyncallback-deviceattr.diff --]
[-- Type: text/x-patch, Size: 1629 bytes --]

diff -uprN -X dontdiff linux-2.6.12-rc4-sysfsdyncallback-gregkhcore/drivers/base/core.c linux-2.6.12-rc4-sysfsdyncallback-deviceattr/drivers/base/core.c
--- linux-2.6.12-rc4-sysfsdyncallback-gregkhcore/drivers/base/core.c	2005-05-10 21:44:00.000000000 -0400
+++ linux-2.6.12-rc4-sysfsdyncallback-deviceattr/drivers/base/core.c	2005-05-10 23:17:20.000000000 -0400
@@ -41,7 +41,7 @@ dev_attr_show(struct kobject * kobj, str
 	ssize_t ret = 0;
 
 	if (dev_attr->show)
-		ret = dev_attr->show(dev, buf);
+		ret = dev_attr->show(dev, buf, attr->private);
 	return ret;
 }
 
@@ -54,7 +54,7 @@ dev_attr_store(struct kobject * kobj, st
 	ssize_t ret = 0;
 
 	if (dev_attr->store)
-		ret = dev_attr->store(dev, buf, count);
+		ret = dev_attr->store(dev, buf, count, attr->private);
 	return ret;
 }
 
diff -uprN -X dontdiff linux-2.6.12-rc4-sysfsdyncallback-gregkhcore/include/linux/device.h linux-2.6.12-rc4-sysfsdyncallback-deviceattr/include/linux/device.h
--- linux-2.6.12-rc4-sysfsdyncallback-gregkhcore/include/linux/device.h	2005-05-10 21:44:28.000000000 -0400
+++ linux-2.6.12-rc4-sysfsdyncallback-deviceattr/include/linux/device.h	2005-05-10 23:23:15.000000000 -0400
@@ -335,8 +335,9 @@ extern void driver_attach(struct device_
 
 struct device_attribute {
 	struct attribute	attr;
-	ssize_t (*show)(struct device * dev, char * buf);
-	ssize_t (*store)(struct device * dev, const char * buf, size_t count);
+	ssize_t (*show)(struct device * dev, char * buf, void * private);
+	ssize_t (*store)(struct device * dev, const char * buf, size_t count,
+			void * private);
 };
 
 #define DEVICE_ATTR(_name,_mode,_show,_store) \







                 reply	other threads:[~2005-05-11  7:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2538186705051100563e884f2f@mail.gmail.com \
    --to=yani.ioannou@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@stimpy.netroedge.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