Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754099Ab1DSCq4 (ORCPT ); Mon, 18 Apr 2011 22:46:56 -0400 Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]:39758 "EHLO na3sys009aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753868Ab1DSCqy (ORCPT ); Mon, 18 Apr 2011 22:46:54 -0400 From: Haojian Zhuang To: Mark Brown , Haojian Zhuang CC: "sameo@linux.intel.com" , "linux-kernel@vger.kernel.org" , "dmitry.torokhov@gmail.com" , "a.zummo@towertech.it" , "johnpol@2ka.mipt.ru" , "cbou@mail.ru" , "dwmw2@infradead.org" , "lrg@slimlogic.co.uk" Date: Mon, 18 Apr 2011 19:42:09 -0700 Subject: RE: [PATCH 13/14] regulator: check name in initialization of max8925 Thread-Topic: [PATCH 13/14] regulator: check name in initialization of max8925 Thread-Index: Acv94kxpo/S5Gwx2ShStHEqcKpdtGQAWEuMA Message-ID: <25B60CDC2F704E4E9D88FFD52780CB4C05CF05B424@SC-VEXCH1.marvell.com> References: <1303135451-26362-14-git-send-email-haojian.zhuang@marvell.com> <20110418142855.GE2466@opensource.wolfsonmicro.com> <20110418160424.GG1765@opensource.wolfsonmicro.com> In-Reply-To: <20110418160424.GG1765@opensource.wolfsonmicro.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="gb2312" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id p3J2lQTu010881 Content-Length: 1549 Lines: 41 >-----Original Message----- >From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com] >Sent: 2011??4??19?? 12:04 AM >To: Haojian Zhuang >Cc: Haojian Zhuang; sameo@linux.intel.com; linux-kernel@vger.kernel.org; >dmitry.torokhov@gmail.com; a.zummo@towertech.it; johnpol@2ka.mipt.ru; >cbou@mail.ru; dwmw2@infradead.org; lrg@slimlogic.co.uk >Subject: Re: [PATCH 13/14] regulator: check name in initialization of >max8925 > >On Mon, Apr 18, 2011 at 11:33:34PM +0800, Haojian Zhuang wrote: > >> So I want to avoid to use the index and check regulator[] one by one. >> I use a pointer to link >> all regulator data together. I just need to check whether the >> regulator pointer is valid or not. > >Why? I don't understand what the goal of this change is. Original implementation: Max8925_core.c: If ((pdata == NULL) || (pdata->regulator[0] == NULL)) Return -EINVAL; Machine driver: Platform data: .regulator[0] = xxx .regulator[1] = xxx The index of regulator array is id of buck and ldo. There's issue in max8925_core.c since we can't assume regulator[0] always declared in machine driver. Current implementation: Max8925_core.c: If ((pdata == NULL) || (pdata->regulator == NULL)) Return -EINVAL; Machine driver: Platform data: Use two parameters: num_regulators and regulator pointer. The index of new regulator array isn't id of buck and ldo any more. ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?