Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754321AbWKMPxW (ORCPT ); Mon, 13 Nov 2006 10:53:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755168AbWKMPxW (ORCPT ); Mon, 13 Nov 2006 10:53:22 -0500 Received: from ug-out-1314.google.com ([66.249.92.172]:41017 "EHLO ug-out-1314.google.com") by vger.kernel.org with ESMTP id S1754321AbWKMPxV convert rfc822-to-8bit (ORCPT ); Mon, 13 Nov 2006 10:53:21 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=B4kO+c5ue60TR7y5rrzQzkng/ZCSXBzwWpVYzry0H3Olkzl/wgVs0WR0ZDjslAzIC2R7OQYwXFTEv1JBVypySFo6J9FGief7345z/PO2XA4/aJ9Tasj1Jg7hHkChG9ixs2k24Vft50LsViU27nKWIhq3isx3g2w1y1qHUTcFYIs= Message-ID: Date: Mon, 13 Nov 2006 10:53:19 -0500 From: "Dmitry Torokhov" To: "Stelian Pop" Subject: Re: [PATCH] Apple Motion Sensor driver Cc: "Andrew Morton" , "Michael Hanselmann" , "Aristeu S. Rozanski F." , "Johannes Berg" , "Benjamin Herrenschmidt" , "Paul Mackerras" , "Robert Love" , "Jean Delvare" , "Rene Nussbaumer" , "Linux Kernel Mailing List" In-Reply-To: <1163431758.23444.8.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Content-Disposition: inline References: <1163280972.32084.13.camel@localhost.localdomain> <1163431758.23444.8.camel@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1542 Lines: 48 On 11/13/06, Stelian Pop wrote: > Le lundi 13 novembre 2006 ? 10:04 -0500, Dmitry Torokhov a ?crit : > > Hi Stelian, > > > > On 11/11/06, Stelian Pop wrote: > > > > + > > > + if (input_register_device(ams_info.idev)) { > > > + input_free_device(ams_info.idev); > > > + ams_info.idev = NULL; > > > + return; > > > + } > > > + > > > + ams_info.kthread = kthread_run(ams_mouse_kthread, NULL, "kams"); > > > + if (IS_ERR(ams_info.kthread)) { > > > + input_unregister_device(ams_info.idev); > > > + ams_info.idev = NULL; > > > + return; > > > + } > > > +} > > > > Please consider implementing ams_mouse_start() and ams_mouse_stop() > > methods for input_dev and start/stop polling thread there - there is > > no reason to report input events when noone listens to them. > > I suppose you talk about input_dev->open() and close() ? > Yep. > + > +static int ams_mouse_open(struct input_dev *dev) > +{ > + ams_info.kthread = kthread_run(ams_mouse_kthread, NULL, "kams"); > + return IS_ERR(ams_info.kthread) ? -ENODEV : 0; > +} > + Is there a reason why you reporting -ENODEV instead of real error code from kthread_run()? -- Dmitry - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/