lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120521175510.GB13990@phenom.dumpdata.com>
Date:	Mon, 21 May 2012 13:55:10 -0400
From:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To:	Alex Williamson <alex.williamson@...hat.com>
Cc:	benh@...nel.crashing.org, aik@...abs.ru,
	david@...son.dropbear.id.au, joerg.roedel@....com,
	dwmw2@...radead.org, chrisw@...s-sol.org, agraf@...e.de,
	benve@...co.com, aafabbri@...co.com, B08248@...escale.com,
	B07421@...escale.com, avi@...hat.com, kvm@...r.kernel.org,
	qemu-devel@...gnu.org, iommu@...ts.linux-foundation.org,
	linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	gregkh@...uxfoundation.org, bhelgaas@...gle.com
Subject: Re: [PATCH 11/13] pci: Create common pcibios_err_to_errno

On Fri, May 11, 2012 at 04:56:44PM -0600, Alex Williamson wrote:
> For returning errors out to non-PCI code.  Re-name xen's version.
> 
> Signed-off-by: Alex Williamson <alex.williamson@...hat.com>

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> ---
> 
>  drivers/xen/xen-pciback/conf_space.c |    6 +++---
>  include/linux/pci.h                  |   26 ++++++++++++++++++++++++++
>  2 files changed, 29 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c
> index 30d7be0..46ae0f9 100644
> --- a/drivers/xen/xen-pciback/conf_space.c
> +++ b/drivers/xen/xen-pciback/conf_space.c
> @@ -124,7 +124,7 @@ static inline u32 merge_value(u32 val, u32 new_val, u32 new_val_mask,
>  	return val;
>  }
>  
> -static int pcibios_err_to_errno(int err)
> +static int xen_pcibios_err_to_errno(int err)
>  {
>  	switch (err) {
>  	case PCIBIOS_SUCCESSFUL:
> @@ -202,7 +202,7 @@ out:
>  		       pci_name(dev), size, offset, value);
>  
>  	*ret_val = value;
> -	return pcibios_err_to_errno(err);
> +	return xen_pcibios_err_to_errno(err);
>  }
>  
>  int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value)
> @@ -290,7 +290,7 @@ int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value)
>  		}
>  	}
>  
> -	return pcibios_err_to_errno(err);
> +	return xen_pcibios_err_to_errno(err);
>  }
>  
>  void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev)
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index b437225..20a8f2e 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -467,6 +467,32 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false;
>  #define PCIBIOS_SET_FAILED		0x88
>  #define PCIBIOS_BUFFER_TOO_SMALL	0x89
>  
> +/*
> + * Translate above to generic errno for passing back through non-pci.
> + */
> +static inline int pcibios_err_to_errno(int err)
> +{
> +	if (err <= PCIBIOS_SUCCESSFUL)
> +		return err; /* Assume already errno */
> +
> +	switch (err) {
> +	case PCIBIOS_FUNC_NOT_SUPPORTED:
> +		return -ENOENT;
> +	case PCIBIOS_BAD_VENDOR_ID:
> +		return -EINVAL;
> +	case PCIBIOS_DEVICE_NOT_FOUND:
> +		return -ENODEV;
> +	case PCIBIOS_BAD_REGISTER_NUMBER:
> +		return -EFAULT;
> +	case PCIBIOS_SET_FAILED:
> +		return -EIO;
> +	case PCIBIOS_BUFFER_TOO_SMALL:
> +		return -ENOSPC;
> +	}
> +
> +	return -ENOTTY;
> +}
> +
>  /* Low-level architecture-dependent routines */
>  
>  struct pci_ops {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ