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
992b0b1c
Commit
992b0b1c
authored
Mar 04, 2005
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://bk.arm.linux.org.uk/linux-2.6-mmc
into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents
edaa05a6
c87203c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
40 deletions
+37
-40
drivers/mmc/mmc_sysfs.c
drivers/mmc/mmc_sysfs.c
+37
-40
No files found.
drivers/mmc/mmc_sysfs.c
View file @
992b0b1c
...
@@ -21,6 +21,41 @@
...
@@ -21,6 +21,41 @@
#define dev_to_mmc_card(d) container_of(d, struct mmc_card, dev)
#define dev_to_mmc_card(d) container_of(d, struct mmc_card, dev)
#define to_mmc_driver(d) container_of(d, struct mmc_driver, drv)
#define to_mmc_driver(d) container_of(d, struct mmc_driver, drv)
#define MMC_ATTR(name, fmt, args...) \
static ssize_t mmc_##name##_show (struct device *dev, char *buf) \
{ \
struct mmc_card *card = dev_to_mmc_card(dev); \
return sprintf(buf, fmt, args); \
}
MMC_ATTR
(
cid
,
"%08x%08x%08x%08x
\n
"
,
card
->
raw_cid
[
0
],
card
->
raw_cid
[
1
],
card
->
raw_cid
[
2
],
card
->
raw_cid
[
3
]);
MMC_ATTR
(
csd
,
"%08x%08x%08x%08x
\n
"
,
card
->
raw_csd
[
0
],
card
->
raw_csd
[
1
],
card
->
raw_csd
[
2
],
card
->
raw_csd
[
3
]);
MMC_ATTR
(
date
,
"%02d/%04d
\n
"
,
card
->
cid
.
month
,
card
->
cid
.
year
);
MMC_ATTR
(
fwrev
,
"0x%x
\n
"
,
card
->
cid
.
fwrev
);
MMC_ATTR
(
hwrev
,
"0x%x
\n
"
,
card
->
cid
.
hwrev
);
MMC_ATTR
(
manfid
,
"0x%06x
\n
"
,
card
->
cid
.
manfid
);
MMC_ATTR
(
name
,
"%s
\n
"
,
card
->
cid
.
prod_name
);
MMC_ATTR
(
oemid
,
"0x%04x
\n
"
,
card
->
cid
.
oemid
);
MMC_ATTR
(
serial
,
"0x%08x
\n
"
,
card
->
cid
.
serial
);
#define MMC_ATTR_RO(name) __ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
static
struct
device_attribute
mmc_dev_attrs
[]
=
{
MMC_ATTR_RO
(
cid
),
MMC_ATTR_RO
(
csd
),
MMC_ATTR_RO
(
date
),
MMC_ATTR_RO
(
fwrev
),
MMC_ATTR_RO
(
hwrev
),
MMC_ATTR_RO
(
manfid
),
MMC_ATTR_RO
(
name
),
MMC_ATTR_RO
(
oemid
),
MMC_ATTR_RO
(
serial
),
__ATTR_NULL
};
static
void
mmc_release_card
(
struct
device
*
dev
)
static
void
mmc_release_card
(
struct
device
*
dev
)
{
{
struct
mmc_card
*
card
=
dev_to_mmc_card
(
dev
);
struct
mmc_card
*
card
=
dev_to_mmc_card
(
dev
);
...
@@ -98,6 +133,7 @@ static int mmc_bus_resume(struct device *dev)
...
@@ -98,6 +133,7 @@ static int mmc_bus_resume(struct device *dev)
static
struct
bus_type
mmc_bus_type
=
{
static
struct
bus_type
mmc_bus_type
=
{
.
name
=
"mmc"
,
.
name
=
"mmc"
,
.
dev_attrs
=
mmc_dev_attrs
,
.
match
=
mmc_bus_match
,
.
match
=
mmc_bus_match
,
.
hotplug
=
mmc_bus_hotplug
,
.
hotplug
=
mmc_bus_hotplug
,
.
suspend
=
mmc_bus_suspend
,
.
suspend
=
mmc_bus_suspend
,
...
@@ -151,38 +187,6 @@ void mmc_unregister_driver(struct mmc_driver *drv)
...
@@ -151,38 +187,6 @@ void mmc_unregister_driver(struct mmc_driver *drv)
EXPORT_SYMBOL
(
mmc_unregister_driver
);
EXPORT_SYMBOL
(
mmc_unregister_driver
);
#define MMC_ATTR(name, fmt, args...) \
static ssize_t mmc_dev_show_##name (struct device *dev, char *buf) \
{ \
struct mmc_card *card = dev_to_mmc_card(dev); \
return sprintf(buf, fmt, args); \
} \
static DEVICE_ATTR(name, S_IRUGO, mmc_dev_show_##name, NULL)
MMC_ATTR
(
cid
,
"%08x%08x%08x%08x
\n
"
,
card
->
raw_cid
[
0
],
card
->
raw_cid
[
1
],
card
->
raw_cid
[
2
],
card
->
raw_cid
[
3
]);
MMC_ATTR
(
csd
,
"%08x%08x%08x%08x
\n
"
,
card
->
raw_csd
[
0
],
card
->
raw_csd
[
1
],
card
->
raw_csd
[
2
],
card
->
raw_csd
[
3
]);
MMC_ATTR
(
date
,
"%02d/%04d
\n
"
,
card
->
cid
.
month
,
card
->
cid
.
year
);
MMC_ATTR
(
fwrev
,
"0x%x
\n
"
,
card
->
cid
.
fwrev
);
MMC_ATTR
(
hwrev
,
"0x%x
\n
"
,
card
->
cid
.
hwrev
);
MMC_ATTR
(
manfid
,
"0x%06x
\n
"
,
card
->
cid
.
manfid
);
MMC_ATTR
(
name
,
"%s
\n
"
,
card
->
cid
.
prod_name
);
MMC_ATTR
(
oemid
,
"0x%04x
\n
"
,
card
->
cid
.
oemid
);
MMC_ATTR
(
serial
,
"0x%08x
\n
"
,
card
->
cid
.
serial
);
static
struct
device_attribute
*
mmc_dev_attributes
[]
=
{
&
dev_attr_cid
,
&
dev_attr_csd
,
&
dev_attr_date
,
&
dev_attr_fwrev
,
&
dev_attr_hwrev
,
&
dev_attr_manfid
,
&
dev_attr_name
,
&
dev_attr_oemid
,
&
dev_attr_serial
,
};
/*
/*
* Internal function. Initialise a MMC card structure.
* Internal function. Initialise a MMC card structure.
*/
*/
...
@@ -201,17 +205,10 @@ void mmc_init_card(struct mmc_card *card, struct mmc_host *host)
...
@@ -201,17 +205,10 @@ void mmc_init_card(struct mmc_card *card, struct mmc_host *host)
*/
*/
int
mmc_register_card
(
struct
mmc_card
*
card
)
int
mmc_register_card
(
struct
mmc_card
*
card
)
{
{
int
ret
,
i
;
snprintf
(
card
->
dev
.
bus_id
,
sizeof
(
card
->
dev
.
bus_id
),
snprintf
(
card
->
dev
.
bus_id
,
sizeof
(
card
->
dev
.
bus_id
),
"%s:%04x"
,
card
->
host
->
host_name
,
card
->
rca
);
"%s:%04x"
,
card
->
host
->
host_name
,
card
->
rca
);
ret
=
device_add
(
&
card
->
dev
);
return
device_add
(
&
card
->
dev
);
if
(
ret
==
0
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
mmc_dev_attributes
);
i
++
)
device_create_file
(
&
card
->
dev
,
mmc_dev_attributes
[
i
]);
return
ret
;
}
}
/*
/*
...
...
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