Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755610AbbHZTFa (ORCPT ); Wed, 26 Aug 2015 15:05:30 -0400 Received: from mail-bl2on0110.outbound.protection.outlook.com ([65.55.169.110]:37944 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751860AbbHZTF3 convert rfc822-to-8bit (ORCPT ); Wed, 26 Aug 2015 15:05:29 -0400 From: Shenwei Wang To: Thomas Gleixner CC: "shawn.guo@linaro.org" , "jason@lakedaemon.net" , "sudeep.holla@arm.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Huang Anson Subject: RE: [PATCH 1/1] irqchip: imx-gpcv2: Simplify the implemenation Thread-Topic: [PATCH 1/1] irqchip: imx-gpcv2: Simplify the implemenation Thread-Index: AQHQ4BhnQCw9/HJgNUCrRbRu4Kf4sJ4ecbkwgAAvUoCAAAIqMA== Date: Wed, 26 Aug 2015 19:05:18 +0000 Message-ID: References: <1440604166-2624-1-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;BY1PR03MB1371;5:T+WTW5qtc7/xFI+HorAetpse76TxPh7Xf9dRIyXxhwk7lVGzXiXtPSFWsWZgdGJ98k7VhWucsWUI7fQ8JYWGGfZy1SAKPO+WNYMqqdrgfF+dlwxyrd/6fHebEVneKZhKCSMg+k2p36jayRfJ2/Ohcw==;24:Vs4Vzyy1isyV+k+e/zspx/bpQS7WclC8xvVDyuuHzMpPo6snb/ZzYZyMtUwwaqF/2C6VAcoGhboDOXGr7hynUqydw7RewCAcPZBcb0l6TM8=;20:OxjFjoadN/cpWnij7oi1ZU4jGP7/Su/s/wm20Dp+DSftm4RrbIm3kyv+QBMEdXMvqkGCOyKqcCWcQddSejtcoQ== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1371; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:BY1PR03MB1371;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1371; x-forefront-prvs: 0680FADD48 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(189002)(199003)(164054003)(13464003)(5004730100002)(33656002)(87936001)(102836002)(2950100001)(74316001)(19580405001)(19580395003)(2900100001)(77096005)(62966003)(64706001)(86362001)(2656002)(68736005)(77156002)(97736004)(5002640100001)(110136002)(189998001)(54356999)(46102003)(10400500002)(92566002)(4001540100001)(106116001)(81156007)(66066001)(101416001)(5001960100002)(93886004)(76176999)(5001830100001)(107886002)(5003600100002)(5007970100001)(5001860100001)(122556002)(76576001)(50986999)(106356001)(99286002)(40100003)(105586002)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR03MB1371;H:CY1PR0301MB0843.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A: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: 26 Aug 2015 19:05:19.0077 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1371 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1277 Lines: 44 > -----Original Message----- > From: Thomas Gleixner [mailto:tglx@linutronix.de] > > > > + > > > > if (sources) > > > > - *sources = imx_gpcv2_instance->wakeup_sources; > > > > + *sources = cd->wakeup_sources; > > > > > > > > return IMR_NUM; > > > > > > You do not need the intermediate storage at all. > > > > > > u32 imx_gpcv2_get_wakeup_source(u32 *sources) { > > > if (sources) { > > > for (i = 0; i < IMR_NUM; i++) { > > > reg = cd->gpc_base + cd->cpu2wakeup + i * 4; > > > sources[i] = readl_relaxed(reg); > > > } > > > } > > > .... > > > > Using the intermediate storage here can make the caller a little > > easier, because the caller does not need to malloc the memory before the call. > > Especially the caller does not even know how many memory to allocate > > In the beginning. > > Fair enough, but why do you need that case where sources can be NULL just to > return IMR_NUM? The intention is to get the IMR_NUM only. But so far no user uses this feature. 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/