Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
adb50640
Commit
adb50640
authored
10 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Correct errors in hub class destructor logic
parent
ab17603c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/usbhost/usbhost_hub.c
+14
-47
14 additions, 47 deletions
drivers/usbhost/usbhost_hub.c
with
14 additions
and
47 deletions
drivers/usbhost/usbhost_hub.c
+
14
−
47
View file @
adb50640
...
...
@@ -125,10 +125,6 @@ struct usbhost_hubclass_s
* Private Function Prototypes
****************************************************************************/
/* Memory allocation services */
static
inline
void
usbhost_class_free
(
FAR
struct
usbhost_class_s
*
devclass
);
/* Worker thread actions */
static
void
usbhost_destroy
(
FAR
void
*
arg
);
...
...
@@ -205,7 +201,7 @@ static struct usbhost_registry_s g_hub =
*
****************************************************************************/
static
inline
void
usbhost_hport_deactivate
(
FAR
struct
usbhost_hubport_s
*
hport
)
static
void
usbhost_hport_deactivate
(
FAR
struct
usbhost_hubport_s
*
hport
)
{
uvdbg
(
"Deactivating: %d
\n
"
,
hport
->
port
);
...
...
@@ -269,41 +265,6 @@ static int usbhost_hport_activate(FAR struct usbhost_hubport_s *hport)
return
ret
;
}
/****************************************************************************
* Name: usbhost_class_free
*
* Description:
* Free a class instance previously allocated by usbhost_create().
*
* Input Parameters:
* devclass - A reference to the class instance to be freed.
*
* Returned Values:
* None
*
****************************************************************************/
static
inline
void
usbhost_class_free
(
FAR
struct
usbhost_class_s
*
devclass
)
{
FAR
struct
usbhost_hubport_s
*
hport
;
DEBUGASSERT
(
devclass
!=
NULL
);
uvdbg
(
"Freeing: %p
\n
"
,
devclass
);
DEBUGASSERT
(
devclass
!=
NULL
&&
devclass
->
hport
!=
NULL
);
hport
=
devclass
->
hport
;
/* Detach the class from the hub port */
usbhost_devaddr_destroy
(
hport
);
hport
->
funcaddr
=
0
;
/* Free the class instance */
DEBUGASSERT
(
hport
->
devclass
==
devclass
);
kmm_free
(
devclass
);
hport
->
devclass
=
NULL
;
}
/****************************************************************************
* Name: usbhost_destroy
*
...
...
@@ -325,6 +286,7 @@ static void usbhost_destroy(FAR void *arg)
FAR
struct
usbhost_class_s
*
hubclass
=
(
FAR
struct
usbhost_class_s
*
)
arg
;
FAR
struct
usbhost_hubpriv_s
*
priv
;
FAR
struct
usbhost_hubport_s
*
hport
;
FAR
struct
usbhost_hubport_s
*
child
;
int
port
;
DEBUGASSERT
(
hubclass
!=
NULL
&&
hubclass
->
hport
!=
NULL
);
...
...
@@ -347,24 +309,29 @@ static void usbhost_destroy(FAR void *arg)
{
/* Free any devices classes connect on this hub port */
hport
=
&
priv
->
hport
[
port
];
if
(
hport
->
devclass
!=
NULL
)
child
=
&
priv
->
hport
[
port
];
if
(
child
->
devclass
!=
NULL
)
{
CLASS_DISCONNECTED
(
hport
->
devclass
);
CLASS_DISCONNECTED
(
child
->
devclass
);
}
/* Free any resource use by the hub port */
/* Free any resource
s
use
d
by the hub port */
usbhost_hport_deactivate
(
hport
);
usbhost_hport_deactivate
(
child
);
}
/* Destroy the semaphores */
sem_destroy
(
&
priv
->
exclsem
);
/* Free the hub class structure */
/* Deactivate the parent hub port (unless it is the root hub port) */
usbhost_hport_deactivate
(
hport
);
usbhost_class_free
(
hubclass
);
/* Free the class instance */
kmm_free
(
hubclass
);
hport
->
devclass
=
NULL
;
}
/****************************************************************************
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment