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
f5435bda
Commit
f5435bda
authored
May 29, 2002
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Plain Diff
Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-sync
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-linus
parents
58dc0833
ff70063c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
81 deletions
+40
-81
drivers/base/core.c
drivers/base/core.c
+3
-3
drivers/base/driver.c
drivers/base/driver.c
+34
-0
drivers/base/interface.c
drivers/base/interface.c
+0
-70
drivers/base/power.c
drivers/base/power.c
+1
-1
drivers/pci/pci-driver.c
drivers/pci/pci-driver.c
+1
-1
include/linux/device.h
include/linux/device.h
+1
-6
No files found.
drivers/base/core.c
View file @
f5435bda
...
...
@@ -98,7 +98,7 @@ static void device_unbind(struct device * dev)
{
/* unbind from driver */
if
(
dev
->
driver
&&
dev
->
driver
->
remove
)
dev
->
driver
->
remove
(
dev
,
REMOVE_NOTIFY
);
dev
->
driver
->
remove
(
dev
);
}
static
int
do_driver_bind
(
struct
device
*
dev
,
void
*
data
)
...
...
@@ -126,7 +126,7 @@ static int do_driver_unbind(struct device * dev, void * data)
dev
->
driver
=
NULL
;
unlock_device
(
dev
);
if
(
drv
->
remove
)
drv
->
remove
(
dev
,
REMOVE_NOTIFY
);
drv
->
remove
(
dev
);
}
else
unlock_device
(
dev
);
return
0
;
...
...
@@ -134,7 +134,7 @@ static int do_driver_unbind(struct device * dev, void * data)
void
driver_unbind
(
struct
device_driver
*
drv
)
{
//
driver_for_each_dev(drv,drv,do_driver_unbind);
driver_for_each_dev
(
drv
,
drv
,
do_driver_unbind
);
}
/**
...
...
drivers/base/driver.c
View file @
f5435bda
...
...
@@ -8,6 +8,39 @@
#include <linux/errno.h>
#include "base.h"
int
driver_for_each_dev
(
struct
device_driver
*
drv
,
void
*
data
,
int
(
*
callback
)(
struct
device
*
,
void
*
))
{
struct
device
*
next
;
struct
device
*
dev
=
NULL
;
struct
list_head
*
node
;
int
error
=
0
;
get_driver
(
drv
);
read_lock
(
&
drv
->
lock
);
node
=
drv
->
devices
.
next
;
while
(
node
!=
&
drv
->
devices
)
{
next
=
list_entry
(
node
,
struct
device
,
driver_list
);
get_device
(
next
);
read_unlock
(
&
drv
->
lock
);
if
(
dev
)
put_device
(
dev
);
dev
=
next
;
if
((
error
=
callback
(
dev
,
data
)))
{
put_device
(
dev
);
break
;
}
read_lock
(
&
drv
->
lock
);
node
=
dev
->
driver_list
.
next
;
}
read_unlock
(
&
drv
->
lock
);
if
(
dev
)
put_device
(
dev
);
put_driver
(
drv
);
return
error
;
}
/**
* driver_make_dir - create a driverfs directory for a driver
* @drv: driver in question
...
...
@@ -68,5 +101,6 @@ void put_driver(struct device_driver * drv)
drv
->
release
(
drv
);
}
EXPORT_SYMBOL
(
driver_for_each_dev
);
EXPORT_SYMBOL
(
driver_register
);
EXPORT_SYMBOL
(
put_driver
);
drivers/base/interface.c
View file @
f5435bda
...
...
@@ -9,75 +9,6 @@
#include <linux/err.h>
#include <linux/stat.h>
/**
* device_read_status - report some device information
* @page: page-sized buffer to write into
* @count: number of bytes requested
* @off: offset into buffer
* @data: device-specific data
*
* Report some human-readable information about the device.
* This includes the name, the bus id, and the current power state.
*/
static
ssize_t
device_read_status
(
struct
device
*
dev
,
char
*
page
,
size_t
count
,
loff_t
off
)
{
return
off
?
0
:
sprintf
(
page
,
"%s
\n
"
,
dev
->
bus_id
);
}
/**
* device_write_status - forward a command to a driver
* @buf: encoded command
* @count: number of bytes in buffer
* @off: offset into buffer to start with
* @data: device-specific data
*
* Send a comamnd to a device driver.
* The following actions are supported:
* probe - scan slot for device
* remove - detach driver from slot
* suspend <state> <stage> - perform <stage> for entering <state>
* resume <stage> - perform <stage> for waking device up.
* (See Documentation/driver-model.txt for the theory of an n-stage
* suspend sequence).
*/
static
ssize_t
device_write_status
(
struct
device
*
dev
,
const
char
*
buf
,
size_t
count
,
loff_t
off
)
{
char
command
[
20
];
int
num
;
int
arg
=
0
;
int
error
=
0
;
if
(
off
)
return
0
;
/* everything involves dealing with the driver. */
if
(
!
dev
->
driver
)
return
0
;
num
=
sscanf
(
buf
,
"%10s %d"
,
command
,
&
arg
);
if
(
!
num
)
return
0
;
if
(
!
strcmp
(
command
,
"probe"
))
{
if
(
dev
->
driver
->
probe
)
error
=
dev
->
driver
->
probe
(
dev
);
}
else
if
(
!
strcmp
(
command
,
"remove"
))
{
if
(
dev
->
driver
->
remove
)
error
=
dev
->
driver
->
remove
(
dev
,
REMOVE_NOTIFY
);
}
else
error
=
-
EFAULT
;
return
error
<
0
?
error
:
count
;
}
static
struct
driver_file_entry
device_status_entry
=
{
name:
"status"
,
mode:
S_IWUSR
|
S_IRUGO
,
show:
device_read_status
,
store:
device_write_status
,
};
static
ssize_t
device_read_name
(
struct
device
*
dev
,
char
*
buf
,
size_t
count
,
loff_t
off
)
{
return
off
?
0
:
sprintf
(
buf
,
"%s
\n
"
,
dev
->
name
);
...
...
@@ -166,7 +97,6 @@ static struct driver_file_entry device_power_entry = {
};
struct
driver_file_entry
*
device_default_files
[]
=
{
&
device_status_entry
,
&
device_name_entry
,
&
device_power_entry
,
NULL
,
...
...
drivers/base/power.c
View file @
f5435bda
...
...
@@ -113,7 +113,7 @@ void device_shutdown(void)
put_device
(
prev
);
if
(
dev
->
driver
&&
dev
->
driver
->
remove
)
dev
->
driver
->
remove
(
dev
,
REMOVE_FREE_RESOURCES
);
dev
->
driver
->
remove
(
dev
);
spin_lock
(
&
device_lock
);
prev
=
dev
;
...
...
drivers/pci/pci-driver.c
View file @
f5435bda
...
...
@@ -47,7 +47,7 @@ static int pci_device_probe(struct device * dev)
return
error
>
0
?
0
:
-
ENODEV
;
}
static
int
pci_device_remove
(
struct
device
*
dev
,
u32
flags
)
static
int
pci_device_remove
(
struct
device
*
dev
)
{
struct
pci_dev
*
pci_dev
=
list_entry
(
dev
,
struct
pci_dev
,
dev
);
...
...
include/linux/device.h
View file @
f5435bda
...
...
@@ -48,11 +48,6 @@ enum {
RESUME_ENABLE
,
};
enum
{
REMOVE_NOTIFY
,
REMOVE_FREE_RESOURCES
,
};
struct
device
;
struct
device_driver
;
...
...
@@ -103,7 +98,7 @@ struct device_driver {
struct
driver_dir_entry
dir
;
int
(
*
probe
)
(
struct
device
*
dev
);
int
(
*
remove
)
(
struct
device
*
dev
,
u32
flags
);
int
(
*
remove
)
(
struct
device
*
dev
);
int
(
*
suspend
)
(
struct
device
*
dev
,
u32
state
,
u32
level
);
int
(
*
resume
)
(
struct
device
*
dev
,
u32
level
);
...
...
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