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
c5b529b3
Commit
c5b529b3
authored
Jan 26, 2004
by
Marcel Sebek
Committed by
Vojtech Pavlik
Jan 26, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: Use request_region() instead of check_region() in ns558.c
it's both safer and correct.
parent
e2bf29ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
drivers/input/gameport/ns558.c
drivers/input/gameport/ns558.c
+24
-11
No files found.
drivers/input/gameport/ns558.c
View file @
c5b529b3
...
@@ -77,7 +77,7 @@ static void ns558_isa_probe(int io)
...
@@ -77,7 +77,7 @@ static void ns558_isa_probe(int io)
* No one should be using this address.
* No one should be using this address.
*/
*/
if
(
check_region
(
io
,
1
))
if
(
!
request_region
(
io
,
1
,
"ns558-isa"
))
return
;
return
;
/*
/*
...
@@ -89,7 +89,8 @@ static void ns558_isa_probe(int io)
...
@@ -89,7 +89,8 @@ static void ns558_isa_probe(int io)
outb
(
~
c
&
~
3
,
io
);
outb
(
~
c
&
~
3
,
io
);
if
(
~
(
u
=
v
=
inb
(
io
))
&
3
)
{
if
(
~
(
u
=
v
=
inb
(
io
))
&
3
)
{
outb
(
c
,
io
);
outb
(
c
,
io
);
return
;
i
=
0
;
goto
out
;
}
}
/*
/*
* After a trigger, there must be at least some bits changing.
* After a trigger, there must be at least some bits changing.
...
@@ -99,7 +100,8 @@ static void ns558_isa_probe(int io)
...
@@ -99,7 +100,8 @@ static void ns558_isa_probe(int io)
if
(
u
==
v
)
{
if
(
u
==
v
)
{
outb
(
c
,
io
);
outb
(
c
,
io
);
return
;
i
=
0
;
goto
out
;
}
}
wait_ms
(
3
);
wait_ms
(
3
);
/*
/*
...
@@ -110,7 +112,8 @@ static void ns558_isa_probe(int io)
...
@@ -110,7 +112,8 @@ static void ns558_isa_probe(int io)
for
(
i
=
0
;
i
<
1000
;
i
++
)
for
(
i
=
0
;
i
<
1000
;
i
++
)
if
((
u
^
inb
(
io
))
&
0xf
)
{
if
((
u
^
inb
(
io
))
&
0xf
)
{
outb
(
c
,
io
);
outb
(
c
,
io
);
return
;
i
=
0
;
goto
out
;
}
}
/*
/*
* And now find the number of mirrors of the port.
* And now find the number of mirrors of the port.
...
@@ -118,7 +121,9 @@ static void ns558_isa_probe(int io)
...
@@ -118,7 +121,9 @@ static void ns558_isa_probe(int io)
for
(
i
=
1
;
i
<
5
;
i
++
)
{
for
(
i
=
1
;
i
<
5
;
i
++
)
{
if
(
check_region
(
io
&
(
-
1
<<
i
),
(
1
<<
i
)))
/* Don't disturb anyone */
release_region
(
io
&
(
-
1
<<
(
i
-
1
)),
(
1
<<
(
i
-
1
)));
if
(
!
request_region
(
io
&
(
-
1
<<
i
),
(
1
<<
i
),
"ns558-isa"
))
/* Don't disturb anyone */
break
;
break
;
outb
(
0xff
,
io
&
(
-
1
<<
i
));
outb
(
0xff
,
io
&
(
-
1
<<
i
));
...
@@ -126,18 +131,25 @@ static void ns558_isa_probe(int io)
...
@@ -126,18 +131,25 @@ static void ns558_isa_probe(int io)
if
(
inb
(
io
&
(
-
1
<<
i
))
!=
inb
((
io
&
(
-
1
<<
i
))
+
(
1
<<
i
)
-
1
))
b
++
;
if
(
inb
(
io
&
(
-
1
<<
i
))
!=
inb
((
io
&
(
-
1
<<
i
))
+
(
1
<<
i
)
-
1
))
b
++
;
wait_ms
(
3
);
wait_ms
(
3
);
if
(
b
>
300
)
/* We allow 30% difference */
if
(
b
>
300
)
{
/* We allow 30% difference */
release_region
(
io
&
(
-
1
<<
i
),
(
1
<<
i
));
break
;
break
;
}
}
}
i
--
;
i
--
;
if
(
i
!=
4
)
{
if
(
!
request_region
(
io
&
(
-
1
<<
i
),
(
1
<<
i
),
"ns558-isa"
))
return
;
}
if
(
!
(
port
=
kmalloc
(
sizeof
(
struct
ns558
),
GFP_KERNEL
)))
{
if
(
!
(
port
=
kmalloc
(
sizeof
(
struct
ns558
),
GFP_KERNEL
)))
{
printk
(
KERN_ERR
"ns558: Memory allocation failed.
\n
"
);
printk
(
KERN_ERR
"ns558: Memory allocation failed.
\n
"
);
return
;
goto
out
;
}
}
memset
(
port
,
0
,
sizeof
(
struct
ns558
));
memset
(
port
,
0
,
sizeof
(
struct
ns558
));
port
->
type
=
NS558_ISA
;
port
->
type
=
NS558_ISA
;
port
->
size
=
(
1
<<
i
);
port
->
size
=
(
1
<<
i
);
port
->
gameport
.
io
=
io
;
port
->
gameport
.
io
=
io
;
...
@@ -148,8 +160,6 @@ static void ns558_isa_probe(int io)
...
@@ -148,8 +160,6 @@ static void ns558_isa_probe(int io)
sprintf
(
port
->
phys
,
"isa%04x/gameport0"
,
io
&
(
-
1
<<
i
));
sprintf
(
port
->
phys
,
"isa%04x/gameport0"
,
io
&
(
-
1
<<
i
));
sprintf
(
port
->
name
,
"NS558 ISA"
);
sprintf
(
port
->
name
,
"NS558 ISA"
);
request_region
(
io
&
(
-
1
<<
i
),
(
1
<<
i
),
"ns558-isa"
);
gameport_register_port
(
&
port
->
gameport
);
gameport_register_port
(
&
port
->
gameport
);
printk
(
KERN_INFO
"gameport: NS558 ISA at %#x"
,
port
->
gameport
.
io
);
printk
(
KERN_INFO
"gameport: NS558 ISA at %#x"
,
port
->
gameport
.
io
);
...
@@ -157,6 +167,9 @@ static void ns558_isa_probe(int io)
...
@@ -157,6 +167,9 @@ static void ns558_isa_probe(int io)
printk
(
" speed %d kHz
\n
"
,
port
->
gameport
.
speed
);
printk
(
" speed %d kHz
\n
"
,
port
->
gameport
.
speed
);
list_add
(
&
port
->
node
,
&
ns558_list
);
list_add
(
&
port
->
node
,
&
ns558_list
);
return
;
out:
release_region
(
io
&
(
-
1
<<
i
),
(
1
<<
i
));
}
}
#ifdef CONFIG_PNP
#ifdef CONFIG_PNP
...
...
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