On Tue, Apr 01, 2008 at 04:27:38PM +0300, Dmitry wrote:How about we take the lock in tosakbd_suspend, set flag indicating that the picece is suspended, do the discharge and then del_timer_sync()? If you change tosakbd_scankeyboard() to check for suspend flag and exit as soon as it sees it it should take care of the most of the issues I think. Something like this: Subject: Input: tosakbd - fix suspend From: Dmitry Baryshkov <dbaryshkov@gmail.com> Input: tosakbd - fix suspend Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/input/keyboard/tosakbd.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) Index: linux/drivers/input/keyboard/tosakbd.c =================================================================== --- linux.orig/drivers/input/keyboard/tosakbd.c +++ linux/drivers/input/keyboard/tosakbd.c @@ -52,7 +52,7 @@ KEY_X, KEY_F, KEY_SPACE, KEY_APOSTROPHE, struct tosakbd { unsigned int keycode[ARRAY_SIZE(tosakbd_keycode)]; struct input_dev *input; - + int suspeneded; spinlock_t lock; /* protect kbd scanning */ struct timer_list timer; }; @@ -133,6 +133,9 @@ static void tosakbd_scankeyboard(struct spin_lock_irqsave(&tosakbd->lock, flags); + if (tosakbd->suspended) + goto out; + for (col = 0; col < TOSA_KEY_STROBE_NUM; col++) { /* * Discharge the output driver capacitatance @@ -174,6 +177,7 @@ static void tosakbd_scankeyboard(struct if (num_pressed) mod_timer(&tosakbd->timer, jiffies + SCAN_INTERVAL); + out: spin_unlock_irqrestore(&tosakbd->lock, flags); } @@ -200,6 +204,7 @@ static irqreturn_t tosakbd_interrupt(int static void tosakbd_timer_callback(unsigned long __dev) { struct platform_device *dev = (struct platform_device *)__dev; + tosakbd_scankeyboard(dev); } @@ -207,6 +212,13 @@ static void tosakbd_timer_callback(unsig static int tosakbd_suspend(struct platform_device *dev, pm_message_t state) { struct tosakbd *tosakbd = platform_get_drvdata(dev); + unsigned long flags; + + spin_lock_irqsave(&tosakbd->lock, flags); + PGSR1 = (PGSR1 & ~TOSA_GPIO_LOW_STROBE_BIT); + PGSR2 = (PGSR2 & ~TOSA_GPIO_HIGH_STROBE_BIT); + tosakbd->suspended = 1; + spin_unlock_irqrestore(&tosakbd->lock, flags); del_timer_sync(&tosakbd->timer); @@ -215,6 +227,7 @@ static int tosakbd_suspend(struct platfo static int tosakbd_resume(struct platform_device *dev) { + tosakbd->suspended = 0; tosakbd_scankeyboard(dev); return 0; @@ -365,8 +378,8 @@ fail: return error; } -static int __devexit tosakbd_remove(struct platform_device *dev) { - +static int __devexit tosakbd_remove(struct platform_device *dev) +{ int i; struct tosakbd *tosakbd = platform_get_drvdata(dev); -- Dmitry --
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Riki Oktarianto | [PATCH] Add quirk to set AHCI mode on ICH boards |
| Alex Chiang | [PATCH v5 00/16] PCI: let the core manage slot names |
git: | |
| Sam Song | Fwd: [OT] Re: Git via a proxy server? |
| Toby White | Using Filemerge.app as a git-diff viewer |
| Sam Vilain | [PATCH] git-mergetool: add support for ediff |
| Adrian Bunk | git-revert is a memory hog |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| Stephan A. Rickauer | Re: New tcp stack attack |
| Richard Stallman | Real men don't attack straw men |
| Ondřej Surý | openbgp not exporing ipv6 to routing tables |
| Michael Chan | [PATCH net-next 2/6] bnx2: Check netif_running() in all ethtool operations. |
| Herbert Xu | Re: xfrm_state locking regression... |
| adobriyan | [PATCH 10/38] netns ct: per-netns expectations |
| Dale Farnsworth | Re: [PATCH 01/39] mv643xx_eth: reverse topological sort of functions |
| How to make my PCIE ATA storage device running in Linux | 7 hours ago | Linux general |
| sata/ide timeout errors on asus server-mb | 11 hours ago | Linux kernel |
| Shared swap partition | 11 hours ago | Linux general |
| usb mic not detected | 15 hours ago | Applications and Utilities |
| Problem in Inserting a module | 16 hours ago | Linux kernel |
| Treason Uncloaked | 22 hours ago | Linux kernel |
| high memory | 3 days ago | Linux kernel |
| semaphore access speed | 3 days ago | Applications and Utilities |
| the kernel how to power off the machine | 3 days ago | Linux kernel |
| Easter Eggs in windows XP | 3 days ago | Windows |
