Re: [PATCH RFC] pci: expose function reset capability in sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux