From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932647Ab2GFCFO (ORCPT ); Thu, 5 Jul 2012 22:05:14 -0400 Received: from va3ehsobe006.messaging.microsoft.com ([216.32.180.16]:26754 "EHLO va3outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932325Ab2GFCFM convert rfc822-to-8bit (ORCPT ); Thu, 5 Jul 2012 22:05:12 -0400 X-Forefront-Antispam-Report: CIP:70.37.183.190;KIP:(null);UIP:(null);IPV:NLI;H:mail.freescale.net;RD:none;EFVD:NLI X-SpamScore: -8 X-BigFish: VS-8(zzbb2dI98dI9371I542M1432Izz1202hzz8275bhz2dh2a8h668h839h8e2h8e3h944hd25hf0ah107ahbe9i) From: Jia Hongtao-B38951 To: Rob Herring , Greg KH CC: "devicetree-discuss@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , Li Yang-R58472 Subject: RE: [PATCH V3 5/6] Avoid duplicate probe for of platform devices Thread-Topic: [PATCH V3 5/6] Avoid duplicate probe for of platform devices Thread-Index: AQHNRV2d07XgG54zbUKKBQTDlvBob5b1mBOAgCYUJaA= Date: Fri, 6 Jul 2012 02:05:05 +0000 Message-ID: <412C8208B4A0464FA894C5F0C278CD5D01A16829@039-SN1MPN1-002.039d.mgd.msft.net> References: <1339148585-16947-1-git-send-email-B38951@freescale.com> <4FD60FB1.7050106@gmail.com> In-Reply-To: <4FD60FB1.7050106@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.193.20.48] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob and Greg KH, Do you have any better idea to avoid duplication probe warning? Thanks. -Jia Hongtao. > -----Original Message----- > From: Rob Herring [mailto:robherring2@gmail.com] > Sent: Monday, June 11, 2012 11:33 PM > To: Jia Hongtao-B38951 > Cc: devicetree-discuss@lists.ozlabs.org; linux-kernel@vger.kernel.org; > Greg KH > Subject: Re: [PATCH V3 5/6] Avoid duplicate probe for of platform devices > > [adding lkml and Greg KH] > > On 06/08/2012 04:43 AM, Jia Hongtao wrote: > > We changed the pcie controller driver to platform driver so that the > PCI > > of platform devices need to be created earlier in the arch_initcall > stage > > according to the original timing of calling fsl_add_bridge(). So we do > PCI > > probing separately from other devices. But probing more than once could > > cause duplication warning. We add check if the devices have already > probed > > before probing any devices to avoid duplication warning. > > > > Signed-off-by: Jia Hongtao > > Signed-off-by: Li Yang > > --- > > Where's v1 and v2 history? > > > drivers/of/platform.c | 18 ++++++++++++------ > > 1 files changed, 12 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > > index a37330e..3aab01f 100644 > > --- a/drivers/of/platform.c > > +++ b/drivers/of/platform.c > > @@ -139,6 +139,18 @@ struct platform_device *of_device_alloc(struct > device_node *np, > > if (!dev) > > return NULL; > > > > + dev->dev.of_node = of_node_get(np); > > + if (bus_id) > > + dev_set_name(&dev->dev, "%s", bus_id); > > + else > > + of_device_make_bus_id(&dev->dev); > > + > > + if (kset_find_obj(dev->dev.kobj.kset, kobject_name(&dev->dev.kobj))) > { > > Is this a fast operation? I worry that we'd be doing this for every > device creation. Looking at kobj's seems too low level as well. > > Perhaps moving the warning up the call stack and making the relevant > functions __must_check would work. > > Rob > > > + kfree(dev); > > + of_node_put(np); > > + return NULL; > > + } > > + > > /* count the io and irq resources */ > > while (of_address_to_resource(np, num_reg, &temp_res) == 0) > > num_reg++; > > @@ -161,17 +173,11 @@ struct platform_device *of_device_alloc(struct > device_node *np, > > WARN_ON(of_irq_to_resource_table(np, res, num_irq) != > num_irq); > > } > > > > - dev->dev.of_node = of_node_get(np); > > #if defined(CONFIG_MICROBLAZE) > > dev->dev.dma_mask = &dev->archdata.dma_mask; > > #endif > > dev->dev.parent = parent; > > > > - if (bus_id) > > - dev_set_name(&dev->dev, "%s", bus_id); > > - else > > - of_device_make_bus_id(&dev->dev); > > - > > return dev; > > } > > EXPORT_SYMBOL(of_device_alloc); > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jia Hongtao-B38951 Subject: RE: [PATCH V3 5/6] Avoid duplicate probe for of platform devices Date: Fri, 6 Jul 2012 02:05:05 +0000 Message-ID: <412C8208B4A0464FA894C5F0C278CD5D01A16829@039-SN1MPN1-002.039d.mgd.msft.net> References: <1339148585-16947-1-git-send-email-B38951@freescale.com> <4FD60FB1.7050106@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FD60FB1.7050106-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: Rob Herring , Greg KH Cc: "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Li Yang-R58472 List-Id: devicetree@vger.kernel.org Hi Rob and Greg KH, Do you have any better idea to avoid duplication probe warning? Thanks. -Jia Hongtao. > -----Original Message----- > From: Rob Herring [mailto:robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] > Sent: Monday, June 11, 2012 11:33 PM > To: Jia Hongtao-B38951 > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; > Greg KH > Subject: Re: [PATCH V3 5/6] Avoid duplicate probe for of platform devices > > [adding lkml and Greg KH] > > On 06/08/2012 04:43 AM, Jia Hongtao wrote: > > We changed the pcie controller driver to platform driver so that the > PCI > > of platform devices need to be created earlier in the arch_initcall > stage > > according to the original timing of calling fsl_add_bridge(). So we do > PCI > > probing separately from other devices. But probing more than once could > > cause duplication warning. We add check if the devices have already > probed > > before probing any devices to avoid duplication warning. > > > > Signed-off-by: Jia Hongtao > > Signed-off-by: Li Yang > > --- > > Where's v1 and v2 history? > > > drivers/of/platform.c | 18 ++++++++++++------ > > 1 files changed, 12 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > > index a37330e..3aab01f 100644 > > --- a/drivers/of/platform.c > > +++ b/drivers/of/platform.c > > @@ -139,6 +139,18 @@ struct platform_device *of_device_alloc(struct > device_node *np, > > if (!dev) > > return NULL; > > > > + dev->dev.of_node = of_node_get(np); > > + if (bus_id) > > + dev_set_name(&dev->dev, "%s", bus_id); > > + else > > + of_device_make_bus_id(&dev->dev); > > + > > + if (kset_find_obj(dev->dev.kobj.kset, kobject_name(&dev->dev.kobj))) > { > > Is this a fast operation? I worry that we'd be doing this for every > device creation. Looking at kobj's seems too low level as well. > > Perhaps moving the warning up the call stack and making the relevant > functions __must_check would work. > > Rob > > > + kfree(dev); > > + of_node_put(np); > > + return NULL; > > + } > > + > > /* count the io and irq resources */ > > while (of_address_to_resource(np, num_reg, &temp_res) == 0) > > num_reg++; > > @@ -161,17 +173,11 @@ struct platform_device *of_device_alloc(struct > device_node *np, > > WARN_ON(of_irq_to_resource_table(np, res, num_irq) != > num_irq); > > } > > > > - dev->dev.of_node = of_node_get(np); > > #if defined(CONFIG_MICROBLAZE) > > dev->dev.dma_mask = &dev->archdata.dma_mask; > > #endif > > dev->dev.parent = parent; > > > > - if (bus_id) > > - dev_set_name(&dev->dev, "%s", bus_id); > > - else > > - of_device_make_bus_id(&dev->dev); > > - > > return dev; > > } > > EXPORT_SYMBOL(of_device_alloc); >