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
3fda6c8f
Commit
3fda6c8f
authored
Jun 26, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] PCI Hotplug: cpqphp: add release() callback and other minor cleanups.
parent
d414b921
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
drivers/pci/hotplug/cpqphp_core.c
drivers/pci/hotplug/cpqphp_core.c
+22
-16
No files found.
drivers/pci/hotplug/cpqphp_core.c
View file @
3fda6c8f
...
@@ -312,6 +312,20 @@ static void *get_SMBIOS_entry (void *smbios_start, void *smbios_table, u8 type,
...
@@ -312,6 +312,20 @@ static void *get_SMBIOS_entry (void *smbios_start, void *smbios_table, u8 type,
return
previous
;
return
previous
;
}
}
static
void
release_slot
(
struct
hotplug_slot
*
hotplug_slot
)
{
struct
slot
*
slot
=
get_slot
(
hotplug_slot
,
__FUNCTION__
);
if
(
slot
==
NULL
)
return
;
dbg
(
"%s - physical_slot = %s
\n
"
,
__FUNCTION__
,
hotplug_slot
->
name
);
kfree
(
slot
->
hotplug_slot
->
info
);
kfree
(
slot
->
hotplug_slot
->
name
);
kfree
(
slot
->
hotplug_slot
);
kfree
(
slot
);
}
static
int
ctrl_slot_setup
(
struct
controller
*
ctrl
,
void
*
smbios_start
,
void
*
smbios_table
)
static
int
ctrl_slot_setup
(
struct
controller
*
ctrl
,
void
*
smbios_start
,
void
*
smbios_table
)
{
{
...
@@ -401,6 +415,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
...
@@ -401,6 +415,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
new_slot
->
capabilities
|=
((
read_slot_enable
(
ctrl
)
<<
2
)
>>
ctrl_slot
)
&
0x04
;
new_slot
->
capabilities
|=
((
read_slot_enable
(
ctrl
)
<<
2
)
>>
ctrl_slot
)
&
0x04
;
/* register this slot with the hotplug pci core */
/* register this slot with the hotplug pci core */
new_slot
->
hotplug_slot
->
release
=
&
release_slot
;
new_slot
->
hotplug_slot
->
private
=
new_slot
;
new_slot
->
hotplug_slot
->
private
=
new_slot
;
make_slot_name
(
new_slot
->
hotplug_slot
->
name
,
SLOT_NAME_SIZE
,
new_slot
);
make_slot_name
(
new_slot
->
hotplug_slot
->
name
,
SLOT_NAME_SIZE
,
new_slot
);
new_slot
->
hotplug_slot
->
ops
=
&
cpqphp_hotplug_slot_ops
;
new_slot
->
hotplug_slot
->
ops
=
&
cpqphp_hotplug_slot_ops
;
...
@@ -415,10 +430,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
...
@@ -415,10 +430,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
result
=
pci_hp_register
(
new_slot
->
hotplug_slot
);
result
=
pci_hp_register
(
new_slot
->
hotplug_slot
);
if
(
result
)
{
if
(
result
)
{
err
(
"pci_hp_register failed with error %d
\n
"
,
result
);
err
(
"pci_hp_register failed with error %d
\n
"
,
result
);
kfree
(
new_slot
->
hotplug_slot
->
info
);
release_slot
(
new_slot
->
hotplug_slot
);
kfree
(
new_slot
->
hotplug_slot
->
name
);
kfree
(
new_slot
->
hotplug_slot
);
kfree
(
new_slot
);
return
result
;
return
result
;
}
}
...
@@ -430,10 +442,9 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
...
@@ -430,10 +442,9 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
slot_number
++
;
slot_number
++
;
}
}
return
(
0
)
;
return
0
;
}
}
static
int
ctrl_slot_cleanup
(
struct
controller
*
ctrl
)
static
int
ctrl_slot_cleanup
(
struct
controller
*
ctrl
)
{
{
struct
slot
*
old_slot
,
*
next_slot
;
struct
slot
*
old_slot
,
*
next_slot
;
...
@@ -442,12 +453,9 @@ static int ctrl_slot_cleanup (struct controller * ctrl)
...
@@ -442,12 +453,9 @@ static int ctrl_slot_cleanup (struct controller * ctrl)
ctrl
->
slot
=
NULL
;
ctrl
->
slot
=
NULL
;
while
(
old_slot
)
{
while
(
old_slot
)
{
/* memory will be freed by the release_slot callback */
next_slot
=
old_slot
->
next
;
next_slot
=
old_slot
->
next
;
pci_hp_deregister
(
old_slot
->
hotplug_slot
);
pci_hp_deregister
(
old_slot
->
hotplug_slot
);
kfree
(
old_slot
->
hotplug_slot
->
info
);
kfree
(
old_slot
->
hotplug_slot
->
name
);
kfree
(
old_slot
->
hotplug_slot
);
kfree
(
old_slot
);
old_slot
=
next_slot
;
old_slot
=
next_slot
;
}
}
...
@@ -498,7 +506,7 @@ static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *sl
...
@@ -498,7 +506,7 @@ static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *sl
sizeof
(
struct
irq_routing_table
))
/
sizeof
(
struct
irq_info
);
sizeof
(
struct
irq_routing_table
))
/
sizeof
(
struct
irq_info
);
// Make sure I got at least one entry
// Make sure I got at least one entry
if
(
len
==
0
)
{
if
(
len
==
0
)
{
if
(
PCIIRQRoutingInfoLength
!=
NULL
)
kfree
(
PCIIRQRoutingInfoLength
);
kfree
(
PCIIRQRoutingInfoLength
);
return
-
1
;
return
-
1
;
}
}
...
@@ -509,9 +517,7 @@ static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *sl
...
@@ -509,9 +517,7 @@ static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *sl
if
((
tbus
==
bus_num
)
&&
(
tdevice
==
dev_num
))
{
if
((
tbus
==
bus_num
)
&&
(
tdevice
==
dev_num
))
{
*
slot
=
tslot
;
*
slot
=
tslot
;
kfree
(
PCIIRQRoutingInfoLength
);
if
(
PCIIRQRoutingInfoLength
!=
NULL
)
kfree
(
PCIIRQRoutingInfoLength
);
return
0
;
return
0
;
}
else
{
}
else
{
// Didn't get a match on the target PCI device. Check if the
// Didn't get a match on the target PCI device. Check if the
...
@@ -540,10 +546,10 @@ static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *sl
...
@@ -540,10 +546,10 @@ static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *sl
// slot number for the bridge.
// slot number for the bridge.
if
(
bridgeSlot
!=
0xFF
)
{
if
(
bridgeSlot
!=
0xFF
)
{
*
slot
=
bridgeSlot
;
*
slot
=
bridgeSlot
;
if
(
PCIIRQRoutingInfoLength
!=
NULL
)
kfree
(
PCIIRQRoutingInfoLength
);
kfree
(
PCIIRQRoutingInfoLength
);
return
0
;
return
0
;
}
}
if
(
PCIIRQRoutingInfoLength
!=
NULL
)
kfree
(
PCIIRQRoutingInfoLength
);
kfree
(
PCIIRQRoutingInfoLength
);
// Couldn't find an entry in the routing table for this PCI device
// Couldn't find an entry in the routing table for this PCI device
return
-
1
;
return
-
1
;
}
}
...
...
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