From: greg@kroah.com (Greg KH)
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: [PATCH] More i2c driver changes for 2.5.69
Date: Thu, 19 May 2005 06:23:56 +0000 [thread overview]
Message-ID: <10525245932907@kroah.com> (raw)
In-Reply-To: <20030509235504.GD3517@kroah.com>
In-Reply-To: <1048295086481@kroah.com>
ChangeSet 1.1083.2.1, 2003/05/09 13:53:57-07:00, greg@kroah.com
[PATCH] i2c: add i2c_adapter class support
drivers/i2c/i2c-core.c | 23 ++++++++++++++++++++---
include/linux/i2c.h | 3 ++-
2 files changed, 22 insertions(+), 4 deletions(-)
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c Fri May 9 16:48:30 2003
+++ b/drivers/i2c/i2c-core.c Fri May 9 16:48:30 2003
@@ -62,6 +62,10 @@
.remove = i2c_device_remove,
};
+static struct class i2c_adapter_class = {
+ .name = "i2c-adapter"
+};
+
/* ---------------------------------------------------
* registering functions
@@ -97,6 +101,13 @@
adap->dev.driver = &i2c_generic_driver;
device_register(&adap->dev);
+ /* Add this adapter to the i2c_adapter class */
+ memset(&adap->class_dev, 0x00, sizeof(struct class_device));
+ adap->class_dev.dev = &adap->dev;
+ adap->class_dev.class = &i2c_adapter_class;
+ strncpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE);
+ class_device_register(&adap->class_dev);
+
/* inform drivers of new adapters */
list_for_each(item,&drivers) {
driver = list_entry(item, struct i2c_driver, list);
@@ -150,6 +161,7 @@
}
/* clean up the sysfs representation */
+ class_device_unregister(&adap->class_dev);
device_unregister(&adap->dev);
list_del(&adap->list);
@@ -443,14 +455,19 @@
.match = i2c_device_match,
};
-
static int __init i2c_init(void)
{
- return bus_register(&i2c_bus_type);
+ int retval;
+
+ retval = bus_register(&i2c_bus_type);
+ if (retval)
+ return retval;
+ return class_register(&i2c_adapter_class);
}
static void __exit i2c_exit(void)
{
+ class_unregister(&i2c_adapter_class);
bus_unregister(&i2c_bus_type);
}
@@ -475,7 +492,7 @@
return ret;
} else {
- dev_err(&adap->dev, "I2C level transfers not supported\n");
+ DEB2(dev_dbg(&adap->dev, "I2C level transfers not supported\n"));
return -ENOSYS;
}
}
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h Fri May 9 16:48:30 2003
+++ b/include/linux/i2c.h Fri May 9 16:48:30 2003
@@ -240,7 +240,8 @@
int timeout;
int retries;
- struct device dev; /* the adapter device */
+ struct device dev; /* the adapter device */
+ struct class_device class_dev; /* the class device */
#ifdef CONFIG_PROC_FS
/* No need to set this when you initialize the adapter */
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: [PATCH] More i2c driver changes for 2.5.69
Date: Fri, 9 May 2003 16:56:33 -0700 [thread overview]
Message-ID: <10525245932907@kroah.com> (raw)
In-Reply-To: <20030509235504.GD3517@kroah.com>
ChangeSet 1.1083.2.1, 2003/05/09 13:53:57-07:00, greg@kroah.com
[PATCH] i2c: add i2c_adapter class support
drivers/i2c/i2c-core.c | 23 ++++++++++++++++++++---
include/linux/i2c.h | 3 ++-
2 files changed, 22 insertions(+), 4 deletions(-)
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c Fri May 9 16:48:30 2003
+++ b/drivers/i2c/i2c-core.c Fri May 9 16:48:30 2003
@@ -62,6 +62,10 @@
.remove = i2c_device_remove,
};
+static struct class i2c_adapter_class = {
+ .name = "i2c-adapter"
+};
+
/* ---------------------------------------------------
* registering functions
@@ -97,6 +101,13 @@
adap->dev.driver = &i2c_generic_driver;
device_register(&adap->dev);
+ /* Add this adapter to the i2c_adapter class */
+ memset(&adap->class_dev, 0x00, sizeof(struct class_device));
+ adap->class_dev.dev = &adap->dev;
+ adap->class_dev.class = &i2c_adapter_class;
+ strncpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE);
+ class_device_register(&adap->class_dev);
+
/* inform drivers of new adapters */
list_for_each(item,&drivers) {
driver = list_entry(item, struct i2c_driver, list);
@@ -150,6 +161,7 @@
}
/* clean up the sysfs representation */
+ class_device_unregister(&adap->class_dev);
device_unregister(&adap->dev);
list_del(&adap->list);
@@ -443,14 +455,19 @@
.match = i2c_device_match,
};
-
static int __init i2c_init(void)
{
- return bus_register(&i2c_bus_type);
+ int retval;
+
+ retval = bus_register(&i2c_bus_type);
+ if (retval)
+ return retval;
+ return class_register(&i2c_adapter_class);
}
static void __exit i2c_exit(void)
{
+ class_unregister(&i2c_adapter_class);
bus_unregister(&i2c_bus_type);
}
@@ -475,7 +492,7 @@
return ret;
} else {
- dev_err(&adap->dev, "I2C level transfers not supported\n");
+ DEB2(dev_dbg(&adap->dev, "I2C level transfers not supported\n"));
return -ENOSYS;
}
}
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h Fri May 9 16:48:30 2003
+++ b/include/linux/i2c.h Fri May 9 16:48:30 2003
@@ -240,7 +240,8 @@
int timeout;
int retries;
- struct device dev; /* the adapter device */
+ struct device dev; /* the adapter device */
+ struct class_device class_dev; /* the class device */
#ifdef CONFIG_PROC_FS
/* No need to set this when you initialize the adapter */
next prev parent reply other threads:[~2005-05-19 6:23 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-09 23:55 [BK PATCH] More i2c driver changes for 2.5.69 Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH [this message]
2005-05-19 6:23 ` [PATCH] " Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2003-06-11 20:35 [BK PATCH] More i2c driver changes for 2.5.70 Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` [PATCH] " Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-12 2:40 ` Philip Pokorny
2005-05-19 6:23 ` Philip Pokorny
2003-04-03 0:14 [BK PATCH] More i2c driver changes for 2.5.66 Greg KH
2003-04-03 0:15 ` [PATCH] " Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 6:21 ` Albert Cranford
2005-05-19 6:23 ` Albert Cranford
2003-04-03 6:33 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-04-03 13:06 ` Albert Cranford
2005-05-19 6:23 ` Albert Cranford
2003-04-03 16:37 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 [BK PATCH] More i2c driver changes for 2.5.65 Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` [PATCH] " Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-25 9:35 ` Pavel Machek
2005-05-19 6:23 ` Pavel Machek
2003-03-25 1:29 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-25 2:04 ` Dave Jones
2005-05-19 6:23 ` Dave Jones
2003-03-25 3:34 ` Greg KH
2005-05-19 6:23 ` Greg KH
2005-05-19 6:23 ` [PATCH] More i2c driver changes for 2.5.66 Greg KH
2005-05-19 6:23 ` Mark M. Hoffman
2005-05-19 6:23 ` Albert Cranford
2005-05-19 6:23 ` [PATCH] More i2c driver changes for 2.5.69 Philip Pokorny
2003-03-22 2:33 ` [PATCH] More i2c driver changes for 2.5.65 Petr Vandrovec
2005-05-19 6:23 ` Petr Vandrovec
2003-03-23 8:49 ` Greg KH
2005-05-19 6:23 ` Greg KH
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=10525245932907@kroah.com \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.