linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: Convert sdhci_allocate_bounce_buffer() to return void
@ 2018-10-24  8:01 Chunyan Zhang
  2018-10-24 13:50 ` Ulf Hansson
  2018-10-25  2:12 ` Chunyan Zhang
  0 siblings, 2 replies; 4+ messages in thread
From: Chunyan Zhang @ 2018-10-24  8:01 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter
  Cc: linux-kernel, linux-arm-kernel, Linus Walleij, Chunyan Zhang

The function sdhci_allocate_bounce_buffer() always return zero at
present, so there's no need to have a return value, that will also make
error path easier.

CC: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
---
 drivers/mmc/host/sdhci.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 1b3fbd9..e94f4aa 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3408,7 +3408,7 @@ void __sdhci_read_caps(struct sdhci_host *host, u16 *ver, u32 *caps, u32 *caps1)
 }
 EXPORT_SYMBOL_GPL(__sdhci_read_caps);
 
-static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
+static void sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 {
 	struct mmc_host *mmc = host->mmc;
 	unsigned int max_blocks;
@@ -3446,7 +3446,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 		 * Exiting with zero here makes sure we proceed with
 		 * mmc->max_segs == 1.
 		 */
-		return 0;
+		return;
 	}
 
 	host->bounce_addr = dma_map_single(mmc->parent,
@@ -3456,7 +3456,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 	ret = dma_mapping_error(mmc->parent, host->bounce_addr);
 	if (ret)
 		/* Again fall back to max_segs == 1 */
-		return 0;
+		return;
 	host->bounce_buffer_size = bounce_size;
 
 	/* Lie about this since we're bouncing */
@@ -3466,8 +3466,6 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 
 	pr_info("%s bounce up to %u segments into one, max segment size %u bytes\n",
 		mmc_hostname(mmc), max_blocks, bounce_size);
-
-	return 0;
 }
 
 int sdhci_setup_host(struct sdhci_host *host)
@@ -3987,12 +3985,9 @@ int sdhci_setup_host(struct sdhci_host *host)
 	 */
 	mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535;
 
-	if (mmc->max_segs == 1) {
+	if (mmc->max_segs == 1)
 		/* This may alter mmc->*_blk_* parameters */
-		ret = sdhci_allocate_bounce_buffer(host);
-		if (ret)
-			return ret;
-	}
+		sdhci_allocate_bounce_buffer(host);
 
 	return 0;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci: Convert sdhci_allocate_bounce_buffer() to return void
  2018-10-24  8:01 [PATCH] mmc: sdhci: Convert sdhci_allocate_bounce_buffer() to return void Chunyan Zhang
@ 2018-10-24 13:50 ` Ulf Hansson
  2018-10-25  2:12 ` Chunyan Zhang
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2018-10-24 13:50 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Adrian Hunter, Linux Kernel Mailing List, Linux ARM,
	Linus Walleij, Chunyan Zhang

On 24 October 2018 at 10:01, Chunyan Zhang <zhang.chunyan@linaro.org> wrote:
> The function sdhci_allocate_bounce_buffer() always return zero at
> present, so there's no need to have a return value, that will also make
> error path easier.
>
> CC: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>

This looks good to me, however please re-post to linux-mmc.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 1b3fbd9..e94f4aa 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -3408,7 +3408,7 @@ void __sdhci_read_caps(struct sdhci_host *host, u16 *ver, u32 *caps, u32 *caps1)
>  }
>  EXPORT_SYMBOL_GPL(__sdhci_read_caps);
>
> -static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
> +static void sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>  {
>         struct mmc_host *mmc = host->mmc;
>         unsigned int max_blocks;
> @@ -3446,7 +3446,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>                  * Exiting with zero here makes sure we proceed with
>                  * mmc->max_segs == 1.
>                  */
> -               return 0;
> +               return;
>         }
>
>         host->bounce_addr = dma_map_single(mmc->parent,
> @@ -3456,7 +3456,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>         ret = dma_mapping_error(mmc->parent, host->bounce_addr);
>         if (ret)
>                 /* Again fall back to max_segs == 1 */
> -               return 0;
> +               return;
>         host->bounce_buffer_size = bounce_size;
>
>         /* Lie about this since we're bouncing */
> @@ -3466,8 +3466,6 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>
>         pr_info("%s bounce up to %u segments into one, max segment size %u bytes\n",
>                 mmc_hostname(mmc), max_blocks, bounce_size);
> -
> -       return 0;
>  }
>
>  int sdhci_setup_host(struct sdhci_host *host)
> @@ -3987,12 +3985,9 @@ int sdhci_setup_host(struct sdhci_host *host)
>          */
>         mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535;
>
> -       if (mmc->max_segs == 1) {
> +       if (mmc->max_segs == 1)
>                 /* This may alter mmc->*_blk_* parameters */
> -               ret = sdhci_allocate_bounce_buffer(host);
> -               if (ret)
> -                       return ret;
> -       }
> +               sdhci_allocate_bounce_buffer(host);
>
>         return 0;
>
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] mmc: sdhci: Convert sdhci_allocate_bounce_buffer() to return void
  2018-10-24  8:01 [PATCH] mmc: sdhci: Convert sdhci_allocate_bounce_buffer() to return void Chunyan Zhang
  2018-10-24 13:50 ` Ulf Hansson
@ 2018-10-25  2:12 ` Chunyan Zhang
  2018-11-12 11:05   ` Ulf Hansson
  1 sibling, 1 reply; 4+ messages in thread
From: Chunyan Zhang @ 2018-10-25  2:12 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter
  Cc: linux-mmc, linux-kernel, Linus Walleij, Chunyan Zhang

The function sdhci_allocate_bounce_buffer() always return zero at
present, so there's no need to have a return value, that will also make
error path easier.

CC: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
---
 drivers/mmc/host/sdhci.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 1b3fbd9..e94f4aa 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3408,7 +3408,7 @@ void __sdhci_read_caps(struct sdhci_host *host, u16 *ver, u32 *caps, u32 *caps1)
 }
 EXPORT_SYMBOL_GPL(__sdhci_read_caps);
 
-static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
+static void sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 {
 	struct mmc_host *mmc = host->mmc;
 	unsigned int max_blocks;
@@ -3446,7 +3446,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 		 * Exiting with zero here makes sure we proceed with
 		 * mmc->max_segs == 1.
 		 */
-		return 0;
+		return;
 	}
 
 	host->bounce_addr = dma_map_single(mmc->parent,
@@ -3456,7 +3456,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 	ret = dma_mapping_error(mmc->parent, host->bounce_addr);
 	if (ret)
 		/* Again fall back to max_segs == 1 */
-		return 0;
+		return;
 	host->bounce_buffer_size = bounce_size;
 
 	/* Lie about this since we're bouncing */
@@ -3466,8 +3466,6 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
 
 	pr_info("%s bounce up to %u segments into one, max segment size %u bytes\n",
 		mmc_hostname(mmc), max_blocks, bounce_size);
-
-	return 0;
 }
 
 int sdhci_setup_host(struct sdhci_host *host)
@@ -3987,12 +3985,9 @@ int sdhci_setup_host(struct sdhci_host *host)
 	 */
 	mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535;
 
-	if (mmc->max_segs == 1) {
+	if (mmc->max_segs == 1)
 		/* This may alter mmc->*_blk_* parameters */
-		ret = sdhci_allocate_bounce_buffer(host);
-		if (ret)
-			return ret;
-	}
+		sdhci_allocate_bounce_buffer(host);
 
 	return 0;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci: Convert sdhci_allocate_bounce_buffer() to return void
  2018-10-25  2:12 ` Chunyan Zhang
@ 2018-11-12 11:05   ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2018-11-12 11:05 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Adrian Hunter, linux-mmc, Linux Kernel Mailing List,
	Linus Walleij, Chunyan Zhang

On 25 October 2018 at 04:12, Chunyan Zhang <zhang.chunyan@linaro.org> wrote:
> The function sdhci_allocate_bounce_buffer() always return zero at
> present, so there's no need to have a return value, that will also make
> error path easier.
>
> CC: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>

Applied for next, thanks!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 1b3fbd9..e94f4aa 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -3408,7 +3408,7 @@ void __sdhci_read_caps(struct sdhci_host *host, u16 *ver, u32 *caps, u32 *caps1)
>  }
>  EXPORT_SYMBOL_GPL(__sdhci_read_caps);
>
> -static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
> +static void sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>  {
>         struct mmc_host *mmc = host->mmc;
>         unsigned int max_blocks;
> @@ -3446,7 +3446,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>                  * Exiting with zero here makes sure we proceed with
>                  * mmc->max_segs == 1.
>                  */
> -               return 0;
> +               return;
>         }
>
>         host->bounce_addr = dma_map_single(mmc->parent,
> @@ -3456,7 +3456,7 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>         ret = dma_mapping_error(mmc->parent, host->bounce_addr);
>         if (ret)
>                 /* Again fall back to max_segs == 1 */
> -               return 0;
> +               return;
>         host->bounce_buffer_size = bounce_size;
>
>         /* Lie about this since we're bouncing */
> @@ -3466,8 +3466,6 @@ static int sdhci_allocate_bounce_buffer(struct sdhci_host *host)
>
>         pr_info("%s bounce up to %u segments into one, max segment size %u bytes\n",
>                 mmc_hostname(mmc), max_blocks, bounce_size);
> -
> -       return 0;
>  }
>
>  int sdhci_setup_host(struct sdhci_host *host)
> @@ -3987,12 +3985,9 @@ int sdhci_setup_host(struct sdhci_host *host)
>          */
>         mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535;
>
> -       if (mmc->max_segs == 1) {
> +       if (mmc->max_segs == 1)
>                 /* This may alter mmc->*_blk_* parameters */
> -               ret = sdhci_allocate_bounce_buffer(host);
> -               if (ret)
> -                       return ret;
> -       }
> +               sdhci_allocate_bounce_buffer(host);
>
>         return 0;
>
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-12 11:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-24  8:01 [PATCH] mmc: sdhci: Convert sdhci_allocate_bounce_buffer() to return void Chunyan Zhang
2018-10-24 13:50 ` Ulf Hansson
2018-10-25  2:12 ` Chunyan Zhang
2018-11-12 11:05   ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).