From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH] xen/pci: make bus notifier handler return sane values Date: Wed, 17 Aug 2011 10:57:16 -0400 Message-ID: <20110817145716.GA9680@dumpdata.com> References: <4E4B98C00200007800051A56@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <4E4B98C00200007800051A56@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: Jeremy Fitzhardinge , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Wed, Aug 17, 2011 at 09:32:32AM +0100, Jan Beulich wrote: > Notifier functions are expected to return NOTIFY_* codes, not -E... > ones. In particular, since the respective hypercalls failing is not > fatal to the operation of the Dom0 kernel, it must be avoided to So if we fail adding a PCI device, won't we be unable to actually setup its MSI? > return negative values here as those would make it appear as if > NOTIFY_STOP_MASK wa set, suppressing further notification calls to > other interested parties (which is also why we don't want to use > notifier_from_errno() here). > > Signed-off-by: Jan Beulich > > --- > drivers/xen/pci.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > --- 3.1-rc2/drivers/xen/pci.c > +++ 3.1-rc2-xen-pci-bus-notifier/drivers/xen/pci.c > @@ -86,23 +86,22 @@ static int xen_pci_notifier(struct notif > unsigned long action, void *data) > { > struct device *dev = data; > - int r = 0; > > switch (action) { > case BUS_NOTIFY_ADD_DEVICE: > - r = xen_add_device(dev); > + xen_add_device(dev); > break; > case BUS_NOTIFY_DEL_DEVICE: > - r = xen_remove_device(dev); > + xen_remove_device(dev); > break; > default: > - break; > + return NOTIFY_DONE; > } > > - return r; > + return NOTIFY_OK; > } > > -struct notifier_block device_nb = { > +static struct notifier_block device_nb = { > .notifier_call = xen_pci_notifier, > }; > > > > > Notifier functions are expected to return NOTIFY_* codes, not -E... > ones. In particular, since the respective hypercalls failing is not > fatal to the operation of the Dom0 kernel, it must be avoided to > return negative values here as those would make it appear as if > NOTIFY_STOP_MASK wa set, suppressing further notification calls to > other interested parties (which is also why we don't want to use > notifier_from_errno() here). > > Signed-off-by: Jan Beulich > > --- > drivers/xen/pci.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > --- 3.1-rc2/drivers/xen/pci.c > +++ 3.1-rc2-xen-pci-bus-notifier/drivers/xen/pci.c > @@ -86,23 +86,22 @@ static int xen_pci_notifier(struct notif > unsigned long action, void *data) > { > struct device *dev = data; > - int r = 0; > > switch (action) { > case BUS_NOTIFY_ADD_DEVICE: > - r = xen_add_device(dev); > + xen_add_device(dev); > break; > case BUS_NOTIFY_DEL_DEVICE: > - r = xen_remove_device(dev); > + xen_remove_device(dev); > break; > default: > - break; > + return NOTIFY_DONE; > } > > - return r; > + return NOTIFY_OK; > } > > -struct notifier_block device_nb = { > +static struct notifier_block device_nb = { > .notifier_call = xen_pci_notifier, > }; > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel