From: Mark Brown Date: Wed, 5 Sep 2012 23:46:04 +0000 (+0800) Subject: Merge branches 'spi-drivers' and 'spi-mxs' into spi-next X-Git-Tag: next-20120910~35^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=58a798e818e158f2a4a8060550e5def08261e44c;p=karo-tx-linux.git Merge branches 'spi-drivers' and 'spi-mxs' into spi-next --- 58a798e818e158f2a4a8060550e5def08261e44c diff --cc drivers/spi/spi-pl022.c index b0fec030ba25,827ad5152d8b,aab518ec2bbc..e43b6109012f --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@@@ -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; @@@@ -2066,8 -2065,8 -2016,6 +2065,8 @@@@ 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