lkml.org 
[lkml]   [2005]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] mmc: conditional scr sysfs entry
Only show the scr file in sysfs for SD cards. Previously this was
present for all cards but had a contents of 0 for MMC cards.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Index: linux-wbsd/drivers/mmc/mmc_sysfs.c
===================================================================
--- linux-wbsd/drivers/mmc/mmc_sysfs.c (revision 157)
+++ linux-wbsd/drivers/mmc/mmc_sysfs.c (working copy)
@@ -46,7 +46,6 @@
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),
@@ -57,6 +56,8 @@
__ATTR_NULL
};

+static struct device_attribute mmc_dev_attr_scr = MMC_ATTR_RO(scr);
+

static void mmc_release_card(struct device *dev)
{
@@ -207,10 +208,20 @@
*/
int mmc_register_card(struct mmc_card *card)
{
+ int ret;
+
snprintf(card->dev.bus_id, sizeof(card->dev.bus_id),
"%s:%04x", card->host->host_name, 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;
}

/*
@@ -219,8 +230,12 @@
*/
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);
}
\
 
 \ /
  Last update: 2005-08-30 11:38    [W:0.157 / U:0.112 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site