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
54a5c4cd
Commit
54a5c4cd
authored
Jun 20, 2005
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: convert usbfs/inode.c to use usb notifiers
Signed-off-by:
Greg Kroah-Hartman
<
gregkh@suse.de
>
parent
a7b986b3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
28 deletions
+31
-28
drivers/usb/core/hcd.c
drivers/usb/core/hcd.c
+0
-2
drivers/usb/core/hcd.h
drivers/usb/core/hcd.h
+0
-10
drivers/usb/core/hub.c
drivers/usb/core/hub.c
+0
-3
drivers/usb/core/inode.c
drivers/usb/core/inode.c
+31
-13
No files found.
drivers/usb/core/hcd.c
View file @
54a5c4cd
...
@@ -793,7 +793,6 @@ static int usb_register_bus(struct usb_bus *bus)
...
@@ -793,7 +793,6 @@ static int usb_register_bus(struct usb_bus *bus)
up
(
&
usb_bus_list_lock
);
up
(
&
usb_bus_list_lock
);
usb_notify_add_bus
(
bus
);
usb_notify_add_bus
(
bus
);
usbfs_add_bus
(
bus
);
usbmon_notify_bus_add
(
bus
);
usbmon_notify_bus_add
(
bus
);
dev_info
(
bus
->
controller
,
"new USB bus registered, assigned bus number %d
\n
"
,
bus
->
busnum
);
dev_info
(
bus
->
controller
,
"new USB bus registered, assigned bus number %d
\n
"
,
bus
->
busnum
);
...
@@ -823,7 +822,6 @@ static void usb_deregister_bus (struct usb_bus *bus)
...
@@ -823,7 +822,6 @@ static void usb_deregister_bus (struct usb_bus *bus)
usb_notify_remove_bus
(
bus
);
usb_notify_remove_bus
(
bus
);
usbmon_notify_bus_remove
(
bus
);
usbmon_notify_bus_remove
(
bus
);
usbfs_remove_bus
(
bus
);
clear_bit
(
bus
->
busnum
,
busmap
.
busmap
);
clear_bit
(
bus
->
busnum
,
busmap
.
busmap
);
...
...
drivers/usb/core/hcd.h
View file @
54a5c4cd
...
@@ -400,23 +400,13 @@ static inline int hcd_bus_resume (struct usb_bus *bus)
...
@@ -400,23 +400,13 @@ static inline int hcd_bus_resume (struct usb_bus *bus)
* these are expected to be called from the USB core/hub thread
* these are expected to be called from the USB core/hub thread
* with the kernel lock held
* with the kernel lock held
*/
*/
extern
void
usbfs_add_bus
(
struct
usb_bus
*
bus
);
extern
void
usbfs_remove_bus
(
struct
usb_bus
*
bus
);
extern
void
usbfs_add_device
(
struct
usb_device
*
dev
);
extern
void
usbfs_remove_device
(
struct
usb_device
*
dev
);
extern
void
usbfs_update_special
(
void
);
extern
void
usbfs_update_special
(
void
);
extern
int
usbfs_init
(
void
);
extern
int
usbfs_init
(
void
);
extern
void
usbfs_cleanup
(
void
);
extern
void
usbfs_cleanup
(
void
);
#else
/* CONFIG_USB_DEVICEFS */
#else
/* CONFIG_USB_DEVICEFS */
static
inline
void
usbfs_add_bus
(
struct
usb_bus
*
bus
)
{}
static
inline
void
usbfs_remove_bus
(
struct
usb_bus
*
bus
)
{}
static
inline
void
usbfs_add_device
(
struct
usb_device
*
dev
)
{}
static
inline
void
usbfs_remove_device
(
struct
usb_device
*
dev
)
{}
static
inline
void
usbfs_update_special
(
void
)
{}
static
inline
void
usbfs_update_special
(
void
)
{}
static
inline
int
usbfs_init
(
void
)
{
return
0
;
}
static
inline
int
usbfs_init
(
void
)
{
return
0
;
}
static
inline
void
usbfs_cleanup
(
void
)
{
}
static
inline
void
usbfs_cleanup
(
void
)
{
}
...
...
drivers/usb/core/hub.c
View file @
54a5c4cd
...
@@ -1136,7 +1136,6 @@ void usb_disconnect(struct usb_device **pdev)
...
@@ -1136,7 +1136,6 @@ void usb_disconnect(struct usb_device **pdev)
*/
*/
dev_dbg
(
&
udev
->
dev
,
"unregistering device
\n
"
);
dev_dbg
(
&
udev
->
dev
,
"unregistering device
\n
"
);
release_address
(
udev
);
release_address
(
udev
);
usbfs_remove_device
(
udev
);
usb_remove_sysfs_dev_files
(
udev
);
usb_remove_sysfs_dev_files
(
udev
);
/* Avoid races with recursively_mark_NOTATTACHED() */
/* Avoid races with recursively_mark_NOTATTACHED() */
...
@@ -1374,8 +1373,6 @@ int usb_new_device(struct usb_device *udev)
...
@@ -1374,8 +1373,6 @@ int usb_new_device(struct usb_device *udev)
/* USB device state == configured ... usable */
/* USB device state == configured ... usable */
usb_notify_add_device
(
udev
);
usb_notify_add_device
(
udev
);
/* add a /proc/bus/usb entry */
usbfs_add_device
(
udev
);
return
0
;
return
0
;
fail:
fail:
...
...
drivers/usb/core/inode.c
View file @
54a5c4cd
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include <linux/usbdevice_fs.h>
#include <linux/usbdevice_fs.h>
#include <linux/smp_lock.h>
#include <linux/smp_lock.h>
#include <linux/parser.h>
#include <linux/parser.h>
#include <linux/notifier.h>
#include <asm/byteorder.h>
#include <asm/byteorder.h>
#include "usb.h"
#include "usb.h"
#include "hcd.h"
#include "hcd.h"
...
@@ -619,7 +620,7 @@ void usbfs_update_special (void)
...
@@ -619,7 +620,7 @@ void usbfs_update_special (void)
}
}
}
}
void
usbfs_add_bus
(
struct
usb_bus
*
bus
)
static
void
usbfs_add_bus
(
struct
usb_bus
*
bus
)
{
{
struct
dentry
*
parent
;
struct
dentry
*
parent
;
char
name
[
8
];
char
name
[
8
];
...
@@ -642,12 +643,9 @@ void usbfs_add_bus(struct usb_bus *bus)
...
@@ -642,12 +643,9 @@ void usbfs_add_bus(struct usb_bus *bus)
err
(
"error creating usbfs bus entry"
);
err
(
"error creating usbfs bus entry"
);
return
;
return
;
}
}
usbfs_update_special
();
usbfs_conn_disc_event
();
}
}
void
usbfs_remove_bus
(
struct
usb_bus
*
bus
)
static
void
usbfs_remove_bus
(
struct
usb_bus
*
bus
)
{
{
if
(
bus
->
usbfs_dentry
)
{
if
(
bus
->
usbfs_dentry
)
{
fs_remove_file
(
bus
->
usbfs_dentry
);
fs_remove_file
(
bus
->
usbfs_dentry
);
...
@@ -659,12 +657,9 @@ void usbfs_remove_bus(struct usb_bus *bus)
...
@@ -659,12 +657,9 @@ void usbfs_remove_bus(struct usb_bus *bus)
remove_special_files
();
remove_special_files
();
num_buses
=
0
;
num_buses
=
0
;
}
}
usbfs_update_special
();
usbfs_conn_disc_event
();
}
}
void
usbfs_add_device
(
struct
usb_device
*
dev
)
static
void
usbfs_add_device
(
struct
usb_device
*
dev
)
{
{
char
name
[
8
];
char
name
[
8
];
int
i
;
int
i
;
...
@@ -690,12 +685,9 @@ void usbfs_add_device(struct usb_device *dev)
...
@@ -690,12 +685,9 @@ void usbfs_add_device(struct usb_device *dev)
}
}
if
(
dev
->
usbfs_dentry
->
d_inode
)
if
(
dev
->
usbfs_dentry
->
d_inode
)
dev
->
usbfs_dentry
->
d_inode
->
i_size
=
i_size
;
dev
->
usbfs_dentry
->
d_inode
->
i_size
=
i_size
;
usbfs_update_special
();
usbfs_conn_disc_event
();
}
}
void
usbfs_remove_device
(
struct
usb_device
*
dev
)
static
void
usbfs_remove_device
(
struct
usb_device
*
dev
)
{
{
struct
dev_state
*
ds
;
struct
dev_state
*
ds
;
struct
siginfo
sinfo
;
struct
siginfo
sinfo
;
...
@@ -716,10 +708,33 @@ void usbfs_remove_device(struct usb_device *dev)
...
@@ -716,10 +708,33 @@ void usbfs_remove_device(struct usb_device *dev)
kill_proc_info_as_uid
(
ds
->
discsignr
,
&
sinfo
,
ds
->
disc_pid
,
ds
->
disc_uid
,
ds
->
disc_euid
);
kill_proc_info_as_uid
(
ds
->
discsignr
,
&
sinfo
,
ds
->
disc_pid
,
ds
->
disc_uid
,
ds
->
disc_euid
);
}
}
}
}
}
static
int
usbfs_notify
(
struct
notifier_block
*
self
,
unsigned
long
action
,
void
*
dev
)
{
switch
(
action
)
{
case
USB_DEVICE_ADD
:
usbfs_add_device
(
dev
);
break
;
case
USB_DEVICE_REMOVE
:
usbfs_remove_device
(
dev
);
break
;
case
USB_BUS_ADD
:
usbfs_add_bus
(
dev
);
break
;
case
USB_BUS_REMOVE
:
usbfs_remove_bus
(
dev
);
}
usbfs_update_special
();
usbfs_update_special
();
usbfs_conn_disc_event
();
usbfs_conn_disc_event
();
return
NOTIFY_OK
;
}
}
static
struct
notifier_block
usbfs_nb
=
{
.
notifier_call
=
usbfs_notify
,
};
/* --------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
static
struct
proc_dir_entry
*
usbdir
=
NULL
;
static
struct
proc_dir_entry
*
usbdir
=
NULL
;
...
@@ -732,6 +747,8 @@ int __init usbfs_init(void)
...
@@ -732,6 +747,8 @@ int __init usbfs_init(void)
if
(
retval
)
if
(
retval
)
return
retval
;
return
retval
;
usb_register_notify
(
&
usbfs_nb
);
/* create mount point for usbfs */
/* create mount point for usbfs */
usbdir
=
proc_mkdir
(
"usb"
,
proc_bus
);
usbdir
=
proc_mkdir
(
"usb"
,
proc_bus
);
...
@@ -740,6 +757,7 @@ int __init usbfs_init(void)
...
@@ -740,6 +757,7 @@ int __init usbfs_init(void)
void
usbfs_cleanup
(
void
)
void
usbfs_cleanup
(
void
)
{
{
usb_unregister_notify
(
&
usbfs_nb
);
unregister_filesystem
(
&
usb_fs_type
);
unregister_filesystem
(
&
usb_fs_type
);
if
(
usbdir
)
if
(
usbdir
)
remove_proc_entry
(
"usb"
,
proc_bus
);
remove_proc_entry
(
"usb"
,
proc_bus
);
...
...
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