Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
dce77377
Commit
dce77377
authored
Aug 19, 2005
by
Russell King
Committed by
Russell King
Aug 19, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MMC] Use an IDR for host name indicies
Signed-off-by:
Russell King
<
rmk+kernel@arm.linux.org.uk
>
parent
1ad434d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
drivers/mmc/mmc_sysfs.c
drivers/mmc/mmc_sysfs.c
+19
-2
include/linux/mmc/host.h
include/linux/mmc/host.h
+1
-0
No files found.
drivers/mmc/mmc_sysfs.c
View file @
dce77377
...
...
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/idr.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
...
...
@@ -236,6 +237,9 @@ static struct class mmc_host_class = {
.
release
=
mmc_host_classdev_release
,
};
static
DEFINE_IDR
(
mmc_host_idr
);
static
DEFINE_SPINLOCK
(
mmc_host_lock
);
/*
* Internal function. Allocate a new MMC host.
*/
...
...
@@ -261,10 +265,19 @@ struct mmc_host *mmc_alloc_host_sysfs(int extra, struct device *dev)
*/
int
mmc_add_host_sysfs
(
struct
mmc_host
*
host
)
{
static
unsigned
int
host_num
;
int
err
;
if
(
!
idr_pre_get
(
&
mmc_host_idr
,
GFP_KERNEL
))
return
-
ENOMEM
;
spin_lock
(
&
mmc_host_lock
);
err
=
idr_get_new
(
&
mmc_host_idr
,
host
,
&
host
->
index
);
spin_unlock
(
&
mmc_host_lock
);
if
(
err
)
return
err
;
snprintf
(
host
->
class_dev
.
class_id
,
BUS_ID_SIZE
,
"mmc%d"
,
host
_num
++
);
"mmc%d"
,
host
->
index
);
return
class_device_add
(
&
host
->
class_dev
);
}
...
...
@@ -275,6 +288,10 @@ int mmc_add_host_sysfs(struct mmc_host *host)
void
mmc_remove_host_sysfs
(
struct
mmc_host
*
host
)
{
class_device_del
(
&
host
->
class_dev
);
spin_lock
(
&
mmc_host_lock
);
idr_remove
(
&
mmc_host_idr
,
host
->
index
);
spin_unlock
(
&
mmc_host_lock
);
}
/*
...
...
include/linux/mmc/host.h
View file @
dce77377
...
...
@@ -64,6 +64,7 @@ struct device;
struct
mmc_host
{
struct
device
*
dev
;
struct
class_device
class_dev
;
int
index
;
struct
mmc_host_ops
*
ops
;
unsigned
int
f_min
;
unsigned
int
f_max
;
...
...
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