@@ -2776,6 +2776,34 @@ struct key_type mmc_key_type = {
.match = mmc_key_match,
.destroy = mmc_key_destroy,
};
+
+int mmc_unlock_card(struct mmc_card *card)
+{
+ int stat;
+ struct mmc_password password;
+
+ mmc_card_set_locked(card);
+ stat = mmc_get_password(card, &password);
+ if (stat) {
+ pr_warn("%s: Cannot find matching key\n",
+ mmc_hostname(card->host));
+ return stat;
+ }
+ stat = mmc_lock_unlock(card, &password, MMC_LOCK_MODE_UNLOCK);
+ if (stat)
+ pr_warn("%s: Wrong password\n", mmc_hostname(card->host));
+ else
+ mmc_card_clear_locked(card);
+ return stat;
+}
+
+#else /* CONFIG_MMC_LOCK */
+
+int mmc_unlock_card(struct mmc_card *card)
+{
+ return -ENOKEY;
+}
+
#endif /* CONFIG_MMC_LOCK */
static int __init mmc_init(void)