diff options
author | Vitaly Wool <vwool@ru.mvista.com> | 2006-01-08 16:34:28 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-13 19:29:56 -0500 |
commit | 8275c642ccdce09a2146d0a9eb022e3698ee927e (patch) | |
tree | ea330810f665fcbdf36d31b0da1643db528ad83f /drivers/input/touchscreen/ads7846.c | |
parent | 2f9f762879015d738a5ec2ac8a16be94b3a4a06d (diff) |
[PATCH] spi: use linked lists rather than an array
This makes the SPI core and its users access transfers in the SPI message
structure as linked list not as an array, as discussed on LKML.
From: David Brownell <dbrownell@users.sourceforge.net>
Updates including doc, bugfixes to the list code, add
spi_message_add_tail(). Plus, initialize things _before_ grabbing the
locks in some cases (in case it grows more expensive). This also merges
some bitbang updates of mine that didn't yet make it into the mm tree.
Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: Dmitry Pervushin <dpervushin@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 12 |
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 | ||