From: khali@linux-fr.org (Jean Delvare)
To: LKML <linux-kernel@vger.kernel.org>,
LM Sensors <lm-sensors@lm-sensors.org>
Cc: Greg KH <greg@kroah.com>
Subject: [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from
Date: Tue, 19 Jul 2005 23:58:18 +0000 [thread overview]
Message-ID: <20050719235754.487f4bf1.khali@linux-fr.org> (raw)
In-Reply-To: <20050719233902.40282559.khali@linux-fr.org>
Kill all isa-related stuff from i2c_detect, it's not used anymore.
This is one major step in the directiom of merging i2c_probe and
i2c_detect. The last obstacle I can think of is the different way forced
addresses work between sensors and non-sensors i2c drivers. I'll deal
with that in a later patchset.
drivers/i2c/i2c-sensor-detect.c | 45 +++++++++++-----------------------------
1 files changed, 13 insertions(+), 32 deletions(-)
--- linux-2.6.13-rc3.orig/drivers/i2c/i2c-sensor-detect.c 2005-06-18 09:32:15.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/i2c-sensor-detect.c 2005-07-17 14:27:26.000000000 +0200
@@ -25,42 +25,34 @@
#include <linux/i2c-sensor.h>
static unsigned short empty[] = {I2C_CLIENT_END};
-static unsigned int empty_isa[] = {I2C_CLIENT_ISA_END};
-/* Very inefficient for ISA detects, and won't work for 10-bit addresses! */
+/* Won't work for 10-bit addresses! */
int i2c_detect(struct i2c_adapter *adapter,
struct i2c_address_data *address_data,
int (*found_proc) (struct i2c_adapter *, int, int))
{
int addr, i, found, j, err;
struct i2c_force_data *this_force;
- int is_isa = i2c_is_isa_adapter(adapter);
- int adapter_id - is_isa ? ANY_I2C_ISA_BUS : i2c_adapter_id(adapter);
+ int adapter_id = i2c_adapter_id(adapter);
unsigned short *normal_i2c;
- unsigned int *normal_isa;
unsigned short *probe;
unsigned short *ignore;
/* Forget it if we can't probe using SMBUS_QUICK */
- if ((!is_isa) &&
- !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK))
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK))
return -1;
/* Use default "empty" list if the adapter doesn't specify any */
normal_i2c = probe = ignore = empty;
- normal_isa = empty_isa;
if (address_data->normal_i2c)
normal_i2c = address_data->normal_i2c;
- if (address_data->normal_isa)
- normal_isa = address_data->normal_isa;
if (address_data->probe)
probe = address_data->probe;
if (address_data->ignore)
ignore = address_data->ignore;
- for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) {
- if (!is_isa && i2c_check_addr(adapter, addr))
+ for (addr = 0x00; addr <= 0x7f; addr++) {
+ if (i2c_check_addr(adapter, addr))
continue;
/* If it is in one of the force entries, we don't do any
@@ -69,7 +61,7 @@
for (i = 0; !found && (this_force = address_data->forces + i, this_force->force); i++) {
for (j = 0; !found && (this_force->force[j] != I2C_CLIENT_END); j += 2) {
if ( ((adapter_id = this_force->force[j]) ||
- ((this_force->force[j] = ANY_I2C_BUS) && !is_isa)) &&
+ (this_force->force[j] = ANY_I2C_BUS)) &&
(addr = this_force->force[j + 1]) ) {
dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr);
if ((err = found_proc(adapter, addr, this_force->kind)))
@@ -85,8 +77,7 @@
right now */
for (i = 0; !found && (ignore[i] != I2C_CLIENT_END); i += 2) {
if ( ((adapter_id = ignore[i]) ||
- ((ignore[i] = ANY_I2C_BUS) &&
- !is_isa)) &&
+ (ignore[i] = ANY_I2C_BUS)) &&
(addr = ignore[i + 1])) {
dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, addr %04x\n", adapter_id, addr);
found = 1;
@@ -97,19 +88,10 @@
/* Now, we will do a detection, but only if it is in the normal or
probe entries */
- if (is_isa) {
- for (i = 0; !found && (normal_isa[i] != I2C_CLIENT_ISA_END); i += 1) {
- if (addr = normal_isa[i]) {
- dev_dbg(&adapter->dev, "found normal isa entry for adapter %d, addr %04x\n", adapter_id, addr);
- found = 1;
- }
- }
- } else {
- for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
- if (addr = normal_i2c[i]) {
- found = 1;
- dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
- }
+ for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
+ if (addr = normal_i2c[i]) {
+ found = 1;
+ dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
}
}
@@ -117,7 +99,7 @@
!found && (probe[i] != I2C_CLIENT_END);
i += 2) {
if (((adapter_id = probe[i]) ||
- ((probe[i] = ANY_I2C_BUS) && !is_isa))
+ (probe[i] = ANY_I2C_BUS))
&& (addr = probe[i + 1])) {
dev_dbg(&adapter->dev, "found probe parameter for adapter %d, addr %04x\n", adapter_id, addr);
found = 1;
@@ -128,8 +110,7 @@
/* OK, so we really should examine this address. First check
whether there is some client here at all! */
- if (is_isa ||
- (i2c_smbus_xfer (adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0))
+ if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0)
if ((err = found_proc(adapter, addr, -1)))
return err;
}
--
Jean Delvare
WARNING: multiple messages have this Message-ID (diff)
From: Jean Delvare <khali@linux-fr.org>
To: LKML <linux-kernel@vger.kernel.org>,
LM Sensors <lm-sensors@lm-sensors.org>
Cc: Greg KH <greg@kroah.com>
Subject: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (6/9)
Date: Tue, 19 Jul 2005 23:57:54 +0200 [thread overview]
Message-ID: <20050719235754.487f4bf1.khali@linux-fr.org> (raw)
In-Reply-To: <20050719233902.40282559.khali@linux-fr.org>
Kill all isa-related stuff from i2c_detect, it's not used anymore.
This is one major step in the directiom of merging i2c_probe and
i2c_detect. The last obstacle I can think of is the different way forced
addresses work between sensors and non-sensors i2c drivers. I'll deal
with that in a later patchset.
drivers/i2c/i2c-sensor-detect.c | 45 +++++++++++-----------------------------
1 files changed, 13 insertions(+), 32 deletions(-)
--- linux-2.6.13-rc3.orig/drivers/i2c/i2c-sensor-detect.c 2005-06-18 09:32:15.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/i2c-sensor-detect.c 2005-07-17 14:27:26.000000000 +0200
@@ -25,42 +25,34 @@
#include <linux/i2c-sensor.h>
static unsigned short empty[] = {I2C_CLIENT_END};
-static unsigned int empty_isa[] = {I2C_CLIENT_ISA_END};
-/* Very inefficient for ISA detects, and won't work for 10-bit addresses! */
+/* Won't work for 10-bit addresses! */
int i2c_detect(struct i2c_adapter *adapter,
struct i2c_address_data *address_data,
int (*found_proc) (struct i2c_adapter *, int, int))
{
int addr, i, found, j, err;
struct i2c_force_data *this_force;
- int is_isa = i2c_is_isa_adapter(adapter);
- int adapter_id =
- is_isa ? ANY_I2C_ISA_BUS : i2c_adapter_id(adapter);
+ int adapter_id = i2c_adapter_id(adapter);
unsigned short *normal_i2c;
- unsigned int *normal_isa;
unsigned short *probe;
unsigned short *ignore;
/* Forget it if we can't probe using SMBUS_QUICK */
- if ((!is_isa) &&
- !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK))
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK))
return -1;
/* Use default "empty" list if the adapter doesn't specify any */
normal_i2c = probe = ignore = empty;
- normal_isa = empty_isa;
if (address_data->normal_i2c)
normal_i2c = address_data->normal_i2c;
- if (address_data->normal_isa)
- normal_isa = address_data->normal_isa;
if (address_data->probe)
probe = address_data->probe;
if (address_data->ignore)
ignore = address_data->ignore;
- for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) {
- if (!is_isa && i2c_check_addr(adapter, addr))
+ for (addr = 0x00; addr <= 0x7f; addr++) {
+ if (i2c_check_addr(adapter, addr))
continue;
/* If it is in one of the force entries, we don't do any
@@ -69,7 +61,7 @@
for (i = 0; !found && (this_force = address_data->forces + i, this_force->force); i++) {
for (j = 0; !found && (this_force->force[j] != I2C_CLIENT_END); j += 2) {
if ( ((adapter_id == this_force->force[j]) ||
- ((this_force->force[j] == ANY_I2C_BUS) && !is_isa)) &&
+ (this_force->force[j] == ANY_I2C_BUS)) &&
(addr == this_force->force[j + 1]) ) {
dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr);
if ((err = found_proc(adapter, addr, this_force->kind)))
@@ -85,8 +77,7 @@
right now */
for (i = 0; !found && (ignore[i] != I2C_CLIENT_END); i += 2) {
if ( ((adapter_id == ignore[i]) ||
- ((ignore[i] == ANY_I2C_BUS) &&
- !is_isa)) &&
+ (ignore[i] == ANY_I2C_BUS)) &&
(addr == ignore[i + 1])) {
dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, addr %04x\n", adapter_id, addr);
found = 1;
@@ -97,19 +88,10 @@
/* Now, we will do a detection, but only if it is in the normal or
probe entries */
- if (is_isa) {
- for (i = 0; !found && (normal_isa[i] != I2C_CLIENT_ISA_END); i += 1) {
- if (addr == normal_isa[i]) {
- dev_dbg(&adapter->dev, "found normal isa entry for adapter %d, addr %04x\n", adapter_id, addr);
- found = 1;
- }
- }
- } else {
- for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
- if (addr == normal_i2c[i]) {
- found = 1;
- dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
- }
+ for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
+ if (addr == normal_i2c[i]) {
+ found = 1;
+ dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
}
}
@@ -117,7 +99,7 @@
!found && (probe[i] != I2C_CLIENT_END);
i += 2) {
if (((adapter_id == probe[i]) ||
- ((probe[i] == ANY_I2C_BUS) && !is_isa))
+ (probe[i] == ANY_I2C_BUS))
&& (addr == probe[i + 1])) {
dev_dbg(&adapter->dev, "found probe parameter for adapter %d, addr %04x\n", adapter_id, addr);
found = 1;
@@ -128,8 +110,7 @@
/* OK, so we really should examine this address. First check
whether there is some client here at all! */
- if (is_isa ||
- (i2c_smbus_xfer (adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0))
+ if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0)
if ((err = found_proc(adapter, addr, -1)))
return err;
}
--
Jean Delvare
next prev parent reply other threads:[~2005-07-19 23:58 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
2005-07-19 23:39 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-19 21:45 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9) Jean Delvare
2005-07-19 23:46 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-20 4:26 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9) Greg KH
2005-07-20 21:03 ` Jean Delvare
2005-07-20 23:04 ` [lm-sensors] Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers Jean Delvare
2005-07-19 21:48 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Jean Delvare
2005-07-19 23:49 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-20 4:27 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Greg KH
2005-07-20 21:46 ` Jean Delvare
2005-07-20 23:46 ` [lm-sensors] Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers Jean Delvare
2005-07-25 0:35 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Greg KH
2005-07-25 6:22 ` [lm-sensors] Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers Greg KH
2005-07-25 17:28 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Jean Delvare
2005-07-25 19:28 ` [lm-sensors] Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers Jean Delvare
2005-07-26 22:54 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Greg KH
2005-07-27 0:55 ` [lm-sensors] Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers Greg KH
2005-07-27 20:21 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Jean Delvare
2005-07-27 22:21 ` [lm-sensors] Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers Jean Delvare
2005-07-19 21:51 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (3/9) Jean Delvare
2005-07-19 23:51 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-19 21:53 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (4/9) Jean Delvare
2005-07-19 23:53 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-19 21:56 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9) Jean Delvare
2005-07-19 23:57 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-26 22:33 ` patch i2c-hwmon-split-05.patch added to gregkh-2.6 tree gregkh
2005-07-27 0:33 ` [lm-sensors] " gregkh
2005-07-19 21:57 ` Jean Delvare [this message]
2005-07-19 23:58 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-19 22:02 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9) Jean Delvare
2005-07-20 0:02 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-19 22:05 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (8/9) Jean Delvare
2005-07-20 0:06 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-26 22:33 ` patch i2c-hwmon-split-08.patch added to gregkh-2.6 tree gregkh
2005-07-27 0:33 ` [lm-sensors] " gregkh
2005-07-19 22:09 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (9/9) Jean Delvare
2005-07-20 0:09 ` [lm-sensors] [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from Jean Delvare
2005-07-26 22:33 ` patch i2c-hwmon-split-09.patch added to gregkh-2.6 tree gregkh
2005-07-27 0:33 ` [lm-sensors] " gregkh
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=20050719235754.487f4bf1.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.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 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.