From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans-Christian Egtvedt Subject: Re: [PATCH 1/1] gpio_mouse driver Date: Wed, 30 May 2007 10:00:33 +0200 Message-ID: <1180512033.32245.63.camel@localhost.localdomain> References: <1180444046354-git-send-email-hcegtvedt@norway.atmel.com> <1180506198.32245.59.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1180506198.32245.59.camel@localhost.localdomain> Sender: owner-linux-input@atrey.karlin.mff.cuni.cz List-Help: List-Owner: List-Post: List-Unsubscribe: To: Dmitry Torokhov Cc: linux-input@atrey.karlin.mff.cuni.cz List-Id: linux-input@vger.kernel.org On Wed, 2007-05-30 at 08:23 +0200, Hans-Christian Egtvedt wrote: > On Tue, 2007-05-29 at 11:36 -0400, Dmitry Torokhov wrote: > > I don't think it is a good idea to have timer structure in platform > > data which should really be constant. Timer shoudl be part of the > > stucture created when driver binds to a device. I can see you may not > > want to introduce extra complexity in the driver; however if you use > > input-polldev it will handle timer for you. > > I was a bit unsure about this before submitting. I have moved the > timer_list into a struct in the driver and added the usual > kmalloc/kfree. Oops, this introduced a bug when calling add_timer, since kmalloc does not zero the memory. The fix is: > + input->open = gpio_mouse_open; > + input->close = gpio_mouse_close; > + > + gmouse->gpio = pdata; > + gmouse->input = input; > + > + /* Init the scan timer. TODO: rewrite to use input-polldev in the future */ Add a timer_init(&gmouse->timer); here. > + gmouse->timer.function = gpio_mouse_scan; > + gmouse->timer.base = &boot_tvec_bases; Remove this line ^^^ > + > + ret = input_register_device(input); -- Mvh Hans-Christian Egtvedt