All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anil Kumar <anilk4.v@gmail.com>
To: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Tony Lindgren <tony@atomide.com>, Afzal Mohammed <afzal@ti.com>,
	Jon Hunter <jon-hunter@ti.com>, Felipe Balbi <balbi@ti.com>
Subject: Re: [PATCH v2 3/8] ARM: omap2: gpmc: Fix gpmc_cs_reserved() return value
Date: Fri, 15 Feb 2013 21:49:21 +0530	[thread overview]
Message-ID: <CABYxbz6tZJjuz0NKorPSz_tWD42+HuHL3kwW0cegWW5QTDxH8g@mail.gmail.com> (raw)
In-Reply-To: <1360682305-20935-4-git-send-email-ezequiel.garcia@free-electrons.com>

Hi,

On Tue, Feb 12, 2013 at 8:48 PM, Ezequiel Garcia
<ezequiel.garcia@free-electrons.com> wrote:
> Currently gpmc_cs_reserved() return value is somewhat inconsistent,
> returning a negative value on an error condition, a positive value
> if the chip select is reserved and zero if it's available.
>
> Fix this by returning a boolean value as the function name suggests:
>   * true if the chip select is reserved,
>   * false if it's available
>
> Suggested-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> Changelog from v1:
>  * As suggested by Felipe Balbi, fix return code to a boolean
>
>  arch/arm/mach-omap2/gpmc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index bd3bc93..fa4764f 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -452,10 +452,10 @@ static int gpmc_cs_set_reserved(int cs, int reserved)
>         return 0;
>  }
>
> -static int gpmc_cs_reserved(int cs)
> +static bool gpmc_cs_reserved(int cs)
>  {
>         if (cs > GPMC_CS_NUM)
> -               return -ENODEV;
> +               return true;
>
>         return gpmc_cs_map & (1 << cs);
>  }

commit "6797b4fe0e554ce71f47038fd929c9ca929a9f3c"
Marking all the chip-selects as reserved by default.

In this case gpmc_cs_map is 0xff. So it will return 0x1 if cs is 0.
So gpmc_cs_request() function will fail in nand (gpmc-nand.c) case.

I am taking reference, branch "omap-for-v3.9/gpmc" of git tree
http://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git

I am sorry if this question is very vague.

Thanks,
Anil

WARNING: multiple messages have this Message-ID (diff)
From: anilk4.v@gmail.com (Anil Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/8] ARM: omap2: gpmc: Fix gpmc_cs_reserved() return value
Date: Fri, 15 Feb 2013 21:49:21 +0530	[thread overview]
Message-ID: <CABYxbz6tZJjuz0NKorPSz_tWD42+HuHL3kwW0cegWW5QTDxH8g@mail.gmail.com> (raw)
In-Reply-To: <1360682305-20935-4-git-send-email-ezequiel.garcia@free-electrons.com>

Hi,

On Tue, Feb 12, 2013 at 8:48 PM, Ezequiel Garcia
<ezequiel.garcia@free-electrons.com> wrote:
> Currently gpmc_cs_reserved() return value is somewhat inconsistent,
> returning a negative value on an error condition, a positive value
> if the chip select is reserved and zero if it's available.
>
> Fix this by returning a boolean value as the function name suggests:
>   * true if the chip select is reserved,
>   * false if it's available
>
> Suggested-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> Changelog from v1:
>  * As suggested by Felipe Balbi, fix return code to a boolean
>
>  arch/arm/mach-omap2/gpmc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index bd3bc93..fa4764f 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -452,10 +452,10 @@ static int gpmc_cs_set_reserved(int cs, int reserved)
>         return 0;
>  }
>
> -static int gpmc_cs_reserved(int cs)
> +static bool gpmc_cs_reserved(int cs)
>  {
>         if (cs > GPMC_CS_NUM)
> -               return -ENODEV;
> +               return true;
>
>         return gpmc_cs_map & (1 << cs);
>  }

commit "6797b4fe0e554ce71f47038fd929c9ca929a9f3c"
Marking all the chip-selects as reserved by default.

In this case gpmc_cs_map is 0xff. So it will return 0x1 if cs is 0.
So gpmc_cs_request() function will fail in nand (gpmc-nand.c) case.

I am taking reference, branch "omap-for-v3.9/gpmc" of git tree
http://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git

I am sorry if this question is very vague.

Thanks,
Anil

  reply	other threads:[~2013-02-15 16:19 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 15:18 [PATCH v2 0/8] ARM: omap2: GPMC cleanup Ezequiel Garcia
2013-02-12 15:18 ` Ezequiel Garcia
2013-02-12 15:18 ` [PATCH v2 1/8] ARM: omap2: gpmc: Mark local scoped functions static Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-12 15:18 ` [PATCH v2 2/8] ARM: omap2: gpmc: Remove unused gpmc_round_ns_to_ticks() function Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-12 15:18 ` [PATCH v2 3/8] ARM: omap2: gpmc: Fix gpmc_cs_reserved() return value Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-15 16:19   ` Anil Kumar [this message]
2013-02-15 16:19     ` Anil Kumar
2013-02-15 17:01     ` Ezequiel Garcia
2013-02-15 17:01       ` Ezequiel Garcia
2013-02-15 17:24       ` Anil Kumar
2013-02-15 17:24         ` Anil Kumar
2013-02-12 15:18 ` [PATCH v2 4/8] ARM: omap2: gpmc-nand: Print something useful on CS request failure Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-12 15:18 ` [PATCH v2 5/8] ARM: omap2: gpmc-onenand: " Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-12 15:18 ` [PATCH v2 6/8] ARM: omap2: gpmc-onenand: Replace pr_err() with dev_err() Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-12 15:18 ` [PATCH v2 7/8] ARM: omap2: gpmc-onenand: Replace printk KERN_ERR with dev_warn() Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-12 15:18 ` [PATCH v2 8/8] ARM: omap2: gpmc: Remove redundant chip select out of range check Ezequiel Garcia
2013-02-12 15:18   ` Ezequiel Garcia
2013-02-12 16:32 ` [PATCH v2 0/8] ARM: omap2: GPMC cleanup Jon Hunter
2013-02-12 16:32   ` Jon Hunter
2013-02-12 17:12   ` Tony Lindgren
2013-02-12 17:12     ` Tony Lindgren
2013-02-12 18:26     ` Ezequiel Garcia
2013-02-12 18:26       ` Ezequiel Garcia
2013-02-12 18:43       ` Tony Lindgren
2013-02-12 18:43         ` Tony Lindgren
2013-02-12 18:46         ` Ezequiel Garcia
2013-02-12 18:46           ` Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABYxbz6tZJjuz0NKorPSz_tWD42+HuHL3kwW0cegWW5QTDxH8g@mail.gmail.com \
    --to=anilk4.v@gmail.com \
    --cc=afzal@ti.com \
    --cc=balbi@ti.com \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=jon-hunter@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.