From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751014AbbJ0ENv (ORCPT ); Tue, 27 Oct 2015 00:13:51 -0400 Received: from mail-bn1on0113.outbound.protection.outlook.com ([157.56.110.113]:4954 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750701AbbJ0ENY convert rfc822-to-8bit (ORCPT ); Tue, 27 Oct 2015 00:13:24 -0400 From: Yao Yuan To: Vinod Koul CC: "stefan@agner.ch" , "arnd@arndb.de" , "dan.j.williams@intel.com" , "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support Thread-Topic: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support Thread-Index: AQHRCkmFt5Vd/KhFTkejq0/o4B6W7Z5+ofcAgAAVkEA= Date: Tue, 27 Oct 2015 03:58:31 +0000 Message-ID: References: <1445243465-7727-1-git-send-email-yao.yuan@freescale.com> <20151027020035.GC11691@vkoul-mobl.iind.intel.com> In-Reply-To: <20151027020035.GC11691@vkoul-mobl.iind.intel.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yao.yuan@freescale.com; x-originating-ip: [199.59.226.141] x-microsoft-exchange-diagnostics: 1;BLUPR03MB134;5:UcfLYJ4+d8Cp+jlVy7kpZuw/vjREVsk1RgwBpyeSEwB43f1l1Kyu3GXRDlJzSyg13xmsFGkPjG7clzv9BbS9PJaxSCHAO/4rGYazWs3bjJ6WjDAa9nVO3EGoGQ14lYv33fPDdSDEV6hmBqlu+2UUJA==;24:epEuEkyp157n8xWkCiEuibYEY9R7KsDFVVYXv4AfJqI8OXVIxZlKQrNw1n8etV2kHpvDswbUNs09sZ7ORgOM25N8EY9uUmqgdILxprSYAi4=;20:Kc2B3Xj0GRS3bc4ijt1kUnD6SjhepugkV4kNkuIb+9TCMs9/R40osuuSp5FFkLmymwatdm7qIDf28ie8o1Leig== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB134; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(101931422205132); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(102215026);SRVR:BLUPR03MB134;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB134; x-forefront-prvs: 0742443479 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(6009001)(199003)(24454002)(377454003)(13464003)(189002)(10400500002)(99286002)(85806002)(105586002)(2950100001)(2900100001)(40100003)(66066001)(11100500001)(5008740100001)(5003600100002)(122556002)(5007970100001)(5004730100002)(92566002)(76576001)(101416001)(19580405001)(19580395003)(189998001)(74316001)(102836002)(106356001)(106116001)(5001920100001)(5002640100001)(50986999)(54356999)(87936001)(76176999)(110136002)(81156007)(5001960100002)(97736004)(86362001)(33656002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB134;H:BLUPR03MB134.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Oct 2015 03:58:31.6306 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB134 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vinod, Thanks for your review. I did the test and it seems that it should be ok when CONFIG_PM is not defined. So I removed the protection code to make it more readable. Do you think is it ok? Best Regards, Yuan Yao > -----Original Message----- > From: Vinod Koul [mailto:vinod.koul@intel.com] > Sent: Tuesday, October 27, 2015 10:01 AM > To: Yuan Yao-B46683 > Cc: stefan@agner.ch; arnd@arndb.de; dan.j.williams@intel.com; > dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm- > kernel@lists.infradead.org > Subject: Re: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume > support > > On Mon, Oct 19, 2015 at 04:31:05PM +0800, Yuan Yao wrote: > > The patch overall looks fine, but > > > > +static int fsl_edma_suspend_late(struct device *dev) > > This needs protection and will have build failure when CONFIG_PM is not > defined > > > +{ > > + struct fsl_edma_engine *fsl_edma = dev_get_drvdata(dev); > > + struct fsl_edma_chan *fsl_chan; > > + unsigned long flags; > > + int i; > > + > > + for (i = 0; i < fsl_edma->n_chans; i++) { > > + fsl_chan = &fsl_edma->chans[i]; > > + spin_lock_irqsave(&fsl_chan->vchan.lock, flags); > > + /* Make sure chan is idle or will force disable. */ > > + if (unlikely(!fsl_chan->idle)) { > > + dev_warn(dev, "WARN: There is non-idle channel."); > > + fsl_edma_disable_request(fsl_chan); > > + fsl_edma_chan_mux(fsl_chan, 0, false); > > + } > > + > > + fsl_chan->pm_state = SUSPENDED; > > + spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); > > + } > > + > > + return 0; > > +} > > + > > +static int fsl_edma_resume_early(struct device *dev) { > > + struct fsl_edma_engine *fsl_edma = dev_get_drvdata(dev); > > + struct fsl_edma_chan *fsl_chan; > > + int i; > > + > > + for (i = 0; i < fsl_edma->n_chans; i++) { > > + fsl_chan = &fsl_edma->chans[i]; > > + fsl_chan->pm_state = RUNNING; > > + edma_writew(fsl_edma, 0x0, fsl_edma->membase + > EDMA_TCD_CSR(i)); > > + if (fsl_chan->slave_id != 0) > > + fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, > true); > > + } > > + > > + edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, > > + fsl_edma->membase + EDMA_CR); > > + > > + return 0; > > +} > > + > > +static const struct dev_pm_ops fsl_edma_pm_ops = { > > + .suspend_late = fsl_edma_suspend_late, > > + .resume_early = fsl_edma_resume_early, > > +}; > > This one too, also why use late and early, pls add the note here > > > static const struct of_device_id fsl_edma_dt_ids[] = { > > { .compatible = "fsl,vf610-edma", }, > > { /* sentinel */ } > > @@ -969,6 +1042,7 @@ static struct platform_driver fsl_edma_driver = { > > .driver = { > > .name = "fsl-edma", > > .of_match_table = fsl_edma_dt_ids, > > + .pm = &fsl_edma_pm_ops, > This will fail too if CONFIG_PM is not defined > > -- > ~Vinod