Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755207AbbHXSZM (ORCPT ); Mon, 24 Aug 2015 14:25:12 -0400 Received: from mail-by2on0119.outbound.protection.outlook.com ([207.46.100.119]:50396 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750942AbbHXSZK convert rfc822-to-8bit (ORCPT ); Mon, 24 Aug 2015 14:25:10 -0400 From: Shenwei Wang To: Thomas Gleixner CC: "shawn.guo@linaro.org" , "jason@lakedaemon.net" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Huang Anson Subject: RE: [PATCH v8 1/2] irqchip: imx-gpcv2: IMX GPCv2 driver for wakeup sources Thread-Topic: [PATCH v8 1/2] irqchip: imx-gpcv2: IMX GPCv2 driver for wakeup sources Thread-Index: AQHQy9jL+RBhKH42jEGfmT8ssDAQNZ4ZjWsAgAHi6uCAAB7vAIAAC9Cw Date: Mon, 24 Aug 2015 18:25:07 +0000 Message-ID: References: <1438378439-11569-1-git-send-email-shenwei.wang@freescale.com> <1438378439-11569-2-git-send-email-shenwei.wang@freescale.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Shenwei.Wang@freescale.com; x-originating-ip: [192.88.168.50] x-microsoft-exchange-diagnostics: 1;BLUPR03MB1361;5:awlKlCDRPIlHQybKsenjeUflGZAOPjG9/JW7SdrYE7+krGjFuXrn8g2yPznFcKexjkLa+AJrXROLHbr7uVsqGcadJugnAmoKkyBe8oNcjXfSWkOpUvo+8jZgHmfZFrlQNupprOGNpw/8md13+6VNTA==;24:GEwThsh83frwCD8ML+SsZwnjsIDGjBOfWlVzXe7+0hMV8a1B95ADk8r7aSOAkQ4jbYxm6RiBvdtUptr84FpCQhpU/185qFnDUWH4aNlujNE=;20:C233B9KEptNfBDc4NmKu3Uuwd5WLkhXPXzNnW93sNcJCfdFSVzC+X24dw+hwDsx593T0zmQQwlW4ZpsI9j86Og== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1361; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(8121501046)(5005006)(3002001);SRVR:BLUPR03MB1361;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1361; x-forefront-prvs: 06780E24F8 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(13464003)(164054003)(189002)(110136002)(5001830100001)(4001540100001)(77156002)(189998001)(2900100001)(2950100001)(102836002)(81156007)(68736005)(64706001)(54356999)(87936001)(97736004)(77096005)(2656002)(86362001)(5001960100002)(74316001)(66066001)(93886004)(101416001)(76176999)(50986999)(62966003)(92566002)(122556002)(105586002)(5004730100002)(5001860100001)(33656002)(107886002)(5007970100001)(99286002)(5002640100001)(76576001)(106116001)(106356001)(46102003)(19580395003)(19580405001)(10400500002)(40100003)(5003600100002)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB1361;H:BY1PR0301MB0839.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2015 18:25:07.6210 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1361 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2127 Lines: 57 > -----Original Message----- > From: Thomas Gleixner [mailto:tglx@linutronix.de] > > > > +static int gpcv2_wakeup_source_save(void) { > > > > + struct gpcv2_irqchip_data *cd; > > > > + void __iomem *reg; > > > > + int i; > > > > + > > > > + cd = imx_gpcv2_instance; > > > > + if (!cd) > > > > + return 0; > > > > + > > > > + for (i = 0; i < IMR_NUM; i++) { > > > > + reg = cd->gpc_base + cd->cpu2wakeup + i * 4; > > > > + cd->enabled_irqs[i] = readl_relaxed(reg); > > > > > > You read the full state of the register and restore the full state. > > > So why enabled_irqs? > > > > There are two user scenarios: > > In CPU Idle state, the system need to be woke up by any enabled irqs, > > not just the ones that marked as wakeup sources. > > In Suspend State, they system will only be woke up by the one that > > marked as a wakeup source. Enabled_irqs are used to save the values > > before suspend, and restore them after resume. > > That's what you want achieve. Still you save the full content of the registers and > restore the full content. That saves/restores the enabled and disabled interrupts. > So enabled_irqs is a misnomer as you save the full state. How about change its name to "saved_irq_mask"? > > > set_wake() or leave it when they want to have resume functionality? > > > > > Each time system goes into the suspend state, it will call set_wake > > (ON) again to configure the wakeup sources. Clearing wakeup_sources > > here can make sure the system work as expected no matter that a driver > > calls set_wake (OFF) during resume stage. > > We rather make sure that the drivers call set_wake(OFF) as they are supposed to, > because if they do not then the set_wake(ON) logic in the core code will see the > counter != 0 and not invoke the irq callback. Sounds reasonable. Then I will remove this line in new patch. Thanks, Shenwei > Thanks, > > tglx -- 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/