From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Subject: Re: [PATCH RFC] pci: expose function reset capability in sysfs Date: Mon, 27 Jul 2009 09:14:23 -0700 Message-ID: <20090727161423.GC30241@kroah.com> References: <20090726171139.GA22202@redhat.com> <20090727150146.GA19079@kroah.com> <20090727155238.GA29853@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jbarnes@virtuousgeek.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from kroah.org ([198.145.64.141]:38139 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbZG0QPk (ORCPT ); Mon, 27 Jul 2009 12:15:40 -0400 Content-Disposition: inline In-Reply-To: <20090727155238.GA29853@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jul 27, 2009 at 06:52:38PM +0300, Michael S. Tsirkin wrote: > On Mon, Jul 27, 2009 at 08:01:46AM -0700, Greg KH wrote: > > > + if (!pci_probe_reset_function(dev)) { > > > + retval = device_create_file(&dev->dev, &reset_attr); > > > + if (retval) > > > + goto error; > > > + } > > > > So you only add the file if there is a reset function, which is fine, > > but later on: > > > > > @@ -1037,6 +1073,7 @@ static void pci_remove_capabilities_sysfs(struct pci_dev *dev) > > > } > > > > > > pcie_aspm_remove_sysfs_dev_files(dev); > > > + device_remove_file(&dev->dev, &reset_attr); > > > > You always remove the file, if it has been created or not. That could > > cause problems in the future, please only remove a file if you have > > actually added it to the sysfs tree. > > > > thanks, > > > > greg k-h > > OK. I think, however, that it's better to avoid probing the function > on cleanup path just to figure out whether the file needs to be removed. > Can this info be stored in struct pci_dev? > Along the lines of: Fine with me. You forgot the documentation though :) thanks, greg k-h