From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: david-b@pacbell.net
Subject: [PATCH] spi: ads7836 uses spi_driver
Date: Fri, 13 Jan 2006 16:46:32 -0800 [thread overview]
Message-ID: <11371995921674@kroah.com> (raw)
In-Reply-To: <1137199592832@kroah.com>
[PATCH] spi: ads7836 uses spi_driver
This updates the ads7864 driver to use the new "spi_driver" struct, and
includes some minor unrelated cleanup.
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>
---
commit 2e5a7bd978bf4118a0c8edf2e6ff81d0a72fee47
tree ee5b09d090c7a4a6cbf19ddf9f252d315b46eda1
parent 0c868461fcb8413cb9f691d68e5b99b0fd3c0737
author David Brownell <david-b@pacbell.net> Sun, 08 Jan 2006 13:34:25 -0800
committer Greg Kroah-Hartman <gregkh@suse.de> Fri, 13 Jan 2006 16:29:55 -0800
drivers/input/touchscreen/ads7846.c | 84 ++++++++++++++++++-----------------
include/linux/spi/ads7846.h | 2 -
2 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 24ff6c5..c741776 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -345,19 +345,15 @@ static irqreturn_t ads7846_irq(int irq,
/*--------------------------------------------------------------------------*/
-/* non-empty "extra" is needed before 2.6.14-git5 or so */
-#define EXTRA // , u32 level
-#define EXTRA2 // , 0
-
static int
-ads7846_suspend(struct device *dev, pm_message_t message EXTRA)
+ads7846_suspend(struct spi_device *spi, pm_message_t message)
{
- struct ads7846 *ts = dev_get_drvdata(dev);
+ struct ads7846 *ts = dev_get_drvdata(&spi->dev);
unsigned long flags;
spin_lock_irqsave(&ts->lock, flags);
- ts->spi->dev.power.power_state = message;
+ spi->dev.power.power_state = message;
/* are we waiting for IRQ, or polling? */
if (!ts->pendown) {
@@ -387,36 +383,35 @@ ads7846_suspend(struct device *dev, pm_m
return 0;
}
-static int ads7846_resume(struct device *dev EXTRA)
+static int ads7846_resume(struct spi_device *spi)
{
- struct ads7846 *ts = dev_get_drvdata(dev);
+ struct ads7846 *ts = dev_get_drvdata(&spi->dev);
ts->irq_disabled = 0;
enable_irq(ts->spi->irq);
- dev->power.power_state = PMSG_ON;
+ spi->dev.power.power_state = PMSG_ON;
return 0;
}
-static int __init ads7846_probe(struct device *dev)
+static int __devinit ads7846_probe(struct spi_device *spi)
{
- struct spi_device *spi = to_spi_device(dev);
struct ads7846 *ts;
- struct ads7846_platform_data *pdata = dev->platform_data;
+ struct ads7846_platform_data *pdata = spi->dev.platform_data;
struct spi_transfer *x;
if (!spi->irq) {
- dev_dbg(dev, "no IRQ?\n");
+ dev_dbg(&spi->dev, "no IRQ?\n");
return -ENODEV;
}
if (!pdata) {
- dev_dbg(dev, "no platform data?\n");
+ dev_dbg(&spi->dev, "no platform data?\n");
return -ENODEV;
}
/* don't exceed max specified sample rate */
if (spi->max_speed_hz > (125000 * 16)) {
- dev_dbg(dev, "f(sample) %d KHz?\n",
+ dev_dbg(&spi->dev, "f(sample) %d KHz?\n",
(spi->max_speed_hz/16)/1000);
return -EINVAL;
}
@@ -430,7 +425,7 @@ static int __init ads7846_probe(struct d
if (!(ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL)))
return -ENOMEM;
- dev_set_drvdata(dev, ts);
+ dev_set_drvdata(&spi->dev, ts);
ts->spi = spi;
spi->dev.power.power_state = PMSG_ON;
@@ -445,9 +440,9 @@ static int __init ads7846_probe(struct d
init_input_dev(&ts->input);
- ts->input.dev = dev;
+ ts->input.dev = &spi->dev;
ts->input.name = "ADS784x Touchscreen";
- snprintf(ts->phys, sizeof ts->phys, "%s/input0", dev->bus_id);
+ snprintf(ts->phys, sizeof ts->phys, "%s/input0", spi->dev.bus_id);
ts->input.phys = ts->phys;
ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
@@ -511,65 +506,68 @@ static int __init ads7846_probe(struct d
ts->msg.context = ts;
if (request_irq(spi->irq, ads7846_irq, SA_SAMPLE_RANDOM,
- dev->bus_id, ts)) {
- dev_dbg(dev, "irq %d busy?\n", spi->irq);
+ spi->dev.bus_id, ts)) {
+ dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
input_unregister_device(&ts->input);
kfree(ts);
return -EBUSY;
}
set_irq_type(spi->irq, IRQT_FALLING);
- dev_info(dev, "touchscreen, irq %d\n", spi->irq);
+ dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq);
/* take a first sample, leaving nPENIRQ active; avoid
* the touchscreen, in case it's not connected.
*/
- (void) ads7846_read12_ser(dev,
+ (void) ads7846_read12_ser(&spi->dev,
READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON);
/* ads7843/7845 don't have temperature sensors, and
* use the other sensors a bit differently too
*/
if (ts->model == 7846) {
- device_create_file(dev, &dev_attr_temp0);
- device_create_file(dev, &dev_attr_temp1);
+ device_create_file(&spi->dev, &dev_attr_temp0);
+ device_create_file(&spi->dev, &dev_attr_temp1);
}
if (ts->model != 7845)
- device_create_file(dev, &dev_attr_vbatt);
- device_create_file(dev, &dev_attr_vaux);
+ device_create_file(&spi->dev, &dev_attr_vbatt);
+ device_create_file(&spi->dev, &dev_attr_vaux);
return 0;
}
-static int __exit ads7846_remove(struct device *dev)
+static int __devexit ads7846_remove(struct spi_device *spi)
{
- struct ads7846 *ts = dev_get_drvdata(dev);
+ struct ads7846 *ts = dev_get_drvdata(&spi->dev);
- ads7846_suspend(dev, PMSG_SUSPEND EXTRA2);
+ ads7846_suspend(spi, PMSG_SUSPEND);
free_irq(ts->spi->irq, ts);
if (ts->irq_disabled)
enable_irq(ts->spi->irq);
if (ts->model == 7846) {
- device_remove_file(dev, &dev_attr_temp0);
- device_remove_file(dev, &dev_attr_temp1);
+ device_remove_file(&spi->dev, &dev_attr_temp0);
+ device_remove_file(&spi->dev, &dev_attr_temp1);
}
if (ts->model != 7845)
- device_remove_file(dev, &dev_attr_vbatt);
- device_remove_file(dev, &dev_attr_vaux);
+ device_remove_file(&spi->dev, &dev_attr_vbatt);
+ device_remove_file(&spi->dev, &dev_attr_vaux);
input_unregister_device(&ts->input);
kfree(ts);
- dev_dbg(dev, "unregistered touchscreen\n");
+ dev_dbg(&spi->dev, "unregistered touchscreen\n");
return 0;
}
-static struct device_driver ads7846_driver = {
- .name = "ads7846",
- .bus = &spi_bus_type,
+static struct spi_driver ads7846_driver = {
+ .driver = {
+ .name = "ads7846",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
.probe = ads7846_probe,
- .remove = __exit_p(ads7846_remove),
+ .remove = __devexit_p(ads7846_remove),
.suspend = ads7846_suspend,
.resume = ads7846_resume,
};
@@ -594,18 +592,20 @@ static int __init ads7846_init(void)
// PXA:
// also Dell Axim X50
// also HP iPaq H191x/H192x/H415x/H435x
- // also Intel Lubbock (alternate to UCB1400)
+ // also Intel Lubbock (additional to UCB1400; as temperature sensor)
// also Sharp Zaurus C7xx, C8xx (corgi/sheperd/husky)
+ // Atmel at91sam9261-EK uses ads7843
+
// also various AMD Au1x00 devel boards
- return driver_register(&ads7846_driver);
+ return spi_register_driver(&ads7846_driver);
}
module_init(ads7846_init);
static void __exit ads7846_exit(void)
{
- driver_unregister(&ads7846_driver);
+ spi_unregister_driver(&ads7846_driver);
#ifdef CONFIG_ARCH_OMAP
if (machine_is_omap_osk()) {
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 84a2701..72261e0 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -1,7 +1,7 @@
/* linux/spi/ads7846.h */
/* Touchscreen characteristics vary between boards and models. The
- * platform_data for the device's "struct device" holts this information.
+ * platform_data for the device's "struct device" holds this information.
*
* It's OK if the min/max values are zero.
*/
next prev parent reply other threads:[~2006-01-14 21:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-14 0:44 [GIT PATCH] SPI patches for 2.6.15 Greg KH
2006-01-14 0:46 ` [PATCH] spi: mtd dataflash driver Greg KH
2006-01-14 0:46 ` [PATCH] spi: simple SPI framework Greg KH
2006-01-14 0:46 ` [PATCH] spi: add spi_driver to " Greg KH
2006-01-14 0:46 ` [PATCH] spi: ads7846 driver Greg KH
2006-01-14 0:46 ` [PATCH] SPI core tweaks, bugfix Greg KH
2006-01-14 0:46 ` Greg KH [this message]
2006-01-14 0:46 ` [PATCH] spi: M25 series SPI flash Greg KH
2006-01-14 0:46 ` [PATCH] spi: add spi_bitbang driver Greg KH
2006-01-14 0:46 ` [PATCH] SPI: add spi_butterfly driver Greg KH
2006-01-14 0:46 ` [PATCH] spi: remove fastcall crap Greg KH
2006-01-14 0:46 ` [PATCH] spi: misc fixes Greg KH
2006-01-14 0:46 ` [PATCH] spi: use linked lists rather than an array Greg KH
2006-01-14 4:48 ` [GIT PATCH] SPI patches for 2.6.15 Kalin KOZHUHAROV
2006-01-14 11:20 ` Kay Sievers
2006-01-14 23:56 ` Kalin KOZHUHAROV
[not found] ` <fa.fl6o99l.132m0gn@ifi.uio.no>
2006-01-15 14:27 ` Kai Henningsen
2006-01-16 2:30 ` Kalin KOZHUHAROV
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11371995921674@kroah.com \
--to=gregkh@suse.de \
--cc=david-b@pacbell.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.