diff mbox

SOLO6x10: don't do DMA from stack in solo_dma_vin_region().

Message ID m37gemb51b.fsf@t19.piap.pl (mailing list archive)
State New, archived
Headers show

Commit Message

Krzysztof HaƂasa Sept. 12, 2013, 12:25 p.m. UTC
Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Hans Verkuil Sept. 30, 2013, 7:51 a.m. UTC | #1
Ismael,

Can you Ack these four patches?

Regards,

	Hans

On 09/12/2013 02:25 PM, Krzysztof Ha?asa wrote:
> Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl>
> 
> diff --git a/drivers/staging/media/solo6x10/solo6x10-disp.c b/drivers/staging/media/solo6x10/solo6x10-disp.c
> index 32d9953..884512e 100644
> --- a/drivers/staging/media/solo6x10/solo6x10-disp.c
> +++ b/drivers/staging/media/solo6x10/solo6x10-disp.c
> @@ -176,18 +176,26 @@ static void solo_vout_config(struct solo_dev *solo_dev)
>  static int solo_dma_vin_region(struct solo_dev *solo_dev, u32 off,
>  			       u16 val, int reg_size)
>  {
> -	u16 buf[64];
> -	int i;
> -	int ret = 0;
> +	u16 *buf;
> +	const int n = 64, size = n * sizeof(*buf);
> +	int i, ret = 0;
> +
> +	if (!(buf = kmalloc(size, GFP_KERNEL)))
> +		return -ENOMEM;
>  
> -	for (i = 0; i < sizeof(buf) >> 1; i++)
> +	for (i = 0; i < n; i++)
>  		buf[i] = cpu_to_le16(val);
>  
> -	for (i = 0; i < reg_size; i += sizeof(buf))
> -		ret |= solo_p2m_dma(solo_dev, 1, buf,
> -				    SOLO_MOTION_EXT_ADDR(solo_dev) + off + i,
> -				    sizeof(buf), 0, 0);
> +	for (i = 0; i < reg_size; i += size) {
> +		ret = solo_p2m_dma(solo_dev, 1, buf,
> +				   SOLO_MOTION_EXT_ADDR(solo_dev) + off + i,
> +				   size, 0, 0);
> +
> +		if (ret)
> +			break;
> +	}
>  
> +	kfree(buf);
>  	return ret;
>  }
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ismael Luceno Nov. 5, 2013, 10:08 p.m. UTC | #2
On Thu, 12 Sep 2013 14:25:36 +0200
khalasa@piap.pl (Krzysztof Ha?asa) wrote:
> Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl>

Acked-by: Ismael Luceno <ismael.luceno@corp.bluecherry.net>

<...>
diff mbox

Patch

diff --git a/drivers/staging/media/solo6x10/solo6x10-disp.c b/drivers/staging/media/solo6x10/solo6x10-disp.c
index 32d9953..884512e 100644
--- a/drivers/staging/media/solo6x10/solo6x10-disp.c
+++ b/drivers/staging/media/solo6x10/solo6x10-disp.c
@@ -176,18 +176,26 @@  static void solo_vout_config(struct solo_dev *solo_dev)
 static int solo_dma_vin_region(struct solo_dev *solo_dev, u32 off,
 			       u16 val, int reg_size)
 {
-	u16 buf[64];
-	int i;
-	int ret = 0;
+	u16 *buf;
+	const int n = 64, size = n * sizeof(*buf);
+	int i, ret = 0;
+
+	if (!(buf = kmalloc(size, GFP_KERNEL)))
+		return -ENOMEM;
 
-	for (i = 0; i < sizeof(buf) >> 1; i++)
+	for (i = 0; i < n; i++)
 		buf[i] = cpu_to_le16(val);
 
-	for (i = 0; i < reg_size; i += sizeof(buf))
-		ret |= solo_p2m_dma(solo_dev, 1, buf,
-				    SOLO_MOTION_EXT_ADDR(solo_dev) + off + i,
-				    sizeof(buf), 0, 0);
+	for (i = 0; i < reg_size; i += size) {
+		ret = solo_p2m_dma(solo_dev, 1, buf,
+				   SOLO_MOTION_EXT_ADDR(solo_dev) + off + i,
+				   size, 0, 0);
+
+		if (ret)
+			break;
+	}
 
+	kfree(buf);
 	return ret;
 }