Răsfoiți Sursa

Merge branch 'sh/for-2.6.34' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* 'sh/for-2.6.34' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  sh: fix a number of Oopses and leaks in SH framebuffer driver
  SH: fix error paths in DMA driver
  sh: sh7751 pci controller io port fix
  sh: Fix maximum number of SCIF ports in R2D defconfigs
  SH: fix TS field shift calculation for DMA drivers
Linus Torvalds 15 ani în urmă
părinte
comite
bbfdbe9dc0

+ 1 - 1
arch/sh/configs/rts7751r2d1_defconfig

@@ -877,7 +877,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
 #
 #
 # CONFIG_SERIAL_MAX3100 is not set
 # CONFIG_SERIAL_MAX3100 is not set
 CONFIG_SERIAL_SH_SCI=y
 CONFIG_SERIAL_SH_SCI=y
-CONFIG_SERIAL_SH_SCI_NR_UARTS=1
+CONFIG_SERIAL_SH_SCI_NR_UARTS=2
 CONFIG_SERIAL_SH_SCI_CONSOLE=y
 CONFIG_SERIAL_SH_SCI_CONSOLE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CORE_CONSOLE=y

+ 1 - 1
arch/sh/configs/rts7751r2dplus_defconfig

@@ -963,7 +963,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
 #
 #
 # CONFIG_SERIAL_MAX3100 is not set
 # CONFIG_SERIAL_MAX3100 is not set
 CONFIG_SERIAL_SH_SCI=y
 CONFIG_SERIAL_SH_SCI=y
-CONFIG_SERIAL_SH_SCI_NR_UARTS=1
+CONFIG_SERIAL_SH_SCI_NR_UARTS=2
 CONFIG_SERIAL_SH_SCI_CONSOLE=y
 CONFIG_SERIAL_SH_SCI_CONSOLE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CORE_CONSOLE=y

+ 3 - 2
arch/sh/drivers/pci/pci-sh7751.c

@@ -17,6 +17,7 @@
 #include <linux/io.h>
 #include <linux/io.h>
 #include "pci-sh4.h"
 #include "pci-sh4.h"
 #include <asm/addrspace.h>
 #include <asm/addrspace.h>
+#include <asm/sizes.h>
 
 
 static int __init __area_sdram_check(struct pci_channel *chan,
 static int __init __area_sdram_check(struct pci_channel *chan,
 				     unsigned int area)
 				     unsigned int area)
@@ -47,8 +48,8 @@ static int __init __area_sdram_check(struct pci_channel *chan,
 static struct resource sh7751_pci_resources[] = {
 static struct resource sh7751_pci_resources[] = {
 	{
 	{
 		.name	= "SH7751_IO",
 		.name	= "SH7751_IO",
-		.start	= SH7751_PCI_IO_BASE,
-		.end	= SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
+		.start	= 0x1000,
+		.end	= SZ_4M - 1,
 		.flags	= IORESOURCE_IO
 		.flags	= IORESOURCE_IO
 	}, {
 	}, {
 		.name	= "SH7751_mem",
 		.name	= "SH7751_mem",

+ 1 - 1
arch/sh/include/cpu-sh4/cpu/dma-register.h

@@ -76,7 +76,7 @@ enum {
 }
 }
 
 
 #define TS_INDEX2VAL(i)	((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
 #define TS_INDEX2VAL(i)	((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
-			 ((((i) >> 2) & 3) << CHCR_TS_HIGH_SHIFT))
+			 (((i) & 0xc) << CHCR_TS_HIGH_SHIFT))
 
 
 #else /* CONFIG_CPU_SH4A */
 #else /* CONFIG_CPU_SH4A */
 
 

+ 21 - 6
drivers/dma/shdma.c

@@ -290,6 +290,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
 	struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
 	struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
 	struct sh_desc *desc;
 	struct sh_desc *desc;
 	struct sh_dmae_slave *param = chan->private;
 	struct sh_dmae_slave *param = chan->private;
+	int ret;
 
 
 	pm_runtime_get_sync(sh_chan->dev);
 	pm_runtime_get_sync(sh_chan->dev);
 
 
@@ -301,11 +302,15 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
 		struct sh_dmae_slave_config *cfg;
 		struct sh_dmae_slave_config *cfg;
 
 
 		cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
 		cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
-		if (!cfg)
-			return -EINVAL;
+		if (!cfg) {
+			ret = -EINVAL;
+			goto efindslave;
+		}
 
 
-		if (test_and_set_bit(param->slave_id, sh_dmae_slave_used))
-			return -EBUSY;
+		if (test_and_set_bit(param->slave_id, sh_dmae_slave_used)) {
+			ret = -EBUSY;
+			goto etestused;
+		}
 
 
 		param->config = cfg;
 		param->config = cfg;
 
 
@@ -334,10 +339,20 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
 	}
 	}
 	spin_unlock_bh(&sh_chan->desc_lock);
 	spin_unlock_bh(&sh_chan->desc_lock);
 
 
-	if (!sh_chan->descs_allocated)
-		pm_runtime_put(sh_chan->dev);
+	if (!sh_chan->descs_allocated) {
+		ret = -ENOMEM;
+		goto edescalloc;
+	}
 
 
 	return sh_chan->descs_allocated;
 	return sh_chan->descs_allocated;
+
+edescalloc:
+	if (param)
+		clear_bit(param->slave_id, sh_dmae_slave_used);
+etestused:
+efindslave:
+	pm_runtime_put(sh_chan->dev);
+	return ret;
 }
 }
 
 
 /*
 /*

+ 13 - 14
drivers/video/sh_mobile_lcdcfb.c

@@ -695,6 +695,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
 	 * 1) Enable Runtime PM
 	 * 1) Enable Runtime PM
 	 * 2) Force Runtime PM Resume since hardware is accessed from probe()
 	 * 2) Force Runtime PM Resume since hardware is accessed from probe()
 	 */
 	 */
+	priv->dev = &pdev->dev;
 	pm_runtime_enable(priv->dev);
 	pm_runtime_enable(priv->dev);
 	pm_runtime_resume(priv->dev);
 	pm_runtime_resume(priv->dev);
 	return 0;
 	return 0;
@@ -957,25 +958,24 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
 
 
 	if (!pdev->dev.platform_data) {
 	if (!pdev->dev.platform_data) {
 		dev_err(&pdev->dev, "no platform data defined\n");
 		dev_err(&pdev->dev, "no platform data defined\n");
-		error = -EINVAL;
-		goto err0;
+		return -EINVAL;
 	}
 	}
 
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	i = platform_get_irq(pdev, 0);
 	i = platform_get_irq(pdev, 0);
 	if (!res || i < 0) {
 	if (!res || i < 0) {
 		dev_err(&pdev->dev, "cannot get platform resources\n");
 		dev_err(&pdev->dev, "cannot get platform resources\n");
-		error = -ENOENT;
-		goto err0;
+		return -ENOENT;
 	}
 	}
 
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv) {
 	if (!priv) {
 		dev_err(&pdev->dev, "cannot allocate device data\n");
 		dev_err(&pdev->dev, "cannot allocate device data\n");
-		error = -ENOMEM;
-		goto err0;
+		return -ENOMEM;
 	}
 	}
 
 
+	platform_set_drvdata(pdev, priv);
+
 	error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
 	error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
 			    dev_name(&pdev->dev), priv);
 			    dev_name(&pdev->dev), priv);
 	if (error) {
 	if (error) {
@@ -984,8 +984,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
 	}
 	}
 
 
 	priv->irq = i;
 	priv->irq = i;
-	priv->dev = &pdev->dev;
-	platform_set_drvdata(pdev, priv);
 	pdata = pdev->dev.platform_data;
 	pdata = pdev->dev.platform_data;
 
 
 	j = 0;
 	j = 0;
@@ -1099,9 +1097,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
 		info = ch->info;
 		info = ch->info;
 
 
 		if (info->fbdefio) {
 		if (info->fbdefio) {
-			priv->ch->sglist = vmalloc(sizeof(struct scatterlist) *
+			ch->sglist = vmalloc(sizeof(struct scatterlist) *
 					info->fix.smem_len >> PAGE_SHIFT);
 					info->fix.smem_len >> PAGE_SHIFT);
-			if (!priv->ch->sglist) {
+			if (!ch->sglist) {
 				dev_err(&pdev->dev, "cannot allocate sglist\n");
 				dev_err(&pdev->dev, "cannot allocate sglist\n");
 				goto err1;
 				goto err1;
 			}
 			}
@@ -1126,9 +1124,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
 	}
 	}
 
 
 	return 0;
 	return 0;
- err1:
+err1:
 	sh_mobile_lcdc_remove(pdev);
 	sh_mobile_lcdc_remove(pdev);
- err0:
+
 	return error;
 	return error;
 }
 }
 
 
@@ -1139,7 +1137,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
 	int i;
 	int i;
 
 
 	for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
 	for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
-		if (priv->ch[i].info->dev)
+		if (priv->ch[i].info && priv->ch[i].info->dev)
 			unregister_framebuffer(priv->ch[i].info);
 			unregister_framebuffer(priv->ch[i].info);
 
 
 	sh_mobile_lcdc_stop(priv);
 	sh_mobile_lcdc_stop(priv);
@@ -1162,7 +1160,8 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
 	if (priv->dot_clk)
 	if (priv->dot_clk)
 		clk_put(priv->dot_clk);
 		clk_put(priv->dot_clk);
 
 
-	pm_runtime_disable(priv->dev);
+	if (priv->dev)
+		pm_runtime_disable(priv->dev);
 
 
 	if (priv->base)
 	if (priv->base)
 		iounmap(priv->base);
 		iounmap(priv->base);