ar71xx: make ar934x_nfc driver compatible with 3.7
[openwrt/openwrt.git] / target / linux / ar71xx / patches-3.3 / a05-ar934x_nfc-add-buffer-verification.patch
1 --- a/drivers/mtd/nand/ar934x_nfc.c
2 +++ b/drivers/mtd/nand/ar934x_nfc.c
3 @@ -762,6 +762,18 @@ ar934x_nfc_read_buf(struct mtd_info *mtd
4 nfc->buf_index = buf_index;
5 }
6
7 +static int
8 +ar934x_nfc_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
9 +{
10 + int i;
11 +
12 + for (i = 0; i < len; i++)
13 + if (buf[i] != ar934x_nfc_read_byte(mtd))
14 + return -EFAULT;
15 +
16 + return 0;
17 +}
18 +
19 static void
20 ar934x_nfc_hw_init(struct ar934x_nfc *nfc)
21 {
22 @@ -1048,6 +1060,7 @@ ar934x_nfc_probe(struct platform_device
23 nand->read_byte = ar934x_nfc_read_byte;
24 nand->write_buf = ar934x_nfc_write_buf;
25 nand->read_buf = ar934x_nfc_read_buf;
26 + nand->verify_buf = ar934x_nfc_verify_buf;
27 nand->select_chip = ar934x_nfc_select_chip;
28
29 ret = ar934x_nfc_alloc_buf(nfc, AR934X_NFC_ID_BUF_SIZE);