Re: [patch 2/5] Add MMC password protection (lock/unlock) support V3

From: Russell King
Date: Mon Jan 09 2006 - 17:31:49 EST


On Mon, Jan 09, 2006 at 06:15:35PM -0400, Anderson Briglia wrote:
> + cmd.opcode = MMC_LOCK_UNLOCK;
> + cmd.arg = 0;
> + cmd.flags = MMC_RSP_R1B;
> +
> + memset(&data, 0, sizeof(struct mmc_data));
> +
> + data.timeout_ns = card->csd.tacc_ns * 10;
> + data.timeout_clks = card->csd.tacc_clks * 10;
> + data.blksz_bits = blksz_bits(data_size);
> + data.blocks = 1;
> + data.flags = MMC_DATA_WRITE;
> + data.sg = &sg;
> + data.sg_len = 1;
> +
> + memset(&mrq, 0, sizeof(struct mmc_request));
> +
> + mrq.cmd = &cmd;
> + mrq.data = &data;
> +
> + sg_init_one(&sg, data_buf, data_size);
> + err = mmc_wait_for_req(card->host, &mrq);
> + if (err != MMC_ERR_NONE) {
> + mmc_card_set_dead(card);
> + goto error;
> + }

If the command error is MMC_ERR_INVALID, this means the host doesn't
support this operation, so we shouldn't set the card "dead".

> + memset(&cmd, 0, sizeof(struct mmc_command));

The ugly formatting monster makes an appearance. Tabs please.

> Index: linux-2.6.15-rc4/include/linux/mmc/host.h
> ===================================================================
> --- linux-2.6.15-rc4.orig/include/linux/mmc/host.h 2006-01-08 07:35:39.069715192 -0400
> +++ linux-2.6.15-rc4/include/linux/mmc/host.h 2006-01-08 07:49:40.763758248 -0400
> @@ -83,6 +83,7 @@
> u32 ocr_avail;
>
> unsigned long caps; /* Host capabilities */
> + int pwd_support; /* MMC password support */
>
> #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
>

And this means we don't need the "pwd_support" thing here. Even
if we did, it should be a host capability, not an "int".

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/