USB: cdc_acm: Fix memory leak after hangup
[safe/jmp/linux-2.6] / drivers / spi / omap_uwire.c
index 394b616..e75ba9b 100644 (file)
@@ -213,7 +213,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
        unsigned        bits = ust->bits_per_word;
        unsigned        bytes;
        u16             val, w;
-       int             status = 0;;
+       int             status = 0;
 
        if (!t->tx_buf && !t->rx_buf)
                return 0;
@@ -245,7 +245,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
 
 #ifdef VERBOSE
                        pr_debug("%s: write-%d =%04x\n",
-                                       spi->dev.bus_id, bits, val);
+                                       dev_name(&spi->dev), bits, val);
 #endif
                        if (wait_uwire_csr_flag(CSRB, 0, 0))
                                goto eio;
@@ -305,7 +305,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
                        status += bytes;
 #ifdef VERBOSE
                        pr_debug("%s: read-%d =%04x\n",
-                                       spi->dev.bus_id, bits, val);
+                                       dev_name(&spi->dev), bits, val);
 #endif
 
                }
@@ -331,7 +331,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
        uwire = spi_master_get_devdata(spi->master);
 
        if (spi->chip_select > 3) {
-               pr_debug("%s: cs%d?\n", spi->dev.bus_id, spi->chip_select);
+               pr_debug("%s: cs%d?\n", dev_name(&spi->dev), spi->chip_select);
                status = -ENODEV;
                goto done;
        }
@@ -339,11 +339,9 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
        bits = spi->bits_per_word;
        if (t != NULL && t->bits_per_word)
                bits = t->bits_per_word;
-       if (!bits)
-               bits = 8;
 
        if (bits > 16) {
-               pr_debug("%s: wordsize %d?\n", spi->dev.bus_id, bits);
+               pr_debug("%s: wordsize %d?\n", dev_name(&spi->dev), bits);
                status = -ENODEV;
                goto done;
        }
@@ -378,7 +376,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
                hz = t->speed_hz;
 
        if (!hz) {
-               pr_debug("%s: zero speed?\n", spi->dev.bus_id);
+               pr_debug("%s: zero speed?\n", dev_name(&spi->dev));
                status = -EINVAL;
                goto done;
        }
@@ -406,7 +404,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
        }
        if (div1_idx == 4) {
                pr_debug("%s: lowest clock %ld, need %d\n",
-                       spi->dev.bus_id, rate / 10 / 8, hz);
+                       dev_name(&spi->dev), rate / 10 / 8, hz);
                status = -EDOM;
                goto done;
        }
@@ -449,19 +447,10 @@ done:
        return status;
 }
 
-/* the spi->mode bits understood by this driver: */
-#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
-
 static int uwire_setup(struct spi_device *spi)
 {
        struct uwire_state *ust = spi->controller_state;
 
-       if (spi->mode & ~MODEBITS) {
-               dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
-                       spi->mode & ~MODEBITS);
-               return -EINVAL;
-       }
-
        if (ust == NULL) {
                ust = kzalloc(sizeof(*ust), GFP_KERNEL);
                if (ust == NULL)
@@ -522,6 +511,11 @@ static int __init uwire_probe(struct platform_device *pdev)
 
        uwire_write_reg(UWIRE_SR3, 1);
 
+       /* the spi->mode bits understood by this driver: */
+       master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
+
+       master->flags = SPI_MASTER_HALF_DUPLEX;
+
        master->bus_num = 2;    /* "official" */
        master->num_chipselect = 4;
        master->setup = uwire_setup;