Skip to content

Commit

Permalink
Merge branch 'merge' of git://git.secretlab.ca/git/linux-2.6
Browse files Browse the repository at this point in the history
* '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
  • Loading branch information
torvalds committed Apr 30, 2010
2 parents 66f41d4 + 95b1ed2 commit 8f2adb7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Documentation/spi/spidev_test.c
Expand Up @@ -58,7 +58,7 @@ static void transfer(int fd)
};

ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
if (ret == 1)
if (ret < 1)
pabort("can't send spi message");

for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpiolib.c
Expand Up @@ -416,7 +416,8 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
return 0;

free_sd:
sysfs_put(pdesc->value_sd);
if (pdesc)
sysfs_put(pdesc->value_sd);
free_id:
idr_remove(&pdesc_idr, id);
desc->flags &= GPIO_FLAGS_MASK;
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/of_mdio.c
Expand Up @@ -69,7 +69,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
}

phy = get_phy_device(mdio, be32_to_cpup(addr));
if (!phy) {
if (!phy || IS_ERR(phy)) {
dev_err(&mdio->dev, "error probing PHY at address %i\n",
*addr);
continue;
Expand Down
33 changes: 0 additions & 33 deletions drivers/serial/mpc52xx_uart.c
Expand Up @@ -29,39 +29,6 @@
* kind, whether express or implied.
*/

/* Platform device Usage :
*
* Since PSCs can have multiple function, the correct driver for each one
* is selected by calling mpc52xx_match_psc_function(...). The function
* handled by this driver is "uart".
*
* The driver init all necessary registers to place the PSC in uart mode without
* DCD. However, the pin multiplexing aren't changed and should be set either
* by the bootloader or in the platform init code.
*
* The idx field must be equal to the PSC index (e.g. 0 for PSC1, 1 for PSC2,
* and so on). So the PSC1 is mapped to /dev/ttyPSC0, PSC2 to /dev/ttyPSC1 and
* so on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly
* fpr the console code : without this 1:1 mapping, at early boot time, when we
* are parsing the kernel args console=ttyPSC?, we wouldn't know which PSC it
* will be mapped to.
*/

/* OF Platform device Usage :
*
* This driver is only used for PSCs configured in uart mode. The device
* tree will have a node for each PSC with "mpc52xx-psc-uart" in the compatible
* list.
*
* By default, PSC devices are enumerated in the order they are found. However
* a particular PSC number can be forces by adding 'device_no = <port#>'
* to the device node.
*
* The driver init all necessary registers to place the PSC in uart mode without
* DCD. However, the pin multiplexing aren't changed and should be set either
* by the bootloader or in the platform init code.
*/

#undef DEBUG

#include <linux/device.h>
Expand Down
5 changes: 3 additions & 2 deletions drivers/spi/omap2_mcspi.c
Expand Up @@ -204,6 +204,7 @@ static inline void mcspi_write_chconf0(const struct spi_device *spi, u32 val)

cs->chconf0 = val;
mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val);
mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCONF0);
}

static void omap2_mcspi_set_dma_req(const struct spi_device *spi,
Expand Down Expand Up @@ -532,7 +533,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
goto out;
}
#ifdef VERBOSE
dev_dbg(&spi->dev, "write-%d %04x\n",
dev_dbg(&spi->dev, "write-%d %08x\n",
word_len, *tx);
#endif
__raw_writel(*tx++, tx_reg);
Expand All @@ -550,7 +551,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
mcspi_write_chconf0(spi, l);
*rx++ = __raw_readl(rx_reg);
#ifdef VERBOSE
dev_dbg(&spi->dev, "read-%d %04x\n",
dev_dbg(&spi->dev, "read-%d %08x\n",
word_len, *(rx - 1));
#endif
}
Expand Down
8 changes: 5 additions & 3 deletions drivers/spi/spi.c
Expand Up @@ -41,7 +41,7 @@ static void spidev_release(struct device *dev)
spi->master->cleanup(spi);

spi_master_put(spi->master);
kfree(dev);
kfree(spi);
}

static ssize_t
Expand Down Expand Up @@ -257,6 +257,7 @@ int spi_add_device(struct spi_device *spi)
{
static DEFINE_MUTEX(spi_add_lock);
struct device *dev = spi->master->dev.parent;
struct device *d;
int status;

/* Chipselects are numbered 0..max; validate. */
Expand All @@ -278,10 +279,11 @@ int spi_add_device(struct spi_device *spi)
*/
mutex_lock(&spi_add_lock);

if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev))
!= NULL) {
d = bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev));
if (d != NULL) {
dev_err(dev, "chipselect %d already in use\n",
spi->chip_select);
put_device(d);
status = -EBUSY;
goto done;
}
Expand Down

0 comments on commit 8f2adb7

Please sign in to comment.