mmc: get back read-only switch function
authorPierre Ossman <drzeus@drzeus.cx>
Wed, 13 Jun 2007 17:06:03 +0000 (19:06 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Wed, 13 Jun 2007 17:11:20 +0000 (19:11 +0200)
Somehow the code to read the read-only switch of SD cards got lost
in the reorganisation.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/core/sd.c

index 41bfb5dfe6ff1351d1c5845d753c6da3f4bd84e5..918477c490b0207bbc5a81733d0289b7f3b8ff76 100644 (file)
@@ -427,6 +427,21 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
                mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
        }
 
+       /*
+        * Check if read-only switch is active.
+        */
+       if (!oldcard) {
+               if (!host->ops->get_ro) {
+                       printk(KERN_WARNING "%s: host does not "
+                               "support reading read-only "
+                               "switch. assuming write-enable.\n",
+                               mmc_hostname(host));
+               } else {
+                       if (host->ops->get_ro(host))
+                               mmc_card_set_readonly(card);
+               }
+       }
+
        if (!oldcard)
                host->card = card;