From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751403AbdCZMxk (ORCPT ); Sun, 26 Mar 2017 08:53:40 -0400 Received: from mga14.intel.com ([192.55.52.115]:46031 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751309AbdCZMxj (ORCPT ); Sun, 26 Mar 2017 08:53:39 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,225,1486454400"; d="scan'208";a="1147100748" Message-ID: <1490532815.708.12.camel@linux.intel.com> Subject: Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE From: Andy Shevchenko To: Lee Jones Cc: linux-kernel@vger.kernel.org Date: Sun, 26 Mar 2017 15:53:35 +0300 In-Reply-To: <20170324113500.3ceuwwjtknjtwvp3@dell> References: <20170316141959.16018-1-andriy.shevchenko@linux.intel.com> <20170323112157.lroxixbzfrkj45ch@dell> <1490274576.19767.189.camel@linux.intel.com> <20170324113500.3ceuwwjtknjtwvp3@dell> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-03-24 at 11:35 +0000, Lee Jones wrote: > On Thu, 23 Mar 2017, Andy Shevchenko wrote: > > > On Thu, 2017-03-23 at 11:21 +0000, Lee Jones wrote: > > > On Thu, 16 Mar 2017, Andy Shevchenko wrote: > > > > > > > There is a potential flaw if cell has id > 0 and is going to be > > > > registered with PLATFORM_DEVID_NONE. > > > > > > > > Ignore if PLATFORM_DEVID_NONE is supplied. > > > > > > This is a substantial change to a pretty tried and tested piece of > > > sub-system code.  Can you put some more meat on the bones in the > > > commit log, and include examples. > > > > Example in pseudo code: > > > > cells = { > >  [0] = { .id = 0, .name = "moduleX", }, > >  [1] = { .id = 1, .name = "moduleY", }, > >  [2] = { .id = 2, .name = "moduleZ", }, > >  ... > > }; > > > > mfd_add_devices(..., PLATFORM_DEVID_NONE, cells, ARRAY_SIZE(cells), > > ...); > > > > Output (names of the devices in the drivers): > > "moduleX" > > "moduleY.0" > > "moduleX.1" > > > > Desired output: > > "moduleX" > > "moduleY" > > "moduleZ" > > Then what would be your reason for populating the 'id' attribute? That's a gray area. If I remember correctly I come to above patch through looking some incremental change. I'm fine with no patch applied if this is documented somewhere, otherwise we might update documentation to cover such cases explicitly. > > > Is it by design? > > > > > > > > > Signed-off-by: Andy Shevchenko > > > m> > > > > --- > > > >  drivers/mfd/mfd-core.c | 2 +- > > > >  1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c > > > > index c57e407020f1..c9583f895058 100644 > > > > --- a/drivers/mfd/mfd-core.c > > > > +++ b/drivers/mfd/mfd-core.c > > > > @@ -149,7 +149,7 @@ static int mfd_add_device(struct device > > > > *parent, > > > > int id, > > > >   int platform_id; > > > >   int r; > > > >   > > > > - if (id == PLATFORM_DEVID_AUTO) > > > > + if (id < 0) > > > >   platform_id = id; > > > >   else > > > >   platform_id = id + cell->id; > > > > > > > > -- Andy Shevchenko Intel Finland Oy