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
f9e6dd14
Commit
f9e6dd14
authored
Apr 19, 2004
by
Bartlomiej Zolnierkiewicz
Committed by
Linus Torvalds
Apr 19, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] ide.c: split init_hwif_default() out of init_hwif_data()
parent
88b6548e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
23 deletions
+37
-23
drivers/ide/ide.c
drivers/ide/ide.c
+37
-23
No files found.
drivers/ide/ide.c
View file @
f9e6dd14
...
...
@@ -203,34 +203,23 @@ static void setup_driver_defaults(ide_driver_t *driver);
/*
* Do not even *think* about calling this!
*/
static
void
init_hwif_data
(
unsigned
int
index
)
static
void
init_hwif_data
(
ide_hwif_t
*
hwif
,
unsigned
int
index
)
{
unsigned
int
unit
;
hw_regs_t
hw
;
ide_hwif_t
*
hwif
=
&
ide_hwifs
[
index
];
/* bulk initialize hwif & drive info with zeros */
memset
(
hwif
,
0
,
sizeof
(
ide_hwif_t
));
memset
(
&
hw
,
0
,
sizeof
(
hw_regs_t
));
/* fill in any non-zero initial values */
hwif
->
index
=
index
;
ide_init_hwif_ports
(
&
hw
,
ide_default_io_base
(
index
),
0
,
&
hwif
->
irq
);
memcpy
(
&
hwif
->
hw
,
&
hw
,
sizeof
(
hw
));
memcpy
(
hwif
->
io_ports
,
hw
.
io_ports
,
sizeof
(
hw
.
io_ports
));
hwif
->
noprobe
=
!
hwif
->
io_ports
[
IDE_DATA_OFFSET
];
#ifdef CONFIG_BLK_DEV_HD
if
(
hwif
->
io_ports
[
IDE_DATA_OFFSET
]
==
HD_DATA
)
hwif
->
noprobe
=
1
;
/* may be overridden by ide_setup() */
#endif
/* CONFIG_BLK_DEV_HD */
hwif
->
major
=
ide_hwif_to_major
[
index
];
hwif
->
name
[
0
]
=
'i'
;
hwif
->
name
[
1
]
=
'd'
;
hwif
->
name
[
2
]
=
'e'
;
hwif
->
name
[
3
]
=
'0'
+
index
;
hwif
->
bus_state
=
BUSSTATE_ON
;
hwif
->
reset_poll
=
NULL
;
hwif
->
pre_reset
=
NULL
;
hwif
->
atapi_dma
=
0
;
/* disable all atapi dma */
hwif
->
ultra_mask
=
0x80
;
/* disable all ultra */
...
...
@@ -265,6 +254,24 @@ static void init_hwif_data (unsigned int index)
}
}
static
void
init_hwif_default
(
ide_hwif_t
*
hwif
,
unsigned
int
index
)
{
hw_regs_t
hw
;
memset
(
&
hw
,
0
,
sizeof
(
hw_regs_t
));
ide_init_hwif_ports
(
&
hw
,
ide_default_io_base
(
index
),
0
,
&
hwif
->
irq
);
memcpy
(
&
hwif
->
hw
,
&
hw
,
sizeof
(
hw
));
memcpy
(
hwif
->
io_ports
,
hw
.
io_ports
,
sizeof
(
hw
.
io_ports
));
hwif
->
noprobe
=
!
hwif
->
io_ports
[
IDE_DATA_OFFSET
];
#ifdef CONFIG_BLK_DEV_HD
if
(
hwif
->
io_ports
[
IDE_DATA_OFFSET
]
==
HD_DATA
)
hwif
->
noprobe
=
1
;
/* may be overridden by ide_setup() */
#endif
}
/*
* init_ide_data() sets reasonable default values into all fields
* of all instances of the hwifs and drives, but only on the first call.
...
...
@@ -285,6 +292,7 @@ static void init_hwif_data (unsigned int index)
#define MAGIC_COOKIE 0x12345678
static
void
__init
init_ide_data
(
void
)
{
ide_hwif_t
*
hwif
;
unsigned
int
index
;
static
unsigned
long
magic_cookie
=
MAGIC_COOKIE
;
...
...
@@ -295,8 +303,11 @@ static void __init init_ide_data (void)
setup_driver_defaults
(
&
idedefault_driver
);
/* Initialise all interface structures */
for
(
index
=
0
;
index
<
MAX_HWIFS
;
++
index
)
init_hwif_data
(
index
);
for
(
index
=
0
;
index
<
MAX_HWIFS
;
++
index
)
{
hwif
=
&
ide_hwifs
[
index
];
init_hwif_data
(
hwif
,
index
);
init_hwif_default
(
hwif
,
index
);
}
/* Add default hw interfaces */
initializing
=
1
;
...
...
@@ -569,8 +580,6 @@ void ide_hwif_release_regions(ide_hwif_t *hwif)
EXPORT_SYMBOL
(
ide_hwif_release_regions
);
extern
void
init_hwif_data
(
unsigned
int
index
);
/**
* ide_unregister - free an ide interface
* @index: index of interface (will change soon to a pointer)
...
...
@@ -750,7 +759,10 @@ void ide_unregister (unsigned int index)
}
old_hwif
=
*
hwif
;
init_hwif_data
(
index
);
/* restore hwif data to pristine status */
init_hwif_data
(
hwif
,
index
);
/* restore hwif data to pristine status */
init_hwif_default
(
hwif
,
index
);
hwif
->
hwgroup
=
old_hwif
.
hwgroup
;
hwif
->
gendev
.
parent
=
old_hwif
.
gendev
.
parent
;
...
...
@@ -952,8 +964,10 @@ int ide_register_hw (hw_regs_t *hw, ide_hwif_t **hwifp)
found:
if
(
hwif
->
present
)
ide_unregister
(
index
);
else
if
(
!
hwif
->
hold
)
init_hwif_data
(
index
);
else
if
(
!
hwif
->
hold
)
{
init_hwif_data
(
hwif
,
index
);
init_hwif_default
(
hwif
,
index
);
}
if
(
hwif
->
present
)
return
-
1
;
memcpy
(
&
hwif
->
hw
,
hw
,
sizeof
(
*
hw
));
...
...
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