]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branches 'spi-drivers' and 'spi-mxs' into spi-next
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 5 Sep 2012 23:46:04 +0000 (07:46 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 5 Sep 2012 23:46:04 +0000 (07:46 +0800)
1  2  3 
drivers/spi/spi-pl022.c

index b0fec030ba254ae3b64ac9f112e102b2dc8660b4,827ad5152d8b9fc53b6bc2226851f375325c0107,aab518ec2bbc234c983be65ec84372740c1e5344..e43b6109012f9bbf6cd185dc3ec3cb56d38d19e5
@@@@ -2042,19 -2042,18 -2003,8 +2042,18 @@@@ pl022_probe(struct amba_device *adev, c
                goto err_no_pdata;
        }
   
  +     if (platform_info->num_chipselect) {
  +             num_cs = platform_info->num_chipselect;
  +     } else if (IS_ENABLED(CONFIG_OF)) {
  +             of_property_read_u32(np, "num-cs", &num_cs);
  +     } else {
  +             dev_err(&adev->dev, "probe: no chip select defined\n");
  +             status = -ENODEV;
  +             goto err_no_pdata;
  +     }
  +
        /* Allocate master with space for data */
-       master = spi_alloc_master(dev, sizeof(struct pl022) + sizeof(int) *
-                                 num_cs);
+       master = spi_alloc_master(dev, sizeof(struct pl022));
        if (master == NULL) {
                dev_err(&adev->dev, "probe - cannot alloc SPI master\n");
                status = -ENOMEM;
        pl022->master_info = platform_info;
        pl022->adev = adev;
        pl022->vendor = id->data;
-       /* Point chipselects to allocated memory beyond the main struct */
-       pl022->chipselects = (int *) pl022 + sizeof(struct pl022);
+ +     pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int),
+ +                                       GFP_KERNEL);
   
        /*
         * Bus Number Which has been Assigned to this SSP controller