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
5eca6bec
Commit
5eca6bec
authored
Jun 26, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] PCI Hotplug: pcihp_skeleton: fix delete bug and add release() callback
parent
34b2137e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
drivers/pci/hotplug/pcihp_skeleton.c
drivers/pci/hotplug/pcihp_skeleton.c
+27
-15
No files found.
drivers/pci/hotplug/pcihp_skeleton.c
View file @
5eca6bec
/*
/*
* PCI Hot Plug Controller Skeleton Driver - 0.
1
* PCI Hot Plug Controller Skeleton Driver - 0.
2
*
*
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001
,2003
Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001 IBM Corp.
* Copyright (c) 2001
,2003
IBM Corp.
*
*
* All rights reserved.
* All rights reserved.
*
*
...
@@ -69,7 +69,7 @@ static LIST_HEAD(slot_list);
...
@@ -69,7 +69,7 @@ static LIST_HEAD(slot_list);
static
int
debug
;
static
int
debug
;
static
int
num_slots
;
static
int
num_slots
;
#define DRIVER_VERSION "0.
1
"
#define DRIVER_VERSION "0.
2
"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
#define DRIVER_DESC "Hot Plug PCI Controller Skeleton Driver"
#define DRIVER_DESC "Hot Plug PCI Controller Skeleton Driver"
...
@@ -288,6 +288,21 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
...
@@ -288,6 +288,21 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
return
retval
;
return
retval
;
}
}
static
void
release_slots
(
struct
hotplug_slot
*
hotplug_slot
)
{
struct
slot
*
slot
=
get_slot
(
hotplug_slot
,
__FUNCTION__
);
int
retval
=
0
;
if
(
slot
==
NULL
)
return
-
ENODEV
;
dbg
(
__FUNCTION__
" - physical_slot = %s
\n
"
,
hotplug_slot
->
name
);
kfree
(
slot
->
hotplug_slot
->
info
);
kfree
(
slot
->
hotplug_slot
->
name
);
kfree
(
slot
->
hotplug_slot
);
kfree
(
slot
);
}
#define SLOT_NAME_SIZE 10
#define SLOT_NAME_SIZE 10
static
void
make_slot_name
(
struct
slot
*
slot
)
static
void
make_slot_name
(
struct
slot
*
slot
)
{
{
...
@@ -347,6 +362,7 @@ static int init_slots (void)
...
@@ -347,6 +362,7 @@ static int init_slots (void)
slot
->
number
=
i
;
slot
->
number
=
i
;
hotplug_slot
->
private
=
slot
;
hotplug_slot
->
private
=
slot
;
hotplug_slot
->
release
=
&
release_slot
;
make_slot_name
(
slot
);
make_slot_name
(
slot
);
hotplug_slot
->
ops
=
&
skel_hotplug_slot_ops
;
hotplug_slot
->
ops
=
&
skel_hotplug_slot_ops
;
...
@@ -377,26 +393,22 @@ static int init_slots (void)
...
@@ -377,26 +393,22 @@ static int init_slots (void)
return
retval
;
return
retval
;
}
}
static
void
cleanup_slots
(
void
)
static
void
cleanup_slots
(
void
)
{
{
struct
list_head
*
tmp
;
struct
list_head
*
tmp
;
struct
list_head
*
next
;
struct
slot
*
slot
;
struct
slot
*
slot
;
/*
/*
* Unregister all of our slots with the pci_hotplug subsystem,
* Unregister all of our slots with the pci_hotplug subsystem.
* and free up all memory that we had allocated.
* Memory will be freed in release_slot() callback after slot's
* lifespan is finished.
*/
*/
list_for_each
(
tmp
,
&
slot_list
)
{
list_for_each
_safe
(
tmp
,
next
,
&
slot_list
)
{
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
;
}
}
static
int
__init
pcihp_skel_init
(
void
)
static
int
__init
pcihp_skel_init
(
void
)
...
...
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