Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
50fb80a9
Commit
50fb80a9
authored
Mar 20, 2003
by
Greg Kroah-Hartman
Committed by
Petr Vandrovec
Mar 20, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i2c: remove i2c_adapter->name and use dev->name instead.
parent
e99edf79
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
105 additions
and
106 deletions
+105
-106
drivers/i2c/busses/i2c-ali15x3.c
drivers/i2c/busses/i2c-ali15x3.c
+5
-3
drivers/i2c/busses/i2c-amd756.c
drivers/i2c/busses/i2c-amd756.c
+4
-2
drivers/i2c/busses/i2c-amd8111.c
drivers/i2c/busses/i2c-amd8111.c
+2
-2
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-i801.c
+5
-3
drivers/i2c/busses/i2c-isa.c
drivers/i2c/busses/i2c-isa.c
+3
-1
drivers/i2c/busses/i2c-piix4.c
drivers/i2c/busses/i2c-piix4.c
+5
-3
drivers/i2c/i2c-algo-bit.c
drivers/i2c/i2c-algo-bit.c
+6
-7
drivers/i2c/i2c-algo-pcf.c
drivers/i2c/i2c-algo-pcf.c
+9
-10
drivers/i2c/i2c-core.c
drivers/i2c/i2c-core.c
+31
-42
drivers/i2c/i2c-dev.c
drivers/i2c/i2c-dev.c
+7
-10
drivers/i2c/i2c-elektor.c
drivers/i2c/i2c-elektor.c
+6
-4
drivers/i2c/i2c-elv.c
drivers/i2c/i2c-elv.c
+3
-1
drivers/i2c/i2c-philips-par.c
drivers/i2c/i2c-philips-par.c
+3
-1
drivers/i2c/i2c-velleman.c
drivers/i2c/i2c-velleman.c
+3
-1
drivers/i2c/scx200_acb.c
drivers/i2c/scx200_acb.c
+13
-15
include/linux/i2c.h
include/linux/i2c.h
+0
-1
No files found.
drivers/i2c/busses/i2c-ali15x3.c
View file @
50fb80a9
...
...
@@ -474,9 +474,11 @@ static struct i2c_algorithm smbus_algorithm = {
static
struct
i2c_adapter
ali15x3_adapter
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"unset"
,
.
id
=
I2C_ALGO_SMBUS
|
I2C_HW_SMBUS_ALI15X3
,
.
algo
=
&
smbus_algorithm
,
.
dev
=
{
.
name
=
"unset"
,
},
};
static
struct
pci_device_id
ali15x3_ids
[]
__devinitdata
=
{
...
...
@@ -500,8 +502,8 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
/* set up the driverfs linkage to our parent device */
ali15x3_adapter
.
dev
.
parent
=
&
dev
->
dev
;
s
printf
(
ali15x3_adapter
.
name
,
"SMBus ALI15X3 adapter at %04x"
,
ali15x3_smba
);
s
nprintf
(
ali15x3_adapter
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"SMBus ALI15X3 adapter at %04x"
,
ali15x3_smba
);
return
i2c_add_adapter
(
&
ali15x3_adapter
);
}
...
...
drivers/i2c/busses/i2c-amd756.c
View file @
50fb80a9
...
...
@@ -312,9 +312,11 @@ static struct i2c_algorithm smbus_algorithm = {
static
struct
i2c_adapter
amd756_adapter
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"unset"
,
.
id
=
I2C_ALGO_SMBUS
|
I2C_HW_SMBUS_AMD756
,
.
algo
=
&
smbus_algorithm
,
.
dev
=
{
.
name
=
"unset"
,
},
};
enum
chiptype
{
AMD756
,
AMD766
,
AMD768
,
NFORCE
};
...
...
@@ -376,7 +378,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
/* set up the driverfs linkage to our parent device */
amd756_adapter
.
dev
.
parent
=
&
pdev
->
dev
;
s
printf
(
amd756_adapter
.
name
,
s
nprintf
(
amd756_adapter
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"SMBus AMD75x adapter at %04x"
,
amd756_ioport
);
error
=
i2c_add_adapter
(
&
amd756_adapter
);
...
...
drivers/i2c/busses/i2c-amd8111.c
View file @
50fb80a9
...
...
@@ -357,8 +357,8 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
goto
out_kfree
;
smbus
->
adapter
.
owner
=
THIS_MODULE
;
s
printf
(
smbus
->
adapter
.
name
,
"SMBus2 AMD8111 adapter at %04x"
,
smbus
->
base
);
s
nprintf
(
smbus
->
adapter
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"SMBus2 AMD8111 adapter at %04x"
,
smbus
->
base
);
smbus
->
adapter
.
id
=
I2C_ALGO_SMBUS
|
I2C_HW_SMBUS_AMD8111
;
smbus
->
adapter
.
algo
=
&
smbus_algorithm
;
smbus
->
adapter
.
algo_data
=
smbus
;
...
...
drivers/i2c/busses/i2c-i801.c
View file @
50fb80a9
...
...
@@ -546,9 +546,11 @@ static struct i2c_algorithm smbus_algorithm = {
static
struct
i2c_adapter
i801_adapter
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"unset"
,
.
id
=
I2C_ALGO_SMBUS
|
I2C_HW_SMBUS_I801
,
.
algo
=
&
smbus_algorithm
,
.
dev
=
{
.
name
=
"unset"
,
},
};
static
struct
pci_device_id
i801_ids
[]
__devinitdata
=
{
...
...
@@ -597,8 +599,8 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
/* set up the driverfs linkage to our parent device */
i801_adapter
.
dev
.
parent
=
&
dev
->
dev
;
s
printf
(
i801_adapter
.
name
,
"SMBus I801 adapter at %04x"
,
i801_smba
);
s
nprintf
(
i801_adapter
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"SMBus I801 adapter at %04x"
,
i801_smba
);
return
i2c_add_adapter
(
&
i801_adapter
);
}
...
...
drivers/i2c/busses/i2c-isa.c
View file @
50fb80a9
...
...
@@ -39,9 +39,11 @@ static struct i2c_algorithm isa_algorithm = {
/* There can only be one... */
static
struct
i2c_adapter
isa_adapter
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"ISA main adapter"
,
.
id
=
I2C_ALGO_ISA
|
I2C_HW_ISA
,
.
algo
=
&
isa_algorithm
,
.
dev
=
{
.
name
=
"ISA main adapter"
,
},
};
static
int
__init
i2c_isa_init
(
void
)
...
...
drivers/i2c/busses/i2c-piix4.c
View file @
50fb80a9
...
...
@@ -394,9 +394,11 @@ static struct i2c_algorithm smbus_algorithm = {
static
struct
i2c_adapter
piix4_adapter
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"unset"
,
.
id
=
I2C_ALGO_SMBUS
|
I2C_HW_SMBUS_PIIX4
,
.
algo
=
&
smbus_algorithm
,
.
dev
=
{
.
name
=
"unset"
,
},
};
static
struct
pci_device_id
piix4_ids
[]
__devinitdata
=
{
...
...
@@ -449,8 +451,8 @@ static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id
/* set up the driverfs linkage to our parent device */
piix4_adapter
.
dev
.
parent
=
&
dev
->
dev
;
s
printf
(
piix4_adapter
.
name
,
"SMBus PIIX4 adapter at %04x"
,
piix4_smba
);
s
nprintf
(
piix4_adapter
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"SMBus PIIX4 adapter at %04x"
,
piix4_smba
);
retval
=
i2c_add_adapter
(
&
piix4_adapter
);
...
...
drivers/i2c/i2c-algo-bit.c
View file @
50fb80a9
...
...
@@ -23,6 +23,8 @@
/* $Id: i2c-algo-bit.c,v 1.44 2003/01/21 08:08:16 kmalkki Exp $ */
/* #define DEBUG 1 */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h>
...
...
@@ -338,16 +340,14 @@ static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
while
(
count
>
0
)
{
c
=
*
temp
;
DEB2
(
printk
(
KERN_DEBUG
"i2c-algo-bit.o: %s sendbytes: writing %2.2X
\n
"
,
i2c_adap
->
name
,
c
&
0xff
));
DEB2
(
dev_dbg
(
&
i2c_adap
->
dev
,
"sendbytes: writing %2.2X
\n
"
,
c
&
0xff
));
retval
=
i2c_outb
(
i2c_adap
,
c
);
if
((
retval
>
0
)
||
(
nak_ok
&&
(
retval
==
0
)))
{
/* ok or ignored NAK */
count
--
;
temp
++
;
wrcount
++
;
}
else
{
/* arbitration or no acknowledge */
printk
(
KERN_ERR
"i2c-algo-bit.o: %s sendbytes: error - bailout.
\n
"
,
i2c_adap
->
name
);
dev_err
(
&
i2c_adap
->
dev
,
"sendbytes: error - bailout.
\n
"
);
i2c_stop
(
adap
);
return
(
retval
<
0
)
?
retval
:
-
EFAULT
;
/* got a better one ?? */
...
...
@@ -527,13 +527,12 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
struct
i2c_algo_bit_data
*
bit_adap
=
adap
->
algo_data
;
if
(
bit_test
)
{
int
ret
=
test_bus
(
bit_adap
,
adap
->
name
);
int
ret
=
test_bus
(
bit_adap
,
adap
->
dev
.
name
);
if
(
ret
<
0
)
return
-
ENODEV
;
}
DEB2
(
printk
(
KERN_DEBUG
"i2c-algo-bit.o: hw routines for %s registered.
\n
"
,
adap
->
name
));
DEB2
(
dev_dbg
(
&
adap
->
dev
,
"hw routines registered.
\n
"
));
/* register new adapter to i2c module... */
...
...
drivers/i2c/i2c-algo-pcf.c
View file @
50fb80a9
...
...
@@ -27,6 +27,8 @@
messages, proper stop/repstart signaling during receive,
added detect code */
/* #define DEBUG 1 */
/* to pick up dev_dbg calls */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h>
...
...
@@ -222,21 +224,19 @@ static int pcf_sendbytes(struct i2c_adapter *i2c_adap, const char *buf,
int
wrcount
,
status
,
timeout
;
for
(
wrcount
=
0
;
wrcount
<
count
;
++
wrcount
)
{
DEB2
(
printk
(
KERN_DEBUG
"i2c-algo-pcf.o: %s
i2c_write: writing %2.2X
\n
"
,
i2c_adap
->
name
,
buf
[
wrcount
]
&
0xff
));
DEB2
(
dev_dbg
(
&
i2c_adap
->
dev
,
"
i2c_write: writing %2.2X
\n
"
,
buf
[
wrcount
]
&
0xff
));
i2c_outb
(
adap
,
buf
[
wrcount
]);
timeout
=
wait_for_pin
(
adap
,
&
status
);
if
(
timeout
)
{
i2c_stop
(
adap
);
printk
(
KERN_ERR
"i2c-algo-pcf.o: %s i2c_write: "
"error - timeout.
\n
"
,
i2c_adap
->
name
);
dev_err
(
&
i2c_adap
->
dev
,
"i2c_write: error - timeout.
\n
"
);
return
-
EREMOTEIO
;
/* got a better one ?? */
}
#ifndef STUB_I2C
if
(
status
&
I2C_PCF_LRB
)
{
i2c_stop
(
adap
);
printk
(
KERN_ERR
"i2c-algo-pcf.o: %s i2c_write: "
"error - no ack.
\n
"
,
i2c_adap
->
name
);
dev_err
(
&
i2c_adap
->
dev
,
"i2c_write: error - no ack.
\n
"
);
return
-
EREMOTEIO
;
/* got a better one ?? */
}
#endif
...
...
@@ -263,14 +263,14 @@ static int pcf_readbytes(struct i2c_adapter *i2c_adap, char *buf,
if
(
wait_for_pin
(
adap
,
&
status
))
{
i2c_stop
(
adap
);
printk
(
KERN_ERR
"i2c-algo-pcf.o:
pcf_readbytes timed out.
\n
"
);
dev_err
(
&
i2c_adap
->
dev
,
"
pcf_readbytes timed out.
\n
"
);
return
(
-
1
);
}
#ifndef STUB_I2C
if
((
status
&
I2C_PCF_LRB
)
&&
(
i
!=
count
))
{
i2c_stop
(
adap
);
printk
(
KERN_ERR
"i2c-algo-pcf.o:
i2c_read: i2c_inb, No ack.
\n
"
);
dev_err
(
&
i2c_adap
->
dev
,
"
i2c_read: i2c_inb, No ack.
\n
"
);
return
(
-
1
);
}
#endif
...
...
@@ -445,8 +445,7 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
struct
i2c_algo_pcf_data
*
pcf_adap
=
adap
->
algo_data
;
int
rval
;
DEB2
(
printk
(
KERN_DEBUG
"i2c-algo-pcf.o: hw routines for %s registered.
\n
"
,
adap
->
name
));
DEB2
(
dev_dbg
(
&
adap
->
dev
,
"hw routines registered.
\n
"
));
/* register new adapter to i2c module... */
...
...
drivers/i2c/i2c-core.c
View file @
50fb80a9
...
...
@@ -23,6 +23,8 @@
/* $Id: i2c-core.c,v 1.95 2003/01/22 05:25:08 kmalkki Exp $ */
/* #define DEBUG 1 */
/* needed to pick up the dev_dbg() calls */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
...
...
@@ -82,9 +84,8 @@ int i2c_add_adapter(struct i2c_adapter *adap)
if
(
NULL
==
adapters
[
i
])
break
;
if
(
I2C_ADAP_MAX
==
i
)
{
printk
(
KERN_WARNING
" i2c-core.o: register_adapter(%s) - enlarge I2C_ADAP_MAX.
\n
"
,
adap
->
name
);
dev_warn
(
&
adap
->
dev
,
"register_adapter - enlarge I2C_ADAP_MAX.
\n
"
);
res
=
-
ENOMEM
;
goto
out_unlock
;
}
...
...
@@ -105,7 +106,6 @@ int i2c_add_adapter(struct i2c_adapter *adap)
if
(
adap
->
dev
.
parent
==
NULL
)
adap
->
dev
.
parent
=
&
legacy_bus
;
sprintf
(
adap
->
dev
.
bus_id
,
"i2c-%d"
,
i
);
strcpy
(
adap
->
dev
.
name
,
"i2c controller"
);
device_register
(
&
adap
->
dev
);
/* inform drivers of new adapters */
...
...
@@ -116,8 +116,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
drivers
[
j
]
->
attach_adapter
(
adap
);
up
(
&
core_lists
);
DEB
(
printk
(
KERN_DEBUG
"i2c-core.o: adapter %s registered as adapter %d.
\n
"
,
adap
->
name
,
i
));
DEB
(
dev_dbg
(
&
adap
->
dev
,
"registered as adapter %d.
\n
"
,
i
));
out_unlock:
up
(
&
core_lists
);
...
...
@@ -134,8 +133,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
if
(
adap
==
adapters
[
i
])
break
;
if
(
I2C_ADAP_MAX
==
i
)
{
printk
(
KERN_WARNING
"i2c-core.o: unregister_adapter adap [%s] not found.
\n
"
,
adap
->
name
);
dev_warn
(
&
adap
->
dev
,
"unregister_adapter adap not found.
\n
"
);
res
=
-
ENODEV
;
goto
out_unlock
;
}
...
...
@@ -148,9 +146,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
for
(
j
=
0
;
j
<
I2C_DRIVER_MAX
;
j
++
)
if
(
drivers
[
j
]
&&
(
drivers
[
j
]
->
flags
&
I2C_DF_DUMMY
))
if
((
res
=
drivers
[
j
]
->
attach_adapter
(
adap
)))
{
printk
(
KERN_WARNING
"i2c-core.o: can't detach adapter %s
"
dev_warn
(
&
adap
->
dev
,
"can't detach adapter
"
"while detaching driver %s: driver not "
"detached!"
,
adap
->
name
,
drivers
[
j
]
->
name
);
"detached!"
,
drivers
[
j
]
->
name
);
goto
out_unlock
;
}
...
...
@@ -164,10 +162,10 @@ int i2c_del_adapter(struct i2c_adapter *adap)
* must be deleted, as this would cause invalid states.
*/
if
((
res
=
client
->
driver
->
detach_client
(
client
)))
{
printk
(
KERN_ERR
"i2c-core.o: adapter %s
not "
dev_err
(
&
adap
->
dev
,
"adapter
not "
"unregistered, because client at "
"address %02x can't be detached. "
,
adap
->
name
,
client
->
addr
);
client
->
addr
);
goto
out_unlock
;
}
}
...
...
@@ -180,7 +178,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
adapters
[
i
]
=
NULL
;
DEB
(
printk
(
KERN_DEBUG
"i2c-core.o: adapter unregistered: %s
\n
"
,
adap
->
name
));
DEB
(
dev_dbg
(
&
adap
->
dev
,
"adapter unregistered
\n
"
));
out_unlock:
up
(
&
core_lists
);
...
...
@@ -272,8 +270,7 @@ int i2c_del_driver(struct i2c_driver *driver)
struct
i2c_adapter
*
adap
=
adapters
[
k
];
if
(
adap
==
NULL
)
/* skip empty entries. */
continue
;
DEB2
(
printk
(
KERN_DEBUG
"i2c-core.o: examining adapter %s:
\n
"
,
adap
->
name
));
DEB2
(
dev_dbg
(
&
adap
->
dev
,
"examining adapter
\n
"
));
if
(
driver
->
flags
&
I2C_DF_DUMMY
)
{
/* DUMMY drivers do not register their clients, so we have to
* use a trick here: we call driver->attach_adapter to
...
...
@@ -281,11 +278,10 @@ int i2c_del_driver(struct i2c_driver *driver)
* this or hell will break loose...
*/
if
((
res
=
driver
->
attach_adapter
(
adap
)))
{
printk
(
KERN_WARNING
"i2c-core.o:
while unregistering "
"dummy driver %s, adapter
%s
could "
dev_warn
(
&
adap
->
dev
,
"
while unregistering "
"dummy driver %s, adapter could "
"not be detached properly; driver "
"not unloaded!"
,
driver
->
name
,
adap
->
name
);
"not unloaded!"
,
driver
->
name
);
goto
out_unlock
;
}
}
else
{
...
...
@@ -296,19 +292,16 @@ int i2c_del_driver(struct i2c_driver *driver)
DEB2
(
printk
(
KERN_DEBUG
"i2c-core.o: "
"detaching client %s:
\n
"
,
client
->
name
));
if
((
res
=
driver
->
detach_client
(
client
)))
{
printk
(
KERN_ERR
"i2c-core.o: while "
if
((
res
=
driver
->
detach_client
(
client
)))
{
dev_err
(
&
adap
->
dev
,
"while "
"unregistering driver "
"`%s', the client at "
"address %02x of "
"adapter
`%s'
could not "
"adapter could not "
"be detached; driver "
"not unloaded!"
,
driver
->
name
,
client
->
addr
,
adap
->
name
);
client
->
addr
);
goto
out_unlock
;
}
}
...
...
@@ -374,16 +367,14 @@ int i2c_attach_client(struct i2c_client *client)
if
(
adapter
->
client_register
)
{
if
(
adapter
->
client_register
(
client
))
{
printk
(
KERN_DEBUG
"i2c-core.o: warning: client_register seems "
"to have failed for client %02x at adapter %s
\n
"
,
client
->
addr
,
adapter
->
name
);
dev_warn
(
&
adapter
->
dev
,
"warning: client_register "
"seems to have failed for client %02x
\n
"
,
client
->
addr
);
}
}
DEB
(
printk
(
KERN_DEBUG
"i2c-core.o: client [%s] registered to adapter [%s] "
"(pos. %d).
\n
"
,
client
->
name
,
adapter
->
name
,
i
));
DEB
(
dev_dbg
(
&
adapter
->
dev
,
"client [%s] registered to adapter "
"(pos. %d).
\n
"
,
client
->
name
,
i
));
if
(
client
->
flags
&
I2C_CLIENT_ALLOW_USE
)
client
->
usage_count
=
0
;
...
...
@@ -579,7 +570,7 @@ static int bus_i2c_show(struct seq_file *s, void *p)
seq_printf
(
s
,
"dummy "
);
seq_printf
(
s
,
"
\t
%-32s
\t
%-32s
\n
"
,
adapter
->
name
,
adapter
->
algo
->
name
);
adapter
->
dev
.
name
,
adapter
->
algo
->
name
);
}
up
(
&
core_lists
);
...
...
@@ -688,8 +679,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num)
int
ret
;
if
(
adap
->
algo
->
master_xfer
)
{
DEB2
(
printk
(
KERN_DEBUG
"i2c-core.o: master_xfer: %s with %d msgs.
\n
"
,
adap
->
name
,
num
));
DEB2
(
dev_dbg
(
&
adap
->
dev
,
"master_xfer: with %d msgs.
\n
"
,
num
));
down
(
&
adap
->
bus
);
ret
=
adap
->
algo
->
master_xfer
(
adap
,
msgs
,
num
);
...
...
@@ -697,8 +687,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num)
return
ret
;
}
else
{
printk
(
KERN_ERR
"i2c-core.o: I2C adapter %04x: I2C level transfers not supported
\n
"
,
adap
->
id
);
dev_err
(
&
adap
->
dev
,
"I2C level transfers not supported
\n
"
);
return
-
ENOSYS
;
}
}
...
...
@@ -715,8 +704,8 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
msg
.
len
=
count
;
(
const
char
*
)
msg
.
buf
=
buf
;
DEB2
(
printk
(
KERN_DEBUG
"i2c-core.o: master_send: writing %d bytes on %
s.
\n
"
,
count
,
client
->
adapter
->
name
));
DEB2
(
dev_dbg
(
&
client
->
adapter
->
dev
,
"master_send: writing %d byte
s.
\n
"
,
count
));
down
(
&
adap
->
bus
);
ret
=
adap
->
algo
->
master_xfer
(
adap
,
&
msg
,
1
);
...
...
@@ -745,8 +734,8 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
msg
.
len
=
count
;
msg
.
buf
=
buf
;
DEB2
(
printk
(
KERN_DEBUG
"i2c-core.o: master_recv: reading %d bytes on %
s.
\n
"
,
count
,
client
->
adapter
->
name
));
DEB2
(
dev_dbg
(
&
client
->
adapter
->
dev
,
"master_recv: reading %d byte
s.
\n
"
,
count
));
down
(
&
adap
->
bus
);
ret
=
adap
->
algo
->
master_xfer
(
adap
,
&
msg
,
1
);
...
...
drivers/i2c/i2c-dev.c
View file @
50fb80a9
...
...
@@ -30,6 +30,9 @@
/* $Id: i2c-dev.c,v 1.53 2003/01/21 08:08:16 kmalkki Exp $ */
/* If you want debugging uncomment: */
/* #define DEBUG 1 */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fs.h>
...
...
@@ -41,10 +44,6 @@
#include <linux/i2c-dev.h>
#include <asm/uaccess.h>
/* If you want debugging uncomment: */
/* #define DEBUG */
/* struct file_operations changed too often in the 2.1 series for nice code */
static
ssize_t
i2cdev_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
...
...
@@ -386,11 +385,11 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap)
char
name
[
12
];
if
((
i
=
i2c_adapter_id
(
adap
))
<
0
)
{
printk
(
KERN_DEBUG
"i2c-dev.o:
Unknown adapter ?!?
\n
"
);
dev_dbg
(
&
adap
->
dev
,
"
Unknown adapter ?!?
\n
"
);
return
-
ENODEV
;
}
if
(
i
>=
I2CDEV_ADAPS_MAX
)
{
printk
(
KERN_DEBUG
"i2c-dev.o:
Adapter number too large?!? (%d)
\n
"
,
i
);
dev_dbg
(
&
adap
->
dev
,
"
Adapter number too large?!? (%d)
\n
"
,
i
);
return
-
ENODEV
;
}
...
...
@@ -401,14 +400,12 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap)
DEVFS_FL_DEFAULT
,
I2C_MAJOR
,
i
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
,
&
i2cdev_fops
,
NULL
);
printk
(
KERN_DEBUG
"i2c-dev.o: Registered '%s' as minor %d
\n
"
,
adap
->
name
,
i
);
dev_dbg
(
&
adap
->
dev
,
"Registered as minor %d
\n
"
,
i
);
}
else
{
/* This is actually a detach_adapter call! */
devfs_remove
(
"i2c/%d"
,
i
);
i2cdev_adaps
[
i
]
=
NULL
;
#ifdef DEBUG
printk
(
KERN_DEBUG
"i2c-dev.o: Adapter unregistered: %s
\n
"
,
adap
->
name
);
#endif
dev_dbg
(
&
adap
->
dev
,
"Adapter unregistered
\n
"
);
}
return
0
;
...
...
drivers/i2c/i2c-elektor.c
View file @
50fb80a9
...
...
@@ -174,10 +174,12 @@ static struct i2c_algo_pcf_data pcf_isa_data = {
};
static
struct
i2c_adapter
pcf_isa_ops
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"PCF8584 ISA adapter"
,
.
id
=
I2C_HW_P_ELEK
,
.
algo_data
=
&
pcf_isa_data
,
.
owner
=
THIS_MODULE
,
.
id
=
I2C_HW_P_ELEK
,
.
algo_data
=
&
pcf_isa_data
,
.
dev
=
{
.
name
=
"PCF8584 ISA adapter"
,
},
};
static
int
__init
i2c_pcfisa_init
(
void
)
...
...
drivers/i2c/i2c-elv.c
View file @
50fb80a9
...
...
@@ -129,9 +129,11 @@ static struct i2c_algo_bit_data bit_elv_data = {
static
struct
i2c_adapter
bit_elv_ops
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"ELV Parallel port adaptor"
,
.
id
=
I2C_HW_B_ELV
,
.
algo_data
=
&
bit_elv_data
,
.
dev
=
{
.
name
=
"ELV Parallel port adaptor"
,
},
};
static
int
__init
i2c_bitelv_init
(
void
)
...
...
drivers/i2c/i2c-philips-par.c
View file @
50fb80a9
...
...
@@ -151,8 +151,10 @@ static struct i2c_algo_bit_data bit_lp_data2 = {
static
struct
i2c_adapter
bit_lp_ops
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"Philips Parallel port adapter"
,
.
id
=
I2C_HW_B_LP
,
.
dev
=
{
.
name
=
"Philips Parallel port adapter"
,
},
};
static
void
i2c_parport_attach
(
struct
parport
*
port
)
...
...
drivers/i2c/i2c-velleman.c
View file @
50fb80a9
...
...
@@ -114,9 +114,11 @@ static struct i2c_algo_bit_data bit_velle_data = {
static
struct
i2c_adapter
bit_velle_ops
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"Velleman K8000"
,
.
id
=
I2C_HW_B_VELLE
,
.
algo_data
=
&
bit_velle_data
,
.
dev
=
{
.
name
=
"Velleman K8000"
,
},
};
static
int
__init
i2c_bitvelle_init
(
void
)
...
...
drivers/i2c/scx200_acb.c
View file @
50fb80a9
...
...
@@ -140,8 +140,7 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
switch
(
iface
->
state
)
{
case
state_idle
:
printk
(
KERN_WARNING
NAME
": %s, interrupt in idle state
\n
"
,
iface
->
adapter
.
name
);
dev_warn
(
&
iface
->
adapter
.
dev
,
"interrupt in idle state
\n
"
,);
break
;
case
state_address
:
...
...
@@ -226,8 +225,8 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
return
;
error:
printk
(
KERN_ERR
NAME
": %s, %s in state %s
\n
"
,
iface
->
adapter
.
name
,
errmsg
,
scx200_acb_state_name
[
iface
->
state
]);
dev_err
(
&
iface
->
adapter
.
dev
,
"%s in state %s
\n
"
,
errmsg
,
scx200_acb_state_name
[
iface
->
state
]);
iface
->
state
=
state_idle
;
iface
->
result
=
-
EIO
;
...
...
@@ -236,8 +235,8 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
static
void
scx200_acb_timeout
(
struct
scx200_acb_iface
*
iface
)
{
printk
(
KERN_ERR
NAME
": %s, timeout in state %s
\n
"
,
iface
->
adapter
.
name
,
scx200_acb_state_name
[
iface
->
state
]);
dev_err
(
&
iface
->
adapter
.
dev
,
"timeout in state %s
\n
"
,
scx200_acb_state_name
[
iface
->
state
]);
iface
->
state
=
state_idle
;
iface
->
result
=
-
EIO
;
...
...
@@ -331,13 +330,12 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter,
size
,
address
,
command
,
len
,
rw
==
I2C_SMBUS_READ
);
if
(
!
len
&&
rw
==
I2C_SMBUS_READ
)
{
printk
(
KERN_WARNING
NAME
": %s, zero length read
\n
"
,
adapter
->
name
);
dev_warn
(
&
adapter
->
dev
,
"zero length read
\n
"
);
return
-
EINVAL
;
}
if
(
len
&&
!
buffer
)
{
printk
(
KERN_WARNING
NAME
": %s, nonzero length but no buffer
\n
"
,
adapter
->
name
);
dev_warn
(
&
adapter
->
dev
,
"nonzero length but no buffer
\n
"
);
return
-
EFAULT
;
}
...
...
@@ -458,17 +456,17 @@ static int __init scx200_acb_create(int base, int index)
memset
(
iface
,
0
,
sizeof
(
*
iface
));
adapter
=
&
iface
->
adapter
;
adapter
->
data
=
iface
;
s
printf
(
adapter
->
name
,
"SCx200 ACB%d"
,
index
);
s
nprintf
(
adapter
->
dev
.
name
,
DEVICE_NAME_SIZE
,
"SCx200 ACB%d"
,
index
);
adapter
->
owner
=
THIS_MODULE
;
adapter
->
id
=
I2C_ALGO_SMBUS
;
adapter
->
algo
=
&
scx200_acb_algorithm
;
init_MUTEX
(
&
iface
->
sem
);
s
printf
(
description
,
"NatSemi SCx200 ACCESS.bus [%s]"
,
adapter
->
name
);
s
nprintf
(
description
,
sizeof
(
description
),
"NatSemi SCx200 ACCESS.bus [%s]"
,
adapter
->
dev
.
name
);
if
(
request_region
(
base
,
8
,
description
)
==
0
)
{
printk
(
KERN_ERR
NAME
": %s, can't allocate io 0x%x-0x%x
\n
"
,
adapter
->
name
,
base
,
base
+
8
-
1
);
dev_err
(
&
adapter
->
dev
,
"can't allocate io 0x%x-0x%x
\n
"
,
base
,
base
+
8
-
1
);
rc
=
-
EBUSY
;
goto
errout
;
}
...
...
@@ -476,14 +474,14 @@ static int __init scx200_acb_create(int base, int index)
rc
=
scx200_acb_probe
(
iface
);
if
(
rc
)
{
printk
(
KERN_WARNING
NAME
": %s, probe failed
\n
"
,
adapter
->
name
);
dev_warn
(
&
adapter
->
dev
,
"probe failed
\n
"
);
goto
errout
;
}
scx200_acb_reset
(
iface
);
if
(
i2c_add_adapter
(
adapter
)
<
0
)
{
printk
(
KERN_ERR
NAME
": %s, failed to register
\n
"
,
adapter
->
name
);
dev_err
(
&
adapter
->
dev
,
"failed to register
\n
"
);
rc
=
-
ENODEV
;
goto
errout
;
}
...
...
include/linux/i2c.h
View file @
50fb80a9
...
...
@@ -210,7 +210,6 @@ struct i2c_algorithm {
*/
struct
i2c_adapter
{
struct
module
*
owner
;
char
name
[
32
];
/* some useful name to identify the adapter */
unsigned
int
id
;
/* == is algo->id | hwdep.struct->id, */
/* for registered values see below */
struct
i2c_algorithm
*
algo
;
/* the algorithm to access the bus */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment