[PATCH 1/2] mtd: nand: force NAND_CMD_READID onto 8-bit bus

Gupta, Pekon pekon at ti.com
Thu Jan 30 14:17:29 EST 2014


Hi Brian,

>From: Brian Norris [mailto:computersforpeace at gmail.com]
>diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
>index a719686c9cce..c034dc4224cb 100644
>--- a/include/linux/mtd/nand.h
>+++ b/include/linux/mtd/nand.h
>@@ -832,4 +832,14 @@ static inline bool nand_is_slc(struct nand_chip *chip)
> {
> 	return chip->bits_per_cell == 1;
> }
>+
>+/**
>+ * Check if the opcode's address should be sent only on the lower 8 bits
>+ * @command: opcode to check
>+ */
>+static inline int nand_opcode_8bits(unsigned int command)
>+{
>+	return command == NAND_CMD_READID;
>+}
>+
>
Can 'nand_opcode_8bits, made a macro instead of inline function ?
#define IS_8BIT_CMD(cmd)  (unlikely(cmd == NAND_CMD_READID))

Because 'nand_opcode_8bits' is used in nand_command() and nand_command_lp()
which is performance critical code (chip->cmd is called multiple times for fetching
page data and OOB). Though we should expect compiler to treat this inline function
same as macro here, But just to be doubly sure for future changes also.

[1] http://stackoverflow.com/questions/1571392/pros-and-cons-of-different-macro-function-inline-methods-in-c
[2] http://stackoverflow.com/questions/5226803/inline-function-v-macro-in-c-whats-the-overhead-memory-speed

with regards, pekon



More information about the linux-mtd mailing list