mci: add card_write_protected
Currently there is no common way for the mci host driver to tell that thee car is write protected. This adds a card_write_protected callback which is used by the framework to tell whether it's protected or not. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
456fae0227
commit
20615ac8c9
|
@ -1111,8 +1111,14 @@ static int __maybe_unused mci_sd_write(struct block_device *blk,
|
|||
const void *buffer, int block, int num_blocks)
|
||||
{
|
||||
struct mci *mci = container_of(blk, struct mci, blk);
|
||||
struct mci_host *host = mci->host;
|
||||
int rc;
|
||||
|
||||
if (host->card_write_protected && host->card_write_protected(host)) {
|
||||
dev_err(mci->mci_dev, "card write protected\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
dev_dbg(mci->mci_dev, "%s: Write %d block(s), starting at %d\n",
|
||||
__func__, num_blocks, block);
|
||||
|
||||
|
|
|
@ -302,6 +302,8 @@ struct mci_host {
|
|||
int (*send_cmd)(struct mci_host*, struct mci_cmd*, struct mci_data*);
|
||||
/** check if a card is inserted */
|
||||
int (*card_present)(struct mci_host *);
|
||||
/** check if a card is write protected */
|
||||
int (*card_write_protected)(struct mci_host *);
|
||||
};
|
||||
|
||||
/** MMC/SD and interface instance information */
|
||||
|
|
Loading…
Reference in New Issue