aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/ads7846.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r--drivers/input/touchscreen/ads7846.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index c741776ef3bf..dd8c6a9ffc76 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -155,10 +155,13 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
155 struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL); 155 struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL);
156 int status; 156 int status;
157 int sample; 157 int sample;
158 int i;
158 159
159 if (!req) 160 if (!req)
160 return -ENOMEM; 161 return -ENOMEM;
161 162
163 INIT_LIST_HEAD(&req->msg.transfers);
164
162 /* activate reference, so it has time to settle; */ 165 /* activate reference, so it has time to settle; */
163 req->xfer[0].tx_buf = &ref_on; 166 req->xfer[0].tx_buf = &ref_on;
164 req->xfer[0].len = 1; 167 req->xfer[0].len = 1;
@@ -192,8 +195,8 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
192 /* group all the transfers together, so we can't interfere with 195 /* group all the transfers together, so we can't interfere with
193 * reading touchscreen state; disable penirq while sampling 196 * reading touchscreen state; disable penirq while sampling
194 */ 197 */
195 req->msg.transfers = req->xfer; 198 for (i = 0; i < 6; i++)
196 req->msg.n_transfer = 6; 199 spi_message_add_tail(&req->xfer[i], &req->msg);
197 200
198 disable_irq(spi->irq); 201 disable_irq(spi->irq);
199 status = spi_sync(spi, &req->msg); 202 status = spi_sync(spi, &req->msg);
@@ -398,6 +401,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
398 struct ads7846 *ts; 401 struct ads7846 *ts;
399 struct ads7846_platform_data *pdata = spi->dev.platform_data; 402 struct ads7846_platform_data *pdata = spi->dev.platform_data;
400 struct spi_transfer *x; 403 struct spi_transfer *x;
404 int i;
401 405
402 if (!spi->irq) { 406 if (!spi->irq) {
403 dev_dbg(&spi->dev, "no IRQ?\n"); 407 dev_dbg(&spi->dev, "no IRQ?\n");
@@ -500,8 +504,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
500 504
501 CS_CHANGE(x[-1]); 505 CS_CHANGE(x[-1]);
502 506
503 ts->msg.transfers = ts->xfer; 507 for (i = 0; i < x - ts->xfer; i++)
504 ts->msg.n_transfer = x - ts->xfer; 508 spi_message_add_tail(&ts->xfer[i], &ts->msg);
505 ts->msg.complete = ads7846_rx; 509 ts->msg.complete = ads7846_rx;
506 ts->msg.context = ts; 510 ts->msg.context = ts;
507 511