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
e3bbd7e4
Commit
e3bbd7e4
authored
Jun 26, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] PCI Hotplug: acpiphp: add release() callback
parent
5eca6bec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
drivers/pci/hotplug/acpiphp_core.c
drivers/pci/hotplug/acpiphp_core.c
+22
-8
No files found.
drivers/pci/hotplug/acpiphp_core.c
View file @
e3bbd7e4
...
@@ -379,6 +379,25 @@ static void make_slot_name (struct slot *slot)
...
@@ -379,6 +379,25 @@ static void make_slot_name (struct slot *slot)
slot
->
acpi_slot
->
sun
);
slot
->
acpi_slot
->
sun
);
}
}
/**
* release_slot - free up the memory used by a slot
* @hotplug_slot: slot to free
*/
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
);
}
/**
/**
* init_slots - initialize 'struct slot' structures for each slot
* init_slots - initialize 'struct slot' structures for each slot
*
*
...
@@ -422,6 +441,7 @@ static int init_slots (void)
...
@@ -422,6 +441,7 @@ static int init_slots (void)
slot
->
number
=
i
;
slot
->
number
=
i
;
slot
->
hotplug_slot
->
private
=
slot
;
slot
->
hotplug_slot
->
private
=
slot
;
slot
->
hotplug_slot
->
release
=
&
release_slots
;
slot
->
hotplug_slot
->
ops
=
&
acpi_hotplug_slot_ops
;
slot
->
hotplug_slot
->
ops
=
&
acpi_hotplug_slot_ops
;
slot
->
acpi_slot
=
get_slot_from_id
(
i
);
slot
->
acpi_slot
=
get_slot_from_id
(
i
);
...
@@ -435,10 +455,7 @@ static int init_slots (void)
...
@@ -435,10 +455,7 @@ static int init_slots (void)
retval
=
pci_hp_register
(
slot
->
hotplug_slot
);
retval
=
pci_hp_register
(
slot
->
hotplug_slot
);
if
(
retval
)
{
if
(
retval
)
{
err
(
"pci_hp_register failed with error %d
\n
"
,
retval
);
err
(
"pci_hp_register failed with error %d
\n
"
,
retval
);
kfree
(
slot
->
hotplug_slot
->
info
);
release_slot
();
kfree
(
slot
->
hotplug_slot
->
name
);
kfree
(
slot
->
hotplug_slot
);
kfree
(
slot
);
return
retval
;
return
retval
;
}
}
...
@@ -457,13 +474,10 @@ static void cleanup_slots (void)
...
@@ -457,13 +474,10 @@ static void cleanup_slots (void)
struct
slot
*
slot
;
struct
slot
*
slot
;
list_for_each_safe
(
tmp
,
n
,
&
slot_list
)
{
list_for_each_safe
(
tmp
,
n
,
&
slot_list
)
{
/* memory will be freed in release_slot callback */
slot
=
list_entry
(
tmp
,
struct
slot
,
slot_list
);
slot
=
list_entry
(
tmp
,
struct
slot
,
slot_list
);
list_del
(
&
slot
->
slot_list
);
list_del
(
&
slot
->
slot_list
);
pci_hp_deregister
(
slot
->
hotplug_slot
);
pci_hp_deregister
(
slot
->
hotplug_slot
);
kfree
(
slot
->
hotplug_slot
->
info
);
kfree
(
slot
->
hotplug_slot
->
name
);
kfree
(
slot
->
hotplug_slot
);
kfree
(
slot
);
}
}
return
;
return
;
...
...
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