From 5826042d3c550522e49a8a55db64d9c47b43a8f9 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Sun, 20 Apr 2008 17:42:59 +0100 Subject: [ARM] 5011/1: htc-pasic3: fix bug in resource pipe-through to ds1wm The newly created DS1WM platform device should get a copy of the PASIC3 platform devices' resources. Signed-off-by: Philipp Zabel Signed-off-by: Russell King --- drivers/mfd/htc-pasic3.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c index af66f4f2830..cb4ab27a2ef 100644 --- a/drivers/mfd/htc-pasic3.c +++ b/drivers/mfd/htc-pasic3.c @@ -135,8 +135,9 @@ static struct ds1wm_platform_data ds1wm_pdata = { .disable = ds1wm_disable, }; -static int ds1wm_device_add(struct device *pasic3_dev, int bus_shift) +static int ds1wm_device_add(struct platform_device *pasic3_pdev, int bus_shift) { + struct device *pasic3_dev = &pasic3_pdev->dev; struct pasic3_data *asic = pasic3_dev->driver_data; struct platform_device *pdev; int ret; @@ -147,8 +148,8 @@ static int ds1wm_device_add(struct device *pasic3_dev, int bus_shift) return -ENOMEM; } - ret = platform_device_add_resources(pdev, pdev->resource, - pdev->num_resources); + ret = platform_device_add_resources(pdev, pasic3_pdev->resource, + pasic3_pdev->num_resources); if (ret < 0) { dev_dbg(pasic3_dev, "failed to add DS1WM resources\n"); goto exit_pdev_put; @@ -210,7 +211,7 @@ static int __init pasic3_probe(struct platform_device *pdev) return -ENOMEM; } - ret = ds1wm_device_add(dev, asic->bus_shift); + ret = ds1wm_device_add(pdev, asic->bus_shift); if (ret < 0) dev_warn(dev, "failed to register DS1WM\n"); -- cgit v1.2.3 From 26eed9a5c61edd93d88e147188d4feae6770174e Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sat, 26 Apr 2008 23:39:44 +0100 Subject: [ARM] 5022/1: Race in ARM MMCI PL18x driver, V2 Updated version of 4446/1. This also drops the suggested comparison of host_remain for == 0, since that doesn't make sense (still works for us, too). We have verified that this patch solve race problems on atleast 2 archs at high frequencies. (Verbatim copy of old patch text below.) The patch below fixes a race condition in the ARM MMCI PL18x driver. If new data arrives in the FIFO while existing data is being read then we get a second iteration of the loop in mmci_pio_read. However host->size is not updated until after mmci_pio_read returns, so we get count = number of new bytes PLUS number of bytes already copied in the first iteration. This results in a FIFO underrun as we try and read mode data than is available. The fix is to compensating for data read on previous iterations when calculating the amount of data in the FIFO. Signed-off-by: Linus Walleij Signed-off-by: Russell King --- drivers/mmc/host/mmci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 95244a7e735..626ac083f4e 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -213,9 +213,10 @@ static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int rema void __iomem *base = host->base; char *ptr = buffer; u32 status; + int host_remain = host->size; do { - int count = host->size - (readl(base + MMCIFIFOCNT) << 2); + int count = host_remain - (readl(base + MMCIFIFOCNT) << 2); if (count > remain) count = remain; @@ -227,6 +228,7 @@ static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int rema ptr += count; remain -= count; + host_remain -= count; if (remain == 0) break; -- cgit v1.2.3 From 62783679540fbdfd74e10fbe9478d978141ba45f Mon Sep 17 00:00:00 2001 From: Roel Kluin <12o3l@tiscali.nl> Date: Wed, 23 Apr 2008 23:44:03 +0200 Subject: [ARM] am79c961a: platform_get_irq() may return signed unnoticed dev->irq is unsigned, platform_get_irq() may return signed unnoticed Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: Russell King --- drivers/net/arm/am79c961a.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index ba6bd03a015..a637910b02d 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c @@ -693,11 +693,15 @@ static int __init am79c961_probe(struct platform_device *pdev) * done by the ether bootp loader. */ dev->base_addr = res->start; - dev->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); - ret = -ENODEV; - if (dev->irq < 0) + if (ret < 0) { + ret = -ENODEV; goto nodev; + } + dev->irq = ret; + + ret = -ENODEV; if (!request_region(dev->base_addr, 0x18, dev->name)) goto nodev; -- cgit v1.2.3 From 681587c58639444215a7c88f7471819997d2f226 Mon Sep 17 00:00:00 2001 From: Roel Kluin <12o3l@tiscali.nl> Date: Wed, 23 Apr 2008 23:59:36 +0200 Subject: [ARM] serial: s3c2410: platform_get_irq() may return signed unnoticed port->irq is unsigned, platform_get_irq() may return signed unnoticed Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Acked-by: Alan Cox Signed-off-by: Russell King --- drivers/serial/s3c2410.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 4ffa2585429..da5a02cb4f6 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c @@ -1022,6 +1022,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, struct uart_port *port = &ourport->port; struct s3c2410_uartcfg *cfg; struct resource *res; + int ret; dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev); @@ -1064,9 +1065,11 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, port->mapbase = res->start; port->membase = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART); - port->irq = platform_get_irq(platdev, 0); - if (port->irq < 0) + ret = platform_get_irq(platdev, 0); + if (ret < 0) port->irq = 0; + else + port->irq = ret; ourport->clk = clk_get(&platdev->dev, "uart"); -- cgit v1.2.3