All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: jbarnes@virtuousgeek.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH RFC] pci: expose function reset capability in sysfs
Date: Mon, 27 Jul 2009 08:01:46 -0700	[thread overview]
Message-ID: <20090727150146.GA19079@kroah.com> (raw)
In-Reply-To: <20090726171139.GA22202@redhat.com>

On Sun, Jul 26, 2009 at 08:11:39PM +0300, Michael S. Tsirkin wrote:
> Some devices allow an individual function to be reset without affecting
> other functions in the same device: that's what pci_reset_function does.
> For devices that have this support, expose reset attribite in sysfs.

Please add the proper documentation to Documentation/ABI for any new
sysfs file you create.

>  static int pci_create_capabilities_sysfs(struct pci_dev *dev)
>  {
>  	int retval;
> @@ -943,7 +965,21 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev)
>  	/* Active State Power Management */
>  	pcie_aspm_create_sysfs_dev_files(dev);
>  
> +	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

  reply	other threads:[~2009-07-27 15:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-26 17:11 [PATCH RFC] pci: expose function reset capability in sysfs Michael S. Tsirkin
2009-07-27 15:01 ` Greg KH [this message]
2009-07-27 15:52   ` Michael S. Tsirkin
2009-07-27 16:14     ` Greg KH
2009-07-27 16:20       ` Jesse Barnes
2009-07-27 20:37       ` Michael S. Tsirkin
2009-07-27 21:03         ` Greg KH
2009-07-28 16:56         ` Jesse Barnes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090727150146.GA19079@kroah.com \
    --to=greg@kroah.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.