From patchwork Mon Mar 3 09:45:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 3752461 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 55757BF13A for ; Mon, 3 Mar 2014 09:45:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60DAC20303 for ; Mon, 3 Mar 2014 09:45:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61E192024D for ; Mon, 3 Mar 2014 09:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbaCCJpa (ORCPT ); Mon, 3 Mar 2014 04:45:30 -0500 Received: from mailout4.w2.samsung.com ([211.189.100.14]:33786 "EHLO usmailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbaCCJp2 convert rfc822-to-8bit (ORCPT ); Mon, 3 Mar 2014 04:45:28 -0500 Received: from uscpsbgm1.samsung.com (u114.gpu85.samsung.co.kr [203.254.195.114]) by usmailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N1U00D3STVSRC00@usmailout4.samsung.com>; Mon, 03 Mar 2014 04:47:52 -0500 (EST) X-AuditID: cbfec372-b7fa96d000006a7b-de-53144f36397a Received: from ussync4.samsung.com ( [203.254.195.84]) by uscpsbgm1.samsung.com (USCPMTA) with SMTP id 0A.10.27259.63F44135; Mon, 03 Mar 2014 04:45:27 -0500 (EST) Received: from localhost.localdomain ([105.144.34.12]) by ussync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N1U003VXTRN5060@ussync4.samsung.com>; Mon, 03 Mar 2014 04:45:26 -0500 (EST) Date: Mon, 03 Mar 2014 06:45:21 -0300 From: Mauro Carvalho Chehab To: Shuah Khan , shuahkhan@gmail.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] [PATCH 4/6] media: em28xx-input - implement em28xx_ops: suspend/resume hooks Message-id: <20140303064521.4261b374@samsung.com> In-reply-to: <20140301104835.631c65bb@samsung.com> References: <5dc00d657718dfefedb35b055abd13997afd6979.1393027856.git.shuah.kh@samsung.com> <20140301104835.631c65bb@samsung.com> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.22; x86_64-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8BIT X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrILMWRmVeSWpSXmKPExsVy+t/hEF1zf5Fgg5fRFpd3zWGz6NmwldXi y2cui68/HRxYPHbOusvu0bdlFaPH501yAcxRXDYpqTmZZalF+nYJXBkXr95nL+hQq9gz+xtL A+Ne+S5GTg4JAROJ+5+72SFsMYkL99azdTFycQgJLGGU6Nk/iQ0kISTQwySx/Wo1iM0ioCqx /MpXJhCbTcBI4lVjCyuILSJgJbH3802wOLOArUTHoU4WEFtYIFFi0/PrQDYHB6+AocS/Bw4g YU6g1hWrJjFD7NrAKNG/eCIrxBFOEq9eTwabwysgKPFj8j0WiJnqEpPmLWKGsLUlnry7wDqB UWAWkrJZSMpmISlbwMi8ilG0tDi5oDgpPddQrzgxt7g0L10vOT93EyMkWIt2MD7bYHWIUYCD UYmH98Yi4WAh1sSy4srcQ4wSHMxKIrz5y4BCvCmJlVWpRfnxRaU5qcWHGJk4OKUaGFNPrmey XnpXxzvxRVPd27nTPM66RqXu+BS2K9favWJmV+m+O9pfOq8ue3nL89UdbuaD9/6yWjntOJLH O62I63rNJ/mXvTz7hGsu5J9Z/SftkNnTCF6V7Z/vLhKYse11TIjHk/x+KQctsQPWbn/i6784 RPnLz3etn1cp/sj1n2WZxdL77ocuqCmxFGckGmoxFxUnAgBj9jwHNAIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Em Sat, 01 Mar 2014 10:48:35 -0300 Mauro Carvalho Chehab escreveu: > Em Fri, 21 Feb 2014 17:50:16 -0700 > Shuah Khan escreveu: > > > Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will > > invoke em28xx_ops: suspend and resume hooks for all its extensions > > from its suspend() and resume() interfaces. > > > > Signed-off-by: Shuah Khan > > --- > > drivers/media/usb/em28xx/em28xx-input.c | 35 +++++++++++++++++++++++++++++++++ > > 1 file changed, 35 insertions(+) > > > > diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c > > index 18f65d8..1227309 100644 > > --- a/drivers/media/usb/em28xx/em28xx-input.c > > +++ b/drivers/media/usb/em28xx/em28xx-input.c > > @@ -827,11 +827,46 @@ static int em28xx_ir_fini(struct em28xx *dev) > > return 0; > > } > > > > +static int em28xx_ir_suspend(struct em28xx *dev) > > +{ > > + struct em28xx_IR *ir = dev->ir; > > + > > + if (dev->is_audio_only) > > + return 0; > > + > > + em28xx_info("Suspending input extension"); > > + cancel_delayed_work_sync(&ir->work); > > + cancel_delayed_work_sync(&dev->buttons_query_work); > > + /* is canceling delayed work sufficient or does the rc event > > + kthread needs stopping? kthread is stopped in > > + ir_raw_event_unregister() */ > > + return 0; > > +} > > + > > +static int em28xx_ir_resume(struct em28xx *dev) > > +{ > > + struct em28xx_IR *ir = dev->ir; > > + > > + if (dev->is_audio_only) > > + return 0; > > + > > + em28xx_info("Resuming input extension"); > > + /* if suspend calls ir_raw_event_unregister(), the should call > > + ir_raw_event_register() */ > > + schedule_delayed_work_sync(&ir->work); > > This causes a compilation breakage: > > drivers/media/usb/em28xx/em28xx-input.c: In function ‘em28xx_ir_resume’: > drivers/media/usb/em28xx/em28xx-input.c:856:2: error: implicit declaration of function ‘schedule_delayed_work_sync’ [-Werror=implicit-function-declaration] > schedule_delayed_work_sync(&ir->work); > Ok, I reworked it fixing the above compilation bug, and added a test to be sure that IR is enabled before using ir->work. Patch enclosed. This series look OK on my eyes with this change, and it worked fine here with PCTV 80e, so I'll be merging it. In any case, this won't cause any regressions, as suspending before those patches on those devices make the machine to hang. Regards, Mauro From: Shuah Khan Date: Fri, 21 Feb 2014 21:50:16 -0300 Subject: [PATCH] [media] em28xx-input: implement em28xx_ops: suspend/resume hooks Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will invoke em28xx_ops: suspend and resume hooks for all its extensions from its suspend() and resume() interfaces. [m.chehab@samsung.com: Fix a breakage caused by calling a non-existing function call: schedule_delayed_work_sync(), and test if IR was defined at suspend/resume] Signed-off-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 048e5b680499..47a2c1dcccbf 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -827,11 +827,48 @@ static int em28xx_ir_fini(struct em28xx *dev) return 0; } +static int em28xx_ir_suspend(struct em28xx *dev) +{ + struct em28xx_IR *ir = dev->ir; + + if (dev->is_audio_only) + return 0; + + em28xx_info("Suspending input extension"); + if (ir) + cancel_delayed_work_sync(&ir->work); + cancel_delayed_work_sync(&dev->buttons_query_work); + /* is canceling delayed work sufficient or does the rc event + kthread needs stopping? kthread is stopped in + ir_raw_event_unregister() */ + return 0; +} + +static int em28xx_ir_resume(struct em28xx *dev) +{ + struct em28xx_IR *ir = dev->ir; + + if (dev->is_audio_only) + return 0; + + em28xx_info("Resuming input extension"); + /* if suspend calls ir_raw_event_unregister(), the should call + ir_raw_event_register() */ + if (ir) + schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); + if (dev->num_button_polling_addresses) + schedule_delayed_work(&dev->buttons_query_work, + msecs_to_jiffies(dev->button_polling_interval)); + return 0; +} + static struct em28xx_ops rc_ops = { .id = EM28XX_RC, .name = "Em28xx Input Extension", .init = em28xx_ir_init, .fini = em28xx_ir_fini, + .suspend = em28xx_ir_suspend, + .resume = em28xx_ir_resume, }; static int __init em28xx_rc_register(void)