diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-04-30 12:57:55 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-04-30 12:57:55 -0400 |
| commit | 8f2adb7cab81fc4984ddfe3a1efd1b62d52bead8 (patch) | |
| tree | 75f48007900d3386cfaa0e9d5ad460f6c51f1635 | |
| parent | 66f41d4c5c8a5deed66fdcc84509376c9a0bf9d8 (diff) | |
| parent | 95b1ed2ac7ffe3205afc6f5a20320fbdb984da92 (diff) | |
Merge branch 'merge' of git://git.secretlab.ca/git/linux-2.6
* 'merge' of git://git.secretlab.ca/git/linux-2.6:
spi: spidev_test gives error upon 1-byte transfer
omap2_mcspi: small fixes of output data format
omap2_mcspi: Flush posted writes
spi: spi_device memory should be released instead of device.
spi: release device claimed by bus_find_device_by_name
of: check for IS_ERR()
serial/mpc52xx_uart: Drop outdated comments
gpio: potential null dereference
| -rw-r--r-- | Documentation/spi/spidev_test.c | 2 | ||||
| -rw-r--r-- | drivers/gpio/gpiolib.c | 3 | ||||
| -rw-r--r-- | drivers/of/of_mdio.c | 2 | ||||
| -rw-r--r-- | drivers/serial/mpc52xx_uart.c | 33 | ||||
| -rw-r--r-- | drivers/spi/omap2_mcspi.c | 5 | ||||
| -rw-r--r-- | drivers/spi/spi.c | 8 |
6 files changed, 12 insertions, 41 deletions
diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c index 10abd3773e49..16feda901469 100644 --- a/Documentation/spi/spidev_test.c +++ b/Documentation/spi/spidev_test.c | |||
| @@ -58,7 +58,7 @@ static void transfer(int fd) | |||
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); | 60 | ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); |
| 61 | if (ret == 1) | 61 | if (ret < 1) |
| 62 | pabort("can't send spi message"); | 62 | pabort("can't send spi message"); |
| 63 | 63 | ||
| 64 | for (ret = 0; ret < ARRAY_SIZE(tx); ret++) { | 64 | for (ret = 0; ret < ARRAY_SIZE(tx); ret++) { |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 76be229c814d..eb0c3fe44b29 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -416,7 +416,8 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev, | |||
| 416 | return 0; | 416 | return 0; |
| 417 | 417 | ||
| 418 | free_sd: | 418 | free_sd: |
| 419 | sysfs_put(pdesc->value_sd); | 419 | if (pdesc) |
| 420 | sysfs_put(pdesc->value_sd); | ||
| 420 | free_id: | 421 | free_id: |
| 421 | idr_remove(&pdesc_idr, id); | 422 | idr_remove(&pdesc_idr, id); |
| 422 | desc->flags &= GPIO_FLAGS_MASK; | 423 | desc->flags &= GPIO_FLAGS_MASK; |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 18ecae4a4375..b4748337223b 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
| @@ -69,7 +69,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | phy = get_phy_device(mdio, be32_to_cpup(addr)); | 71 | phy = get_phy_device(mdio, be32_to_cpup(addr)); |
| 72 | if (!phy) { | 72 | if (!phy || IS_ERR(phy)) { |
| 73 | dev_err(&mdio->dev, "error probing PHY at address %i\n", | 73 | dev_err(&mdio->dev, "error probing PHY at address %i\n", |
| 74 | *addr); | 74 | *addr); |
| 75 | continue; | 75 | continue; |
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 3119fddaedb5..a176ab4bd65b 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
| @@ -29,39 +29,6 @@ | |||
| 29 | * kind, whether express or implied. | 29 | * kind, whether express or implied. |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | /* Platform device Usage : | ||
| 33 | * | ||
| 34 | * Since PSCs can have multiple function, the correct driver for each one | ||
| 35 | * is selected by calling mpc52xx_match_psc_function(...). The function | ||
| 36 | * handled by this driver is "uart". | ||
| 37 | * | ||
| 38 | * The driver init all necessary registers to place the PSC in uart mode without | ||
| 39 | * DCD. However, the pin multiplexing aren't changed and should be set either | ||
| 40 | * by the bootloader or in the platform init code. | ||
| 41 | * | ||
| 42 | * The idx field must be equal to the PSC index (e.g. 0 for PSC1, 1 for PSC2, | ||
| 43 | * and so on). So the PSC1 is mapped to /dev/ttyPSC0, PSC2 to /dev/ttyPSC1 and | ||
| 44 | * so on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly | ||
| 45 | * fpr the console code : without this 1:1 mapping, at early boot time, when we | ||
| 46 | * are parsing the kernel args console=ttyPSC?, we wouldn't know which PSC it | ||
| 47 | * will be mapped to. | ||
| 48 | */ | ||
| 49 | |||
| 50 | /* OF Platform device Usage : | ||
| 51 | * | ||
| 52 | * This driver is only used for PSCs configured in uart mode. The device | ||
| 53 | * tree will have a node for each PSC with "mpc52xx-psc-uart" in the compatible | ||
| 54 | * list. | ||
| 55 | * | ||
| 56 | * By default, PSC devices are enumerated in the order they are found. However | ||
| 57 | * a particular PSC number can be forces by adding 'device_no = <port#>' | ||
| 58 | * to the device node. | ||
| 59 | * | ||
| 60 | * The driver init all necessary registers to place the PSC in uart mode without | ||
| 61 | * DCD. However, the pin multiplexing aren't changed and should be set either | ||
| 62 | * by the bootloader or in the platform init code. | ||
| 63 | */ | ||
| 64 | |||
| 65 | #undef DEBUG | 32 | #undef DEBUG |
| 66 | 33 | ||
| 67 | #include <linux/device.h> | 34 | #include <linux/device.h> |
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index d8356af118a8..e0de0d0eedea 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
| @@ -204,6 +204,7 @@ static inline void mcspi_write_chconf0(const struct spi_device *spi, u32 val) | |||
| 204 | 204 | ||
| 205 | cs->chconf0 = val; | 205 | cs->chconf0 = val; |
| 206 | mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val); | 206 | mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val); |
| 207 | mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCONF0); | ||
| 207 | } | 208 | } |
| 208 | 209 | ||
| 209 | static void omap2_mcspi_set_dma_req(const struct spi_device *spi, | 210 | static void omap2_mcspi_set_dma_req(const struct spi_device *spi, |
| @@ -532,7 +533,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | |||
| 532 | goto out; | 533 | goto out; |
| 533 | } | 534 | } |
| 534 | #ifdef VERBOSE | 535 | #ifdef VERBOSE |
| 535 | dev_dbg(&spi->dev, "write-%d %04x\n", | 536 | dev_dbg(&spi->dev, "write-%d %08x\n", |
| 536 | word_len, *tx); | 537 | word_len, *tx); |
| 537 | #endif | 538 | #endif |
| 538 | __raw_writel(*tx++, tx_reg); | 539 | __raw_writel(*tx++, tx_reg); |
| @@ -550,7 +551,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) | |||
| 550 | mcspi_write_chconf0(spi, l); | 551 | mcspi_write_chconf0(spi, l); |
| 551 | *rx++ = __raw_readl(rx_reg); | 552 | *rx++ = __raw_readl(rx_reg); |
| 552 | #ifdef VERBOSE | 553 | #ifdef VERBOSE |
| 553 | dev_dbg(&spi->dev, "read-%d %04x\n", | 554 | dev_dbg(&spi->dev, "read-%d %08x\n", |
| 554 | word_len, *(rx - 1)); | 555 | word_len, *(rx - 1)); |
| 555 | #endif | 556 | #endif |
| 556 | } | 557 | } |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9ffb0fdbd6fe..b3a1f9259b62 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -41,7 +41,7 @@ static void spidev_release(struct device *dev) | |||
| 41 | spi->master->cleanup(spi); | 41 | spi->master->cleanup(spi); |
| 42 | 42 | ||
| 43 | spi_master_put(spi->master); | 43 | spi_master_put(spi->master); |
| 44 | kfree(dev); | 44 | kfree(spi); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static ssize_t | 47 | static ssize_t |
| @@ -257,6 +257,7 @@ int spi_add_device(struct spi_device *spi) | |||
| 257 | { | 257 | { |
| 258 | static DEFINE_MUTEX(spi_add_lock); | 258 | static DEFINE_MUTEX(spi_add_lock); |
| 259 | struct device *dev = spi->master->dev.parent; | 259 | struct device *dev = spi->master->dev.parent; |
| 260 | struct device *d; | ||
| 260 | int status; | 261 | int status; |
| 261 | 262 | ||
| 262 | /* Chipselects are numbered 0..max; validate. */ | 263 | /* Chipselects are numbered 0..max; validate. */ |
| @@ -278,10 +279,11 @@ int spi_add_device(struct spi_device *spi) | |||
| 278 | */ | 279 | */ |
| 279 | mutex_lock(&spi_add_lock); | 280 | mutex_lock(&spi_add_lock); |
| 280 | 281 | ||
| 281 | if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)) | 282 | d = bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)); |
| 282 | != NULL) { | 283 | if (d != NULL) { |
| 283 | dev_err(dev, "chipselect %d already in use\n", | 284 | dev_err(dev, "chipselect %d already in use\n", |
| 284 | spi->chip_select); | 285 | spi->chip_select); |
| 286 | put_device(d); | ||
| 285 | status = -EBUSY; | 287 | status = -EBUSY; |
| 286 | goto done; | 288 | goto done; |
| 287 | } | 289 | } |
