Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7474
b: refs/heads/master
c: 4bc20a8
h: refs/heads/master
v: v3
  • Loading branch information
Pierre Ossman authored and Linus Torvalds committed Sep 7, 2005
1 parent 17dee8a commit b3a736e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 65ae2118e84616680dce37b951ffc366dcce7cf0
refs/heads/master: 4bc20a8d497e137c0a9ee9a3bacce3dd4a2b6993
21 changes: 18 additions & 3 deletions trunk/drivers/mmc/mmc_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ MMC_ATTR(serial, "0x%08x\n", card->cid.serial);
static struct device_attribute mmc_dev_attrs[] = {
MMC_ATTR_RO(cid),
MMC_ATTR_RO(csd),
MMC_ATTR_RO(scr),
MMC_ATTR_RO(date),
MMC_ATTR_RO(fwrev),
MMC_ATTR_RO(hwrev),
Expand All @@ -59,6 +58,8 @@ static struct device_attribute mmc_dev_attrs[] = {
__ATTR_NULL
};

static struct device_attribute mmc_dev_attr_scr = MMC_ATTR_RO(scr);


static void mmc_release_card(struct device *dev)
{
Expand Down Expand Up @@ -209,10 +210,20 @@ void mmc_init_card(struct mmc_card *card, struct mmc_host *host)
*/
int mmc_register_card(struct mmc_card *card)
{
int ret;

snprintf(card->dev.bus_id, sizeof(card->dev.bus_id),
"%s:%04x", mmc_hostname(card->host), card->rca);

return device_add(&card->dev);
ret = device_add(&card->dev);
if (ret == 0) {
if (mmc_card_sd(card)) {
ret = device_create_file(&card->dev, &mmc_dev_attr_scr);
if (ret)
device_del(&card->dev);
}
}
return ret;
}

/*
Expand All @@ -221,8 +232,12 @@ int mmc_register_card(struct mmc_card *card)
*/
void mmc_remove_card(struct mmc_card *card)
{
if (mmc_card_present(card))
if (mmc_card_present(card)) {
if (mmc_card_sd(card))
device_remove_file(&card->dev, &mmc_dev_attr_scr);

device_del(&card->dev);
}

put_device(&card->dev);
}
Expand Down

0 comments on commit b3a736e

Please sign in to comment.