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
Kirill Smelkov
linux
Commits
27b3d11b
Commit
27b3d11b
authored
Dec 30, 2002
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] more i2c cruft removal
* version code checks for pre-2.4 version * !__KERNEL__ stuff in headers.
parent
3c363821
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
236 deletions
+10
-236
drivers/i2c/i2c-adap-ite.c
drivers/i2c/i2c-adap-ite.c
+0
-6
drivers/i2c/i2c-philips-par.c
drivers/i2c/i2c-philips-par.c
+0
-16
drivers/i2c/i2c-proc.c
drivers/i2c/i2c-proc.c
+1
-9
include/linux/i2c-dev.h
include/linux/i2c-dev.h
+3
-174
include/linux/i2c.h
include/linux/i2c.h
+6
-31
No files found.
drivers/i2c/i2c-adap-ite.c
View file @
27b3d11b
...
@@ -61,11 +61,7 @@ static int own = 0;
...
@@ -61,11 +61,7 @@ static int own = 0;
static
int
i2c_debug
=
0
;
static
int
i2c_debug
=
0
;
static
struct
iic_ite
gpi
;
static
struct
iic_ite
gpi
;
#if (LINUX_VERSION_CODE < 0x020301)
static
struct
wait_queue
*
iic_wait
=
NULL
;
#else
static
wait_queue_head_t
iic_wait
;
static
wait_queue_head_t
iic_wait
;
#endif
static
int
iic_pending
;
static
int
iic_pending
;
/* ----- global defines ----------------------------------------------- */
/* ----- global defines ----------------------------------------------- */
...
@@ -236,9 +232,7 @@ static int __init iic_ite_init(void)
...
@@ -236,9 +232,7 @@ static int __init iic_ite_init(void)
piic
->
iic_own
=
own
;
piic
->
iic_own
=
own
;
iic_ite_data
.
data
=
(
void
*
)
piic
;
iic_ite_data
.
data
=
(
void
*
)
piic
;
#if (LINUX_VERSION_CODE >= 0x020301)
init_waitqueue_head
(
&
iic_wait
);
init_waitqueue_head
(
&
iic_wait
);
#endif
if
(
iic_hw_resrc_init
()
==
0
)
{
if
(
iic_hw_resrc_init
()
==
0
)
{
if
(
i2c_iic_add_bus
(
&
iic_ite_ops
)
<
0
)
if
(
i2c_iic_add_bus
(
&
iic_ite_ops
)
<
0
)
return
-
ENODEV
;
return
-
ENODEV
;
...
...
drivers/i2c/i2c-philips-par.c
View file @
27b3d11b
...
@@ -228,41 +228,25 @@ static void i2c_parport_detach (struct parport *port)
...
@@ -228,41 +228,25 @@ static void i2c_parport_detach (struct parport *port)
}
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
static
struct
parport_driver
i2c_driver
=
{
static
struct
parport_driver
i2c_driver
=
{
"i2c-philips-par"
,
"i2c-philips-par"
,
i2c_parport_attach
,
i2c_parport_attach
,
i2c_parport_detach
,
i2c_parport_detach
,
NULL
NULL
};
};
#endif
int
__init
i2c_bitlp_init
(
void
)
int
__init
i2c_bitlp_init
(
void
)
{
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,4)
struct
parport
*
port
;
#endif
printk
(
KERN_INFO
"i2c-philips-par.o: i2c Philips parallel port adapter module version %s (%s)
\n
"
,
I2C_VERSION
,
I2C_DATE
);
printk
(
KERN_INFO
"i2c-philips-par.o: i2c Philips parallel port adapter module version %s (%s)
\n
"
,
I2C_VERSION
,
I2C_DATE
);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
parport_register_driver
(
&
i2c_driver
);
parport_register_driver
(
&
i2c_driver
);
#else
for
(
port
=
parport_enumerate
();
port
;
port
=
port
->
next
)
i2c_parport_attach
(
port
);
#endif
return
0
;
return
0
;
}
}
void
__exit
i2c_bitlp_exit
(
void
)
void
__exit
i2c_bitlp_exit
(
void
)
{
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
parport_unregister_driver
(
&
i2c_driver
);
parport_unregister_driver
(
&
i2c_driver
);
#else
struct
parport
*
port
;
for
(
port
=
parport_enumerate
();
port
;
port
=
port
->
next
)
i2c_parport_detach
(
port
);
#endif
}
}
MODULE_AUTHOR
(
"Simon G. Vogl <simon@tk.uni-linz.ac.at>"
);
MODULE_AUTHOR
(
"Simon G. Vogl <simon@tk.uni-linz.ac.at>"
);
...
...
drivers/i2c/i2c-proc.c
View file @
27b3d11b
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
This driver puts entries in /proc/sys/dev/sensors for each I2C device
This driver puts entries in /proc/sys/dev/sensors for each I2C device
*/
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/slab.h>
...
@@ -31,14 +30,10 @@
...
@@ -31,14 +30,10 @@
#include <linux/sysctl.h>
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/ioport.h>
#include <asm/uaccess.h>
#include <linux/i2c.h>
#include <linux/i2c.h>
#include <linux/i2c-proc.h>
#include <linux/i2c-proc.h>
#include <linux/init.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
static
int
i2c_create_name
(
char
**
name
,
const
char
*
prefix
,
static
int
i2c_create_name
(
char
**
name
,
const
char
*
prefix
,
struct
i2c_adapter
*
adapter
,
int
addr
);
struct
i2c_adapter
*
adapter
,
int
addr
);
...
@@ -56,7 +51,6 @@ static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
...
@@ -56,7 +51,6 @@ static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
#define SENSORS_ENTRY_MAX 20
#define SENSORS_ENTRY_MAX 20
static
struct
ctl_table_header
*
i2c_entries
[
SENSORS_ENTRY_MAX
];
static
struct
ctl_table_header
*
i2c_entries
[
SENSORS_ENTRY_MAX
];
static
unsigned
short
i2c_inodes
[
SENSORS_ENTRY_MAX
];
static
struct
i2c_client
*
i2c_clients
[
SENSORS_ENTRY_MAX
];
static
struct
i2c_client
*
i2c_clients
[
SENSORS_ENTRY_MAX
];
...
@@ -197,8 +191,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
...
@@ -197,8 +191,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return
id
;
return
id
;
}
}
#endif
/* DEBUG */
#endif
/* DEBUG */
i2c_inodes
[
id
-
256
]
=
new_header
->
ctl_table
->
child
->
child
->
de
->
low_ino
;
new_header
->
ctl_table
->
child
->
child
->
de
->
owner
=
controlling_mod
;
new_header
->
ctl_table
->
child
->
child
->
de
->
owner
=
controlling_mod
;
return
id
;
return
id
;
...
...
include/linux/i2c-dev.h
View file @
27b3d11b
...
@@ -21,9 +21,8 @@
...
@@ -21,9 +21,8 @@
/* $Id: i2c-dev.h,v 1.11 2002/07/07 15:42:47 mds Exp $ */
/* $Id: i2c-dev.h,v 1.11 2002/07/07 15:42:47 mds Exp $ */
#ifndef I2C_DEV_H
#ifndef _LINUX_I2C_DEV_H
#define I2C_DEV_H
#define _LINUX_I2C_DEV_H
#include <linux/types.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include <linux/i2c.h>
...
@@ -45,174 +44,4 @@ struct i2c_rdwr_ioctl_data {
...
@@ -45,174 +44,4 @@ struct i2c_rdwr_ioctl_data {
int
nmsgs
;
/* number of i2c_msgs */
int
nmsgs
;
/* number of i2c_msgs */
};
};
#ifndef __KERNEL__
#endif
/* _LINUX_I2C_DEV_H */
#include <sys/ioctl.h>
static
inline
__s32
i2c_smbus_access
(
int
file
,
char
read_write
,
__u8
command
,
int
size
,
union
i2c_smbus_data
*
data
)
{
struct
i2c_smbus_ioctl_data
args
;
args
.
read_write
=
read_write
;
args
.
command
=
command
;
args
.
size
=
size
;
args
.
data
=
data
;
return
ioctl
(
file
,
I2C_SMBUS
,
&
args
);
}
static
inline
__s32
i2c_smbus_write_quick
(
int
file
,
__u8
value
)
{
return
i2c_smbus_access
(
file
,
value
,
0
,
I2C_SMBUS_QUICK
,
NULL
);
}
static
inline
__s32
i2c_smbus_read_byte
(
int
file
)
{
union
i2c_smbus_data
data
;
if
(
i2c_smbus_access
(
file
,
I2C_SMBUS_READ
,
0
,
I2C_SMBUS_BYTE
,
&
data
))
return
-
1
;
else
return
0x0FF
&
data
.
byte
;
}
static
inline
__s32
i2c_smbus_write_byte
(
int
file
,
__u8
value
)
{
return
i2c_smbus_access
(
file
,
I2C_SMBUS_WRITE
,
value
,
I2C_SMBUS_BYTE
,
NULL
);
}
static
inline
__s32
i2c_smbus_read_byte_data
(
int
file
,
__u8
command
)
{
union
i2c_smbus_data
data
;
if
(
i2c_smbus_access
(
file
,
I2C_SMBUS_READ
,
command
,
I2C_SMBUS_BYTE_DATA
,
&
data
))
return
-
1
;
else
return
0x0FF
&
data
.
byte
;
}
static
inline
__s32
i2c_smbus_write_byte_data
(
int
file
,
__u8
command
,
__u8
value
)
{
union
i2c_smbus_data
data
;
data
.
byte
=
value
;
return
i2c_smbus_access
(
file
,
I2C_SMBUS_WRITE
,
command
,
I2C_SMBUS_BYTE_DATA
,
&
data
);
}
static
inline
__s32
i2c_smbus_read_word_data
(
int
file
,
__u8
command
)
{
union
i2c_smbus_data
data
;
if
(
i2c_smbus_access
(
file
,
I2C_SMBUS_READ
,
command
,
I2C_SMBUS_WORD_DATA
,
&
data
))
return
-
1
;
else
return
0x0FFFF
&
data
.
word
;
}
static
inline
__s32
i2c_smbus_write_word_data
(
int
file
,
__u8
command
,
__u16
value
)
{
union
i2c_smbus_data
data
;
data
.
word
=
value
;
return
i2c_smbus_access
(
file
,
I2C_SMBUS_WRITE
,
command
,
I2C_SMBUS_WORD_DATA
,
&
data
);
}
static
inline
__s32
i2c_smbus_process_call
(
int
file
,
__u8
command
,
__u16
value
)
{
union
i2c_smbus_data
data
;
data
.
word
=
value
;
if
(
i2c_smbus_access
(
file
,
I2C_SMBUS_WRITE
,
command
,
I2C_SMBUS_PROC_CALL
,
&
data
))
return
-
1
;
else
return
0x0FFFF
&
data
.
word
;
}
/* Returns the number of read bytes */
static
inline
__s32
i2c_smbus_read_block_data
(
int
file
,
__u8
command
,
__u8
*
values
)
{
union
i2c_smbus_data
data
;
int
i
;
if
(
i2c_smbus_access
(
file
,
I2C_SMBUS_READ
,
command
,
I2C_SMBUS_BLOCK_DATA
,
&
data
))
return
-
1
;
else
{
for
(
i
=
1
;
i
<=
data
.
block
[
0
];
i
++
)
values
[
i
-
1
]
=
data
.
block
[
i
];
return
data
.
block
[
0
];
}
}
static
inline
__s32
i2c_smbus_write_block_data
(
int
file
,
__u8
command
,
__u8
length
,
__u8
*
values
)
{
union
i2c_smbus_data
data
;
int
i
;
if
(
length
>
32
)
length
=
32
;
for
(
i
=
1
;
i
<=
length
;
i
++
)
data
.
block
[
i
]
=
values
[
i
-
1
];
data
.
block
[
0
]
=
length
;
return
i2c_smbus_access
(
file
,
I2C_SMBUS_WRITE
,
command
,
I2C_SMBUS_BLOCK_DATA
,
&
data
);
}
/* Returns the number of read bytes */
static
inline
__s32
i2c_smbus_read_i2c_block_data
(
int
file
,
__u8
command
,
__u8
*
values
)
{
union
i2c_smbus_data
data
;
int
i
;
if
(
i2c_smbus_access
(
file
,
I2C_SMBUS_READ
,
command
,
I2C_SMBUS_I2C_BLOCK_DATA
,
&
data
))
return
-
1
;
else
{
for
(
i
=
1
;
i
<=
data
.
block
[
0
];
i
++
)
values
[
i
-
1
]
=
data
.
block
[
i
];
return
data
.
block
[
0
];
}
}
static
inline
__s32
i2c_smbus_write_i2c_block_data
(
int
file
,
__u8
command
,
__u8
length
,
__u8
*
values
)
{
union
i2c_smbus_data
data
;
int
i
;
if
(
length
>
32
)
length
=
32
;
for
(
i
=
1
;
i
<=
length
;
i
++
)
data
.
block
[
i
]
=
values
[
i
-
1
];
data
.
block
[
0
]
=
length
;
return
i2c_smbus_access
(
file
,
I2C_SMBUS_WRITE
,
command
,
I2C_SMBUS_I2C_BLOCK_DATA
,
&
data
);
}
/* Returns the number of read bytes */
static
inline
__s32
i2c_smbus_block_process_call
(
int
file
,
__u8
command
,
__u8
length
,
__u8
*
values
)
{
union
i2c_smbus_data
data
;
int
i
;
if
(
length
>
32
)
length
=
32
;
for
(
i
=
1
;
i
<=
length
;
i
++
)
data
.
block
[
i
]
=
values
[
i
-
1
];
data
.
block
[
0
]
=
length
;
if
(
i2c_smbus_access
(
file
,
I2C_SMBUS_WRITE
,
command
,
I2C_SMBUS_BLOCK_PROC_CALL
,
&
data
))
return
-
1
;
else
{
for
(
i
=
1
;
i
<=
data
.
block
[
0
];
i
++
)
values
[
i
-
1
]
=
data
.
block
[
i
];
return
data
.
block
[
0
];
}
}
#endif
/* ndef __KERNEL__ */
#endif
include/linux/i2c.h
View file @
27b3d11b
...
@@ -25,31 +25,17 @@
...
@@ -25,31 +25,17 @@
/* $Id: i2c.h,v 1.59 2002/07/19 20:53:45 phil Exp $ */
/* $Id: i2c.h,v 1.59 2002/07/19 20:53:45 phil Exp $ */
#ifndef I2C_H
#ifndef
_LINUX_
I2C_H
#define I2C_H
#define
_LINUX_
I2C_H
#define I2C_DATE "20020719"
#define I2C_DATE "20020719"
#define I2C_VERSION "2.6.4"
#define I2C_VERSION "2.6.4"
#include <linux/i2c-id.h>
/* id values of adapters et. al. */
#include <linux/i2c-id.h>
/* id values of adapters et. al. */
#include <linux/types.h>
#include <linux/types.h>
struct
i2c_msg
;
#ifdef __KERNEL__
/* --- Includes and compatibility declarations ------------------------ */
#include <linux/version.h>
#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
#endif
#include <asm/page.h>
/* for 2.2.xx */
#include <asm/semaphore.h>
#include <linux/config.h>
#include <linux/config.h>
#include <asm/semaphore.h>
/* --- General options ------------------------------------------------ */
/* --- General options ------------------------------------------------ */
...
@@ -59,6 +45,7 @@ struct i2c_msg;
...
@@ -59,6 +45,7 @@ struct i2c_msg;
#define I2C_CLIENT_MAX 32
#define I2C_CLIENT_MAX 32
#define I2C_DUMMY_MAX 4
#define I2C_DUMMY_MAX 4
struct
i2c_msg
;
struct
i2c_algorithm
;
struct
i2c_algorithm
;
struct
i2c_adapter
;
struct
i2c_adapter
;
struct
i2c_client
;
struct
i2c_client
;
...
@@ -212,10 +199,6 @@ struct i2c_algorithm {
...
@@ -212,10 +199,6 @@ struct i2c_algorithm {
u32
(
*
functionality
)
(
struct
i2c_adapter
*
);
u32
(
*
functionality
)
(
struct
i2c_adapter
*
);
};
};
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)
struct
proc_dir_entry
;
#endif
/*
/*
* i2c_adapter is the structure used to identify a physical i2c bus along
* i2c_adapter is the structure used to identify a physical i2c bus along
* with the access algorithms necessary to access it.
* with the access algorithms necessary to access it.
...
@@ -250,9 +233,6 @@ struct i2c_adapter {
...
@@ -250,9 +233,6 @@ struct i2c_adapter {
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
/* No need to set this when you initialize the adapter */
/* No need to set this when you initialize the adapter */
int
inode
;
int
inode
;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)
struct
proc_dir_entry
*
proc_entry
;
#endif
#endif
/* def CONFIG_PROC_FS */
#endif
/* def CONFIG_PROC_FS */
};
};
...
@@ -355,8 +335,6 @@ extern u32 i2c_get_functionality (struct i2c_adapter *adap);
...
@@ -355,8 +335,6 @@ extern u32 i2c_get_functionality (struct i2c_adapter *adap);
/* Return 1 if adapter supports everything we need, 0 if not. */
/* Return 1 if adapter supports everything we need, 0 if not. */
extern
int
i2c_check_functionality
(
struct
i2c_adapter
*
adap
,
u32
func
);
extern
int
i2c_check_functionality
(
struct
i2c_adapter
*
adap
,
u32
func
);
#endif
/* __KERNEL__ */
/*
/*
* I2C Message - used for pure i2c transaction, also from /dev interface
* I2C Message - used for pure i2c transaction, also from /dev interface
*/
*/
...
@@ -506,8 +484,6 @@ union i2c_smbus_data {
...
@@ -506,8 +484,6 @@ union i2c_smbus_data {
#define I2C_MAJOR 89
/* Device major number */
#define I2C_MAJOR 89
/* Device major number */
#ifdef __KERNEL__
# ifndef NULL
# ifndef NULL
# define NULL ( (void *) 0 )
# define NULL ( (void *) 0 )
# endif
# endif
...
@@ -577,5 +553,4 @@ union i2c_smbus_data {
...
@@ -577,5 +553,4 @@ union i2c_smbus_data {
#define i2c_is_isa_adapter(adapptr) \
#define i2c_is_isa_adapter(adapptr) \
((adapptr)->algo->id == I2C_ALGO_ISA)
((adapptr)->algo->id == I2C_ALGO_ISA)
#endif
/* def __KERNEL__ */
#endif
/* _LINUX_I2C_H */
#endif
/* I2C_H */
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