Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1567810 > unrolled thread

[PATCH 04/13] mmc: bcm2835: add bcm2835_check_data_error

Started byGerd Hoffmann <kraxel@redhat.com>
First post2017-01-27 00:40 +0100
Last post2017-01-27 11:40 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 04/13] mmc: bcm2835: add bcm2835_check_data_error Gerd Hoffmann <kraxel@redhat.com> - 2017-01-27 00:40 +0100
    Re: [PATCH 04/13] mmc: bcm2835: add bcm2835_check_data_error Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-27 03:10 +0100
      Re: [PATCH 04/13] mmc: bcm2835: add bcm2835_check_data_error Gerd Hoffmann <kraxel@redhat.com> - 2017-01-27 11:40 +0100

#1567810 — [PATCH 04/13] mmc: bcm2835: add bcm2835_check_data_error

FromGerd Hoffmann <kraxel@redhat.com>
Date2017-01-27 00:40 +0100
Subject[PATCH 04/13] mmc: bcm2835: add bcm2835_check_data_error
Message-ID<t41O1-5cG-9@gated-at.bofh.it>
Factor out common code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/mmc/host/bcm2835.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 6f9fb12..d25b85a 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -951,6 +951,16 @@ static void bcm2835_timeout(unsigned long data)
 	spin_unlock_irqrestore(&host->lock, flags);
 }
 
+static void bcm2835_check_data_error(struct bcm2835_host *host, u32 intmask)
+{
+	if (!host->data)
+		return;
+	if (intmask & (SDHSTS_CRC16_ERROR | SDHSTS_FIFO_ERROR))
+		host->data->error = -EILSEQ;
+	if (intmask & SDHSTS_REW_TIME_OUT)
+		host->data->error = -ETIMEDOUT;
+}
+
 static void bcm2835_busy_irq(struct bcm2835_host *host, u32 intmask)
 {
 	struct device *dev = &host->pdev->dev;
@@ -1007,15 +1017,7 @@ static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask)
 	if (!host->data)
 		return;
 
-	if (intmask & (SDHSTS_CRC16_ERROR |
-		       SDHSTS_FIFO_ERROR |
-		       SDHSTS_REW_TIME_OUT)) {
-		if (intmask & (SDHSTS_CRC16_ERROR |
-			       SDHSTS_FIFO_ERROR))
-			host->data->error = -EILSEQ;
-		else
-			host->data->error = -ETIMEDOUT;
-	}
+	bcm2835_check_data_error(host, intmask);
 
 	if (host->data->error) {
 		bcm2835_finish_data(host);
@@ -1043,15 +1045,7 @@ static void bcm2835_block_irq(struct bcm2835_host *host, u32 intmask)
 		return;
 	}
 
-	if (intmask & (SDHSTS_CRC16_ERROR |
-		       SDHSTS_FIFO_ERROR |
-		       SDHSTS_REW_TIME_OUT)) {
-		if (intmask & (SDHSTS_CRC16_ERROR |
-			       SDHSTS_FIFO_ERROR))
-			host->data->error = -EILSEQ;
-		else
-			host->data->error = -ETIMEDOUT;
-	}
+	bcm2835_check_data_error(host, intmask);
 
 	if (!host->dma_desc) {
 		WARN_ON(!host->blocks);
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1567866

FromShawn Lin <shawn.lin@rock-chips.com>
Date2017-01-27 03:10 +0100
Message-ID<t449b-6GZ-5@gated-at.bofh.it>
In reply to#1567810
On 2017/1/27 7:37, Gerd Hoffmann wrote:
> Factor out common code.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  drivers/mmc/host/bcm2835.c | 30 ++++++++++++------------------
>  1 file changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
> index 6f9fb12..d25b85a 100644
> --- a/drivers/mmc/host/bcm2835.c
> +++ b/drivers/mmc/host/bcm2835.c
> @@ -951,6 +951,16 @@ static void bcm2835_timeout(unsigned long data)
>  	spin_unlock_irqrestore(&host->lock, flags);
>  }
>
> +static void bcm2835_check_data_error(struct bcm2835_host *host, u32 intmask)
> +{
> +	if (!host->data)
> +		return;
> +	if (intmask & (SDHSTS_CRC16_ERROR | SDHSTS_FIFO_ERROR))
> +		host->data->error = -EILSEQ;
> +	if (intmask & SDHSTS_REW_TIME_OUT)
> +		host->data->error = -ETIMEDOUT;
> +}
> +
>  static void bcm2835_busy_irq(struct bcm2835_host *host, u32 intmask)
>  {
>  	struct device *dev = &host->pdev->dev;
> @@ -1007,15 +1017,7 @@ static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask)
>  	if (!host->data)
>  		return;
>

remove this check, !host->data, as well.

> -	if (intmask & (SDHSTS_CRC16_ERROR |
> -		       SDHSTS_FIFO_ERROR |
> -		       SDHSTS_REW_TIME_OUT)) {
> -		if (intmask & (SDHSTS_CRC16_ERROR |
> -			       SDHSTS_FIFO_ERROR))
> -			host->data->error = -EILSEQ;
> -		else
> -			host->data->error = -ETIMEDOUT;
> -	}
> +	bcm2835_check_data_error(host, intmask);
>
>  	if (host->data->error) {
>  		bcm2835_finish_data(host);
> @@ -1043,15 +1045,7 @@ static void bcm2835_block_irq(struct bcm2835_host *host, u32 intmask)
>  		return;
>  	}
>
> -	if (intmask & (SDHSTS_CRC16_ERROR |
> -		       SDHSTS_FIFO_ERROR |
> -		       SDHSTS_REW_TIME_OUT)) {
> -		if (intmask & (SDHSTS_CRC16_ERROR |
> -			       SDHSTS_FIFO_ERROR))
> -			host->data->error = -EILSEQ;
> -		else
> -			host->data->error = -ETIMEDOUT;
> -	}
> +	bcm2835_check_data_error(host, intmask);
>
>  	if (!host->dma_desc) {
>  		WARN_ON(!host->blocks);
>


-- 
Best Regards
Shawn Lin

[toc] | [prev] | [next] | [standalone]


#1568032

FromGerd Hoffmann <kraxel@redhat.com>
Date2017-01-27 11:40 +0100
Message-ID<t4c6J-2Vw-7@gated-at.bofh.it>
In reply to#1567866
  Hi,

> > @@ -1007,15 +1017,7 @@ static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask)
> >  	if (!host->data)
> >  		return;
> >
> 
> remove this check, !host->data, as well.

There is a comment in the code saying it is needed, here is more
context:

static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask)
{
	/* There are no dedicated data/space available interrupt
	 * status bits, so it is necessary to use the single shared
	 * data/space available FIFO status bits. It is therefore not
	 * an error to get here when there is no data transfer in
	 * progress.
	 */
	if (!host->data)
		return;

	bcm2835_check_data_error(host, intmask);

cheers,
  Gerd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web