diff mbox

[05/11] mtd: add a helper to get the supported features for ONFI nand

Message ID 1363605534-24776-6-git-send-email-b32955@freescale.com
State New, archived
Headers show

Commit Message

Huang Shijie March 18, 2013, 11:18 a.m. UTC
From: Huang Shijie <shijie8@gmail.com>

add a helper to get the supported features for ONFI nand.
Also add the neccessary macros.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 include/linux/mtd/nand.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Comments

Brian Norris April 22, 2013, 4:29 a.m. UTC | #1
On Mon, Mar 18, 2013 at 4:18 AM, Huang Shijie <b32955@freescale.com> wrote:
> From: Huang Shijie <shijie8@gmail.com>
>
> add a helper to get the supported features for ONFI nand.
> Also add the neccessary macros.
>
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
>  include/linux/mtd/nand.h |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index 94ae957..2c5a2e0 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -195,6 +195,11 @@ typedef enum {
>  /* Keep gcc happy */
>  struct nand_chip;
>
> +/* ONFI features */
> +#define ONFI_FEATURE_16_BIT_BUS                (1 << 0)
> +#define ONFI_FEATURE_EXT_PARAM_PAGE    (1 << 7)
> +#define ONFI_FEATURE_UNKNOWN           (1 << 15)
> +
>  /* ONFI timing mode, used in both asynchronous and synchronous mode */
>  #define ONFI_TIMING_MODE_0             (1 << 0)
>  #define ONFI_TIMING_MODE_1             (1 << 1)
> @@ -743,6 +748,14 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
>         return chip->priv;
>  }
>
> +/* return the supported features. */
> +static inline int onfi_get_feature(struct nand_chip *chip)

This function naming seems too close to the chip->onfi_get_features
function pointer. They serve totally different purposes (I think) and
should clearly be shown to be different in some way--preferably by
naming.

> +{
> +       if (!chip->onfi_version)
> +               return ONFI_FEATURE_UNKNOWN;
> +       return le16_to_cpu(chip->onfi_params.features);
> +}
> +
>  /* return the supported asynchronous timing mode. */
>  static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
>  {

Brian
Huang Shijie April 22, 2013, 6:30 a.m. UTC | #2
于 2013年04月22日 12:29, Brian Norris 写道:
>> +/* return the supported features. */
>> >  +static inline int onfi_get_feature(struct nand_chip *chip)
> This function naming seems too close to the chip->onfi_get_features
> function pointer. They serve totally different purposes (I think) and
> should clearly be shown to be different in some way--preferably by
> naming.
>
ok.

what's about onfi_feature()?

Remove the "get" from the function name.

thanks
Huang Shijie
diff mbox

Patch

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 94ae957..2c5a2e0 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -195,6 +195,11 @@  typedef enum {
 /* Keep gcc happy */
 struct nand_chip;
 
+/* ONFI features */
+#define ONFI_FEATURE_16_BIT_BUS		(1 << 0)
+#define ONFI_FEATURE_EXT_PARAM_PAGE	(1 << 7)
+#define ONFI_FEATURE_UNKNOWN		(1 << 15)
+
 /* ONFI timing mode, used in both asynchronous and synchronous mode */
 #define ONFI_TIMING_MODE_0		(1 << 0)
 #define ONFI_TIMING_MODE_1		(1 << 1)
@@ -743,6 +748,14 @@  struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
 	return chip->priv;
 }
 
+/* return the supported features. */
+static inline int onfi_get_feature(struct nand_chip *chip)
+{
+	if (!chip->onfi_version)
+		return ONFI_FEATURE_UNKNOWN;
+	return le16_to_cpu(chip->onfi_params.features);
+}
+
 /* return the supported asynchronous timing mode. */
 static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
 {