Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755710AbcDDOFm (ORCPT ); Mon, 4 Apr 2016 10:05:42 -0400 Received: from mga04.intel.com ([192.55.52.120]:26613 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755519AbcDDOFk convert rfc822-to-8bit (ORCPT ); Mon, 4 Apr 2016 10:05:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,440,1455004800"; d="scan'208";a="777730872" From: "Tirdea, Irina" To: Mika Westerberg CC: "Rafael J. Wysocki" , Len Brown , Linus Walleij , "linux-gpio@vger.kernel.org" , "linux-acpi@vger.kernel.org" , Rob Herring , "Heikki Krogerus" , Andy Shevchenko , "Purdila, Octavian" , "Ciocan, Cristina" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [RFC PATCH 4/4] pinctrl: Parse GpioInt/GpioIo resources Thread-Topic: [RFC PATCH 4/4] pinctrl: Parse GpioInt/GpioIo resources Thread-Index: AQHRi0MKOJv4pq+UUk6El/09I8KTq595ydIAgAAVEQA= Date: Mon, 4 Apr 2016 14:05:33 +0000 Deferred-Delivery: Mon, 4 Apr 2016 14:05:00 +0000 Message-ID: <1F3AC3675D538145B1661F571FE1805F2F22D82F@irsmsx105.ger.corp.intel.com> References: <1459424685-26965-1-git-send-email-irina.tirdea@intel.com> <1459424685-26965-5-git-send-email-irina.tirdea@intel.com> <20160404134740.GB1727@lahna.fi.intel.com> In-Reply-To: <20160404134740.GB1727@lahna.fi.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzY0MzdjZWYtMWJiNC00ZDE1LTlhZDItZGY1OWE2YjlhZjhhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjhyNXJYSjFcL2ZsY2RON3RoU1wvSzQ2MllqNCs1NjZNTFZ6NzJ2cUdnQ2JEcz0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1980 Lines: 60 > -----Original Message----- > From: Mika Westerberg [mailto:mika.westerberg@linux.intel.com] > Sent: 04 April, 2016 16:48 > To: Tirdea, Irina > Cc: Rafael J. Wysocki; Len Brown; Linus Walleij; linux-gpio@vger.kernel.org; linux-acpi@vger.kernel.org; Rob Herring; Heikki Krogerus; > Andy Shevchenko; Purdila, Octavian; Ciocan, Cristina; devicetree@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [RFC PATCH 4/4] pinctrl: Parse GpioInt/GpioIo resources > > On Thu, Mar 31, 2016 at 02:44:45PM +0300, Irina Tirdea wrote: > > +static int acpi_parse_gpio_res(struct pinctrl *p, > > + struct pinctrl_map **map, > > + unsigned *num_maps, > > + struct pinctrl_dev ***pctldevs) > > +{ > > + struct acpi_gpio_lookup lookup; > > + struct list_head res_list; > > + struct acpi_device *adev; > > + unsigned int index; > > + int ret; > > + > > + adev = ACPI_COMPANION(p->dev); > > + > > + *map = NULL; > > + *num_maps = 0; > > + memset(&lookup, 0, sizeof(lookup)); > > + > > + /* Parse all GpioInt/GpioIo resources in _CRS and extract pin conf */ > > + for (index = 0; ; index++) { > > + lookup.index = index; > > + lookup.n = 0; > > + lookup.found = false; > > + > > + INIT_LIST_HEAD(&res_list); > > + ret = acpi_dev_get_resources(adev, &res_list, acpi_gpio_to_map, > > + &lookup); > > + if (ret < 0) > > + goto exit_free; > > + acpi_dev_free_resource_list(&res_list); > > + if (!lookup.found) > > + break; > > + } > > + > > + *map = lookup.map; > > + *num_maps = lookup.num_maps; > > + *pctldevs = lookup.pctldevs; > > This function has quite many stars in arguments and in the function > body. In particular pctldevs has three stars! > > I wonder if this could be written in such way that avoids that. Like > create a structure holding the map information and pass that to the > function instead. > Yes, that would make the code more clear. I will rewrite it using a structure. > Other parts of the patch look good to me.