Small MMC Patch

From: Aric D. Blumer <aric_at_sdgsystems.com>
Date: Thu, 16 Jun 2005 12:16:22 -0400

I would like to be able to read the lock state on MMC and SD cards from
the /sys filesystem. The state of this switch is maintained in
card->state as the MMC_STATE_READONLY bit. The macros
mmc_card_set_readonly() and mmc_card_readonly() are used to set and read
this state.

The patch below creates a "lock" file in the /sys... directory for the
device which reflects the state of the switch. 1 = locked.

Let me know if there are problems with submitting this.

--- drivers/mmc/mmc_sysfs.c 12 Mar 2005 16:29:14 -0000 1.7
+++ drivers/mmc/mmc_sysfs.c 16 Jun 2005 16:14:45 -0000
@@ -171,6 +171,7 @@
 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);
+MMC_ATTR(lock, "%d\n", mmc_card_readonly(card)?1:0);
 
 static struct device_attribute *mmc_dev_attributes[] = {
         &dev_attr_cid,
@@ -183,6 +184,7 @@
         &dev_attr_name,
         &dev_attr_oemid,
         &dev_attr_serial,
+ &dev_attr_lock,
 };
 
 /*
Received on Thu Jun 16 2005 - 12:21:29 EDT

This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 18:35:13 EDT