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
3371decd
Commit
3371decd
authored
Apr 23, 2003
by
Greg Kroah-Hartman
Committed by
Christoph Hellwig
Apr 23, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] i2c: fix up it87.c check_region mess.
parent
5d9ccbf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
drivers/i2c/chips/it87.c
drivers/i2c/chips/it87.c
+16
-22
No files found.
drivers/i2c/chips/it87.c
View file @
3371decd
...
@@ -224,7 +224,6 @@ static inline u8 FAN_TO_REG(long rpm, int div)
...
@@ -224,7 +224,6 @@ static inline u8 FAN_TO_REG(long rpm, int div)
allocated. */
allocated. */
struct
it87_data
{
struct
it87_data
{
struct
semaphore
lock
;
struct
semaphore
lock
;
int
sysctl_id
;
enum
chips
type
;
enum
chips
type
;
struct
semaphore
update_lock
;
struct
semaphore
update_lock
;
...
@@ -533,22 +532,21 @@ static int it87_attach_adapter(struct i2c_adapter *adapter)
...
@@ -533,22 +532,21 @@ static int it87_attach_adapter(struct i2c_adapter *adapter)
int
it87_detect
(
struct
i2c_adapter
*
adapter
,
int
address
,
int
kind
)
int
it87_detect
(
struct
i2c_adapter
*
adapter
,
int
address
,
int
kind
)
{
{
int
i
;
int
i
;
struct
i2c_client
*
new_client
;
struct
i2c_client
*
new_client
=
NULL
;
struct
it87_data
*
data
;
struct
it87_data
*
data
;
int
err
=
0
;
int
err
=
0
;
const
char
*
name
=
""
;
const
char
*
name
=
""
;
const
char
*
client_name
=
""
;
const
char
*
client_name
=
""
;
int
is_isa
=
i2c_is_isa_adapter
(
adapter
);
int
is_isa
=
i2c_is_isa_adapter
(
adapter
);
if
(
!
is_isa
if
(
!
is_isa
&&
&&
!
i2c_check_functionality
(
adapter
,
!
i2c_check_functionality
(
adapter
,
I2C_FUNC_SMBUS_BYTE_DATA
))
I2C_FUNC_SMBUS_BYTE_DATA
))
goto
goto
ERROR0
;
ERROR0
;
if
(
is_isa
)
{
/* Reserve the ISA region */
if
(
check_region
(
address
,
IT87_EXTENT
))
if
(
is_isa
)
if
(
!
request_region
(
address
,
IT87_EXTENT
,
name
))
goto
ERROR0
;
goto
ERROR0
;
}
/* Probe whether there is anything available on this address. Already
/* Probe whether there is anything available on this address. Already
done for SMBus clients */
done for SMBus clients */
...
@@ -560,11 +558,11 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
...
@@ -560,11 +558,11 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
if we read 'undefined' registers. */
if we read 'undefined' registers. */
i
=
inb_p
(
address
+
1
);
i
=
inb_p
(
address
+
1
);
if
(
inb_p
(
address
+
2
)
!=
i
)
if
(
inb_p
(
address
+
2
)
!=
i
)
goto
ERROR
0
;
goto
ERROR
1
;
if
(
inb_p
(
address
+
3
)
!=
i
)
if
(
inb_p
(
address
+
3
)
!=
i
)
goto
ERROR
0
;
goto
ERROR
1
;
if
(
inb_p
(
address
+
7
)
!=
i
)
if
(
inb_p
(
address
+
7
)
!=
i
)
goto
ERROR
0
;
goto
ERROR
1
;
#undef REALLY_SLOW_IO
#undef REALLY_SLOW_IO
/* Let's just hope nothing breaks here */
/* Let's just hope nothing breaks here */
...
@@ -585,7 +583,7 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
...
@@ -585,7 +583,7 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
sizeof
(
struct
it87_data
),
sizeof
(
struct
it87_data
),
GFP_KERNEL
)))
{
GFP_KERNEL
)))
{
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
ERROR
0
;
goto
ERROR
1
;
}
}
data
=
(
struct
it87_data
*
)
(
new_client
+
1
);
data
=
(
struct
it87_data
*
)
(
new_client
+
1
);
...
@@ -635,10 +633,6 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
...
@@ -635,10 +633,6 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
goto
ERROR1
;
goto
ERROR1
;
}
}
/* Reserve the ISA region */
if
(
is_isa
)
request_region
(
address
,
IT87_EXTENT
,
name
);
/* Fill in the remaining client fields and put it into the global list */
/* Fill in the remaining client fields and put it into the global list */
strncpy
(
new_client
->
dev
.
name
,
name
,
DEVICE_NAME_SIZE
);
strncpy
(
new_client
->
dev
.
name
,
name
,
DEVICE_NAME_SIZE
);
...
@@ -650,7 +644,7 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
...
@@ -650,7 +644,7 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
/* Tell the I2C layer a new client has arrived */
/* Tell the I2C layer a new client has arrived */
if
((
err
=
i2c_attach_client
(
new_client
)))
if
((
err
=
i2c_attach_client
(
new_client
)))
goto
ERROR
2
;
goto
ERROR
1
;
/* register sysfs hooks */
/* register sysfs hooks */
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_input0
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_input0
);
...
@@ -689,12 +683,12 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
...
@@ -689,12 +683,12 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
it87_init_client
(
new_client
);
it87_init_client
(
new_client
);
return
0
;
return
0
;
ERROR2:
ERROR1:
kfree
(
new_client
);
if
(
is_isa
)
if
(
is_isa
)
release_region
(
address
,
IT87_EXTENT
);
release_region
(
address
,
IT87_EXTENT
);
ERROR1:
ERROR0:
kfree
(
new_client
);
ERROR0:
return
err
;
return
err
;
}
}
...
...
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