Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
On Thursday 07 February 2013, Winkler, Tomas wrote: > Second why to register anything if the MEI device is not present on the > system. Mostly to match the expectations of readers of that code. Note that no memory is wasted if you do this, because it's a static data structure. You can actually save a few bytes because the registration call moves into an __init section that is discarded after boot. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
Hi Arnd, On Thu, Feb 07, 2013 at 10:37:30PM +, Arnd Bergmann wrote: > On Thursday 07 February 2013, Tomas Winkler wrote: > > @@ -197,6 +197,9 @@ static int mei_probe(struct pci_dev *pdev, const struct > > pci_device_id *ent) > > mei_pdev = pdev; > > pci_set_drvdata(pdev, dev); > > > > + err = mei_bus_init(mei_pdev); > > + if (err) > > + goto deregister_mei; > > > > schedule_delayed_work(>timer_work, HZ); > > > > This is fairly unusual, and will break if you ever have multiple mei devices > in one system, because you end up registering the bus type for each > device. I think it would be more logical to register/unregister > the bus_type from the module_init/exit functions of the module > that contains the bus_type object. That makes sense, I'll fix that. Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
> -Original Message- > From: Arnd Bergmann [mailto:a...@arndb.de] > Sent: Friday, February 08, 2013 00:38 > To: Winkler, Tomas > Cc: gre...@linuxfoundation.org; sa...@linux.intel.com; linux- > ker...@vger.kernel.org > Subject: Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core > code > > On Thursday 07 February 2013, Tomas Winkler wrote: > > @@ -197,6 +197,9 @@ static int mei_probe(struct pci_dev *pdev, const > struct pci_device_id *ent) > > mei_pdev = pdev; > > pci_set_drvdata(pdev, dev); > > > > + err = mei_bus_init(mei_pdev); > > + if (err) > > + goto deregister_mei; > > > > schedule_delayed_work(>timer_work, HZ); > > > > This is fairly unusual, and will break if you ever have multiple mei devices > in > one system, because you end up registering the bus type for each device. I > think it would be more logical to register/unregister the bus_type from the > module_init/exit functions of the module that contains the bus_type object. MEI is a singleton and it is enforced also in software in the probe Second why to register anything if the MEI device is not present on the system. Thanks Tomas -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
On Thursday 07 February 2013, Tomas Winkler wrote: > @@ -197,6 +197,9 @@ static int mei_probe(struct pci_dev *pdev, const struct > pci_device_id *ent) > mei_pdev = pdev; > pci_set_drvdata(pdev, dev); > > + err = mei_bus_init(mei_pdev); > + if (err) > + goto deregister_mei; > > schedule_delayed_work(>timer_work, HZ); > This is fairly unusual, and will break if you ever have multiple mei devices in one system, because you end up registering the bus type for each device. I think it would be more logical to register/unregister the bus_type from the module_init/exit functions of the module that contains the bus_type object. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
On Thursday 07 February 2013, Tomas Winkler wrote: @@ -197,6 +197,9 @@ static int mei_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mei_pdev = pdev; pci_set_drvdata(pdev, dev); + err = mei_bus_init(mei_pdev); + if (err) + goto deregister_mei; schedule_delayed_work(dev-timer_work, HZ); This is fairly unusual, and will break if you ever have multiple mei devices in one system, because you end up registering the bus type for each device. I think it would be more logical to register/unregister the bus_type from the module_init/exit functions of the module that contains the bus_type object. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
-Original Message- From: Arnd Bergmann [mailto:a...@arndb.de] Sent: Friday, February 08, 2013 00:38 To: Winkler, Tomas Cc: gre...@linuxfoundation.org; sa...@linux.intel.com; linux- ker...@vger.kernel.org Subject: Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core code On Thursday 07 February 2013, Tomas Winkler wrote: @@ -197,6 +197,9 @@ static int mei_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mei_pdev = pdev; pci_set_drvdata(pdev, dev); + err = mei_bus_init(mei_pdev); + if (err) + goto deregister_mei; schedule_delayed_work(dev-timer_work, HZ); This is fairly unusual, and will break if you ever have multiple mei devices in one system, because you end up registering the bus type for each device. I think it would be more logical to register/unregister the bus_type from the module_init/exit functions of the module that contains the bus_type object. MEI is a singleton and it is enforced also in software in the probe Second why to register anything if the MEI device is not present on the system. Thanks Tomas -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
Hi Arnd, On Thu, Feb 07, 2013 at 10:37:30PM +, Arnd Bergmann wrote: On Thursday 07 February 2013, Tomas Winkler wrote: @@ -197,6 +197,9 @@ static int mei_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mei_pdev = pdev; pci_set_drvdata(pdev, dev); + err = mei_bus_init(mei_pdev); + if (err) + goto deregister_mei; schedule_delayed_work(dev-timer_work, HZ); This is fairly unusual, and will break if you ever have multiple mei devices in one system, because you end up registering the bus type for each device. I think it would be more logical to register/unregister the bus_type from the module_init/exit functions of the module that contains the bus_type object. That makes sense, I'll fix that. Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
On Thursday 07 February 2013, Winkler, Tomas wrote: Second why to register anything if the MEI device is not present on the system. Mostly to match the expectations of readers of that code. Note that no memory is wasted if you do this, because it's a static data structure. You can actually save a few bytes because the registration call moves into an __init section that is discarded after boot. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/