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
b1aad19b
Commit
b1aad19b
authored
Dec 31, 2002
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://linux.bkbits.net/linux-2.5
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
parents
646c3054
d5f1f33d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
31 deletions
+29
-31
drivers/base/bus.c
drivers/base/bus.c
+6
-10
drivers/base/intf.c
drivers/base/intf.c
+12
-12
fs/partitions/check.c
fs/partitions/check.c
+3
-2
include/linux/device.h
include/linux/device.h
+0
-2
include/linux/kobject.h
include/linux/kobject.h
+1
-1
lib/kobject.c
lib/kobject.c
+7
-4
No files found.
drivers/base/bus.c
View file @
b1aad19b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
static
DECLARE_MUTEX
(
bus_sem
);
static
DECLARE_MUTEX
(
bus_sem
);
#define to_dev(node) container_of(node,struct device,bus_list)
#define to_dev(node) container_of(node,struct device,bus_list)
#define to_drv(node) container_of(node,struct device_driver,
bus_list
)
#define to_drv(node) container_of(node,struct device_driver,
kobj.entry
)
#define to_bus_attr(_attr) container_of(_attr,struct bus_attribute,attr)
#define to_bus_attr(_attr) container_of(_attr,struct bus_attribute,attr)
#define to_bus(obj) container_of(obj,struct bus_type,subsys.kobj)
#define to_bus(obj) container_of(obj,struct bus_type,subsys.kobj)
...
@@ -203,9 +203,9 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
...
@@ -203,9 +203,9 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
if
(
!
(
bus
=
get_bus
(
bus
)))
if
(
!
(
bus
=
get_bus
(
bus
)))
return
-
EINVAL
;
return
-
EINVAL
;
head
=
start
?
&
start
->
bus_list
:
&
bus
->
drivers
;
head
=
start
?
&
start
->
kobj
.
entry
:
&
bus
->
drvsubsys
.
list
;
down_read
(
&
bus
->
subsys
.
rwsem
);
down_read
(
&
bus
->
drv
subsys
.
rwsem
);
list_for_each
(
entry
,
head
)
{
list_for_each
(
entry
,
head
)
{
struct
device_driver
*
drv
=
get_driver
(
to_drv
(
entry
));
struct
device_driver
*
drv
=
get_driver
(
to_drv
(
entry
));
error
=
fn
(
drv
,
data
);
error
=
fn
(
drv
,
data
);
...
@@ -213,7 +213,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
...
@@ -213,7 +213,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
if
(
error
)
if
(
error
)
break
;
break
;
}
}
up_read
(
&
bus
->
subsys
.
rwsem
);
up_read
(
&
bus
->
drv
subsys
.
rwsem
);
return
error
;
return
error
;
}
}
...
@@ -287,9 +287,8 @@ static int device_attach(struct device * dev)
...
@@ -287,9 +287,8 @@ static int device_attach(struct device * dev)
if
(
!
bus
->
match
)
if
(
!
bus
->
match
)
return
0
;
return
0
;
list_for_each
(
entry
,
&
bus
->
drivers
)
{
list_for_each
(
entry
,
&
bus
->
drvsubsys
.
list
)
{
struct
device_driver
*
drv
=
struct
device_driver
*
drv
=
to_drv
(
entry
);
container_of
(
entry
,
struct
device_driver
,
bus_list
);
if
(
!
(
error
=
bus_match
(
dev
,
drv
)))
if
(
!
(
error
=
bus_match
(
dev
,
drv
)))
break
;
break
;
}
}
...
@@ -437,7 +436,6 @@ int bus_add_driver(struct device_driver * drv)
...
@@ -437,7 +436,6 @@ int bus_add_driver(struct device_driver * drv)
kobject_register
(
&
drv
->
kobj
);
kobject_register
(
&
drv
->
kobj
);
devclass_add_driver
(
drv
);
devclass_add_driver
(
drv
);
list_add_tail
(
&
drv
->
bus_list
,
&
bus
->
drivers
);
driver_attach
(
drv
);
driver_attach
(
drv
);
up_write
(
&
bus
->
subsys
.
rwsem
);
up_write
(
&
bus
->
subsys
.
rwsem
);
}
}
...
@@ -460,7 +458,6 @@ void bus_remove_driver(struct device_driver * drv)
...
@@ -460,7 +458,6 @@ void bus_remove_driver(struct device_driver * drv)
down_write
(
&
drv
->
bus
->
subsys
.
rwsem
);
down_write
(
&
drv
->
bus
->
subsys
.
rwsem
);
pr_debug
(
"bus %s: remove driver %s
\n
"
,
drv
->
bus
->
name
,
drv
->
name
);
pr_debug
(
"bus %s: remove driver %s
\n
"
,
drv
->
bus
->
name
,
drv
->
name
);
driver_detach
(
drv
);
driver_detach
(
drv
);
list_del_init
(
&
drv
->
bus_list
);
devclass_remove_driver
(
drv
);
devclass_remove_driver
(
drv
);
kobject_unregister
(
&
drv
->
kobj
);
kobject_unregister
(
&
drv
->
kobj
);
up_write
(
&
drv
->
bus
->
subsys
.
rwsem
);
up_write
(
&
drv
->
bus
->
subsys
.
rwsem
);
...
@@ -491,7 +488,6 @@ void put_bus(struct bus_type * bus)
...
@@ -491,7 +488,6 @@ void put_bus(struct bus_type * bus)
int
bus_register
(
struct
bus_type
*
bus
)
int
bus_register
(
struct
bus_type
*
bus
)
{
{
INIT_LIST_HEAD
(
&
bus
->
devices
);
INIT_LIST_HEAD
(
&
bus
->
devices
);
INIT_LIST_HEAD
(
&
bus
->
drivers
);
down
(
&
bus_sem
);
down
(
&
bus_sem
);
strncpy
(
bus
->
subsys
.
kobj
.
name
,
bus
->
name
,
KOBJ_NAME_LEN
);
strncpy
(
bus
->
subsys
.
kobj
.
name
,
bus
->
name
,
KOBJ_NAME_LEN
);
...
...
drivers/base/intf.c
View file @
b1aad19b
...
@@ -14,9 +14,6 @@
...
@@ -14,9 +14,6 @@
#define to_data(e) container_of(e,struct intf_data,kobj.entry)
#define to_data(e) container_of(e,struct intf_data,kobj.entry)
#define intf_from_data(d) container_of(d->kobj.subsys,struct device_interface, subsys);
/**
/**
* intf_dev_link - create sysfs symlink for interface.
* intf_dev_link - create sysfs symlink for interface.
* @data: interface data descriptor.
* @data: interface data descriptor.
...
@@ -61,15 +58,18 @@ static void intf_dev_unlink(struct intf_data * data)
...
@@ -61,15 +58,18 @@ static void intf_dev_unlink(struct intf_data * data)
int
interface_add_data
(
struct
intf_data
*
data
)
int
interface_add_data
(
struct
intf_data
*
data
)
{
{
struct
device_interface
*
intf
=
intf_from_data
(
data
)
;
struct
device_interface
*
intf
=
data
->
intf
;
data
->
intf_num
=
data
->
intf
->
devnum
++
;
if
(
intf
)
{
data
->
intf_num
=
intf
->
devnum
++
;
data
->
kobj
.
subsys
=
&
intf
->
subsys
;
data
->
kobj
.
subsys
=
&
intf
->
subsys
;
kobject_register
(
&
data
->
kobj
);
kobject_register
(
&
data
->
kobj
);
list_add_tail
(
&
data
->
dev_entry
,
&
data
->
dev
->
intf_list
);
list_add_tail
(
&
data
->
dev_entry
,
&
data
->
dev
->
intf_list
);
intf_dev_link
(
data
);
intf_dev_link
(
data
);
return
0
;
return
0
;
}
return
-
EINVAL
;
}
}
...
@@ -121,9 +121,9 @@ static int add(struct device_interface * intf, struct device * dev)
...
@@ -121,9 +121,9 @@ static int add(struct device_interface * intf, struct device * dev)
static
void
del
(
struct
intf_data
*
data
)
static
void
del
(
struct
intf_data
*
data
)
{
{
struct
device_interface
*
intf
=
intf_from_data
(
data
)
;
struct
device_interface
*
intf
=
data
->
intf
;
pr_debug
(
" -> %s "
,
data
->
intf
->
name
);
pr_debug
(
" -> %s "
,
intf
->
name
);
interface_remove_data
(
data
);
interface_remove_data
(
data
);
if
(
intf
->
remove_device
)
if
(
intf
->
remove_device
)
intf
->
remove_device
(
data
);
intf
->
remove_device
(
data
);
...
...
fs/partitions/check.c
View file @
b1aad19b
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
#include <linux/blk.h>
#include <linux/blk.h>
#include <linux/kmod.h>
#include <linux/kmod.h>
#include <linux/ctype.h>
#include <linux/ctype.h>
#include <../drivers/base/fs/fs.h>
/* Eeeeewwwww */
#include "check.h"
#include "check.h"
...
@@ -399,13 +398,15 @@ void register_disk(struct gendisk *disk)
...
@@ -399,13 +398,15 @@ void register_disk(struct gendisk *disk)
struct
block_device
*
bdev
;
struct
block_device
*
bdev
;
char
*
s
;
char
*
s
;
int
j
;
int
j
;
int
err
;
strncpy
(
disk
->
kobj
.
name
,
disk
->
disk_name
,
KOBJ_NAME_LEN
);
strncpy
(
disk
->
kobj
.
name
,
disk
->
disk_name
,
KOBJ_NAME_LEN
);
/* ewww... some of these buggers have / in name... */
/* ewww... some of these buggers have / in name... */
s
=
strchr
(
disk
->
kobj
.
name
,
'/'
);
s
=
strchr
(
disk
->
kobj
.
name
,
'/'
);
if
(
s
)
if
(
s
)
*
s
=
'!'
;
*
s
=
'!'
;
kobject_add
(
&
disk
->
kobj
);
if
((
err
=
kobject_add
(
&
disk
->
kobj
)))
return
;
disk_sysfs_symlinks
(
disk
);
disk_sysfs_symlinks
(
disk
);
if
(
disk
->
flags
&
GENHD_FL_CD
)
if
(
disk
->
flags
&
GENHD_FL_CD
)
...
...
include/linux/device.h
View file @
b1aad19b
...
@@ -69,7 +69,6 @@ struct bus_type {
...
@@ -69,7 +69,6 @@ struct bus_type {
struct
subsystem
drvsubsys
;
struct
subsystem
drvsubsys
;
struct
subsystem
devsubsys
;
struct
subsystem
devsubsys
;
struct
list_head
devices
;
struct
list_head
devices
;
struct
list_head
drivers
;
int
(
*
match
)(
struct
device
*
dev
,
struct
device_driver
*
drv
);
int
(
*
match
)(
struct
device
*
dev
,
struct
device_driver
*
drv
);
struct
device
*
(
*
add
)
(
struct
device
*
parent
,
char
*
bus_id
);
struct
device
*
(
*
add
)
(
struct
device
*
parent
,
char
*
bus_id
);
...
@@ -119,7 +118,6 @@ struct device_driver {
...
@@ -119,7 +118,6 @@ struct device_driver {
struct
semaphore
unload_sem
;
struct
semaphore
unload_sem
;
struct
kobject
kobj
;
struct
kobject
kobj
;
struct
list_head
bus_list
;
struct
list_head
class_list
;
struct
list_head
class_list
;
struct
list_head
devices
;
struct
list_head
devices
;
...
...
include/linux/kobject.h
View file @
b1aad19b
...
@@ -52,7 +52,7 @@ extern void subsystem_unregister(struct subsystem *);
...
@@ -52,7 +52,7 @@ extern void subsystem_unregister(struct subsystem *);
static
inline
struct
subsystem
*
subsys_get
(
struct
subsystem
*
s
)
static
inline
struct
subsystem
*
subsys_get
(
struct
subsystem
*
s
)
{
{
return
container_of
(
kobject_get
(
&
s
->
kobj
),
struct
subsystem
,
kobj
)
;
return
s
?
container_of
(
kobject_get
(
&
s
->
kobj
),
struct
subsystem
,
kobj
)
:
NULL
;
}
}
static
inline
void
subsys_put
(
struct
subsystem
*
s
)
static
inline
void
subsys_put
(
struct
subsystem
*
s
)
...
...
lib/kobject.c
View file @
b1aad19b
...
@@ -74,10 +74,13 @@ int kobject_add(struct kobject * kobj)
...
@@ -74,10 +74,13 @@ int kobject_add(struct kobject * kobj)
{
{
int
error
=
0
;
int
error
=
0
;
struct
subsystem
*
s
=
kobj
->
subsys
;
struct
subsystem
*
s
=
kobj
->
subsys
;
struct
kobject
*
parent
=
kobject_get
(
kobj
->
parent
)
;
struct
kobject
*
parent
;
if
(
!
(
kobj
=
kobject_get
(
kobj
)))
if
(
!
(
kobj
=
kobject_get
(
kobj
)))
return
-
ENOENT
;
return
-
ENOENT
;
parent
=
kobject_get
(
kobj
->
parent
);
pr_debug
(
"kobject %s: registering. parent: %s, subsys: %s
\n
"
,
pr_debug
(
"kobject %s: registering. parent: %s, subsys: %s
\n
"
,
kobj
->
name
,
parent
?
parent
->
name
:
"<NULL>"
,
kobj
->
name
,
parent
?
parent
->
name
:
"<NULL>"
,
kobj
->
subsys
?
kobj
->
subsys
->
kobj
.
name
:
"<NULL>"
);
kobj
->
subsys
?
kobj
->
subsys
->
kobj
.
name
:
"<NULL>"
);
...
@@ -93,8 +96,8 @@ int kobject_add(struct kobject * kobj)
...
@@ -93,8 +96,8 @@ int kobject_add(struct kobject * kobj)
up_write
(
&
s
->
rwsem
);
up_write
(
&
s
->
rwsem
);
}
}
error
=
create_dir
(
kobj
);
error
=
create_dir
(
kobj
);
if
(
error
&&
kobj
->
parent
)
if
(
error
&&
parent
)
kobject_put
(
kobj
->
parent
);
kobject_put
(
parent
);
return
error
;
return
error
;
}
}
...
@@ -218,7 +221,7 @@ int subsystem_register(struct subsystem * s)
...
@@ -218,7 +221,7 @@ int subsystem_register(struct subsystem * s)
s
->
kobj
.
parent
=
&
s
->
parent
->
kobj
;
s
->
kobj
.
parent
=
&
s
->
parent
->
kobj
;
pr_debug
(
"subsystem %s: registering, parent: %s
\n
"
,
pr_debug
(
"subsystem %s: registering, parent: %s
\n
"
,
s
->
kobj
.
name
,
s
->
parent
?
s
->
parent
->
kobj
.
name
:
"<none>"
);
s
->
kobj
.
name
,
s
->
parent
?
s
->
parent
->
kobj
.
name
:
"<none>"
);
return
kobject_
register
(
&
s
->
kobj
);
return
kobject_
add
(
&
s
->
kobj
);
}
}
void
subsystem_unregister
(
struct
subsystem
*
s
)
void
subsystem_unregister
(
struct
subsystem
*
s
)
...
...
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