Re: remove pci_dma_* abuses and workarounds V2

2018-01-17 Thread Bjorn Helgaas
[+cc David]

On Wed, Jan 10, 2018 at 07:03:18PM +0100, Christoph Hellwig wrote:
> Back before the dawn of time pci_dma_* with a NULL pci_dev argument
> was used for all kinds of things, e.g. dma mapping for non-PCI
> devices.  All this has been long removed, but it turns out we
> still care for a NULL pci_dev in the wrappers, and we still have
> two odd USB drivers that use pci_dma_alloc_consistent for allocating
> memory while ignoring the dma_addr_t entirely, and a network driver
> mixing the already wrong usage of dma_* with a NULL device with a
> single call to pci_free_consistent.
> 
> This series switches the two usb drivers to use plain kzalloc, the
> net driver to properly use the dma API and then removes the handling
> of the NULL pci_dev in the pci_dma_* wrappers.
> 
> Changes since V1:
>  - remove allocation failure printks
>  - use kcalloc
>  - fix tsi108_eth
>  - improve changelogs

Applied to pci/dma for v4.16, thanks!


Re: [PATCH 3/4] tsi108_eth: use dma API properly

2018-01-17 Thread Bjorn Helgaas
[+cc David, FYI, I plan to merge this via PCI along with the rest of
Christoph's series]

On Wed, Jan 10, 2018 at 07:03:21PM +0100, Christoph Hellwig wrote:
> We need to pass a struct device to the dma API, even if some
> architectures still support that for legacy reasons, and should not mix
> it with the old PCI dma API.
> 
> Note that the driver also seems to never actually unmap its dma mappings,
> but to fix that we'll need someone more familar with the driver.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  drivers/net/ethernet/tundra/tsi108_eth.c | 36 
> ++--
>  1 file changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c 
> b/drivers/net/ethernet/tundra/tsi108_eth.c
> index 0624b71ab5d4..edcd1e60b30d 100644
> --- a/drivers/net/ethernet/tundra/tsi108_eth.c
> +++ b/drivers/net/ethernet/tundra/tsi108_eth.c
> @@ -152,6 +152,8 @@ struct tsi108_prv_data {
>   u32 msg_enable; /* debug message level */
>   struct mii_if_info mii_if;
>   unsigned int init_media;
> +
> + struct platform_device *pdev;
>  };
>  
>  /* Structure for a device driver */
> @@ -703,17 +705,18 @@ static int tsi108_send_packet(struct sk_buff * skb, 
> struct net_device *dev)
>   data->txskbs[tx] = skb;
>  
>   if (i == 0) {
> - data->txring[tx].buf0 = dma_map_single(NULL, skb->data,
> - skb_headlen(skb), DMA_TO_DEVICE);
> + data->txring[tx].buf0 = dma_map_single(>pdev->dev,
> + skb->data, skb_headlen(skb),
> + DMA_TO_DEVICE);
>   data->txring[tx].len = skb_headlen(skb);
>   misc |= TSI108_TX_SOF;
>   } else {
>   const skb_frag_t *frag = _shinfo(skb)->frags[i - 1];
>  
> - data->txring[tx].buf0 = skb_frag_dma_map(NULL, frag,
> -  0,
> -  
> skb_frag_size(frag),
> -  DMA_TO_DEVICE);
> + data->txring[tx].buf0 =
> + skb_frag_dma_map(>pdev->dev, frag,
> + 0, skb_frag_size(frag),
> + DMA_TO_DEVICE);
>   data->txring[tx].len = skb_frag_size(frag);
>   }
>  
> @@ -808,9 +811,9 @@ static int tsi108_refill_rx(struct net_device *dev, int 
> budget)
>   if (!skb)
>   break;
>  
> - data->rxring[rx].buf0 = dma_map_single(NULL, skb->data,
> - TSI108_RX_SKB_SIZE,
> - DMA_FROM_DEVICE);
> + data->rxring[rx].buf0 = dma_map_single(>pdev->dev,
> + skb->data, TSI108_RX_SKB_SIZE,
> + DMA_FROM_DEVICE);
>  
>   /* Sometimes the hardware sets blen to zero after packet
>* reception, even though the manual says that it's only ever
> @@ -1308,15 +1311,15 @@ static int tsi108_open(struct net_device *dev)
>  data->id, dev->irq, dev->name);
>   }
>  
> - data->rxring = dma_zalloc_coherent(NULL, rxring_size, >rxdma,
> -GFP_KERNEL);
> + data->rxring = dma_zalloc_coherent(>pdev->dev, rxring_size,
> + >rxdma, GFP_KERNEL);
>   if (!data->rxring)
>   return -ENOMEM;
>  
> - data->txring = dma_zalloc_coherent(NULL, txring_size, >txdma,
> -GFP_KERNEL);
> + data->txring = dma_zalloc_coherent(>pdev->dev, txring_size,
> + >txdma, GFP_KERNEL);
>   if (!data->txring) {
> - pci_free_consistent(NULL, rxring_size, data->rxring,
> + dma_free_coherent(>pdev->dev, rxring_size, data->rxring,
>   data->rxdma);
>   return -ENOMEM;
>   }
> @@ -1428,10 +1431,10 @@ static int tsi108_close(struct net_device *dev)
>   dev_kfree_skb(skb);
>   }
>  
> - dma_free_coherent(0,
> + dma_free_coherent(>pdev->dev,
>   TSI108_RXRING_LEN * sizeof(rx_desc),
>   data->rxring, data->rxdma);
> - dma_free_coherent(0,
> + dma_free_coherent(>pdev->dev,
>   TSI108_TXRING_LEN * sizeof(tx_desc),
>   data->txring, data->txdma);
>  
> @@ -1576,6 +1579,7 @@ tsi108_init_one(struct platform_device *pdev)
>   printk("tsi108_eth%d: probe...\n", pdev->id);
>   data = netdev_priv(dev);
>   data->dev = dev;
> + data->pdev = pdev;
>  
>   

Re: [PATCH 3/3] pci-dma-compat: remove handling of NULL pdev arguments

2018-01-09 Thread Bjorn Helgaas
s/pci-dma-compat: remove handling of NULL pdev
 /PCI: Remove NULL device handling from DMA API/

On Tue, Jan 09, 2018 at 09:39:39PM +0100, Christoph Hellwig wrote:
> Historically some ISA drivers used the old pci DMA API with a NULL pdev
> argument, but these days this isn't used and not too useful due to the
> per-device DMA ops, so remove it.

s/pci/PCI/

I like this a lot, thanks!

It looks like "pci_free_consistent(NULL" is still used in
drivers/net/ethernet/tundra/tsi108_eth.c.

> Signed-off-by: Christoph Hellwig 

With Mauro's ack on the media/ttusb-dev patches, I could merge the
whole series via the PCI tree?

> ---
>  include/linux/pci-dma-compat.h | 27 +--
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h
> index d1f9fdade1e0..0dd1a3f7b309 100644
> --- a/include/linux/pci-dma-compat.h
> +++ b/include/linux/pci-dma-compat.h
> @@ -17,91 +17,90 @@ static inline void *
>  pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
>dma_addr_t *dma_handle)
>  {
> - return dma_alloc_coherent(hwdev == NULL ? NULL : >dev, size, 
> dma_handle, GFP_ATOMIC);
> + return dma_alloc_coherent(>dev, size, dma_handle, GFP_ATOMIC);
>  }
>  
>  static inline void *
>  pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
> dma_addr_t *dma_handle)
>  {
> - return dma_zalloc_coherent(hwdev == NULL ? NULL : >dev,
> -size, dma_handle, GFP_ATOMIC);
> + return dma_zalloc_coherent(>dev, size, dma_handle, GFP_ATOMIC);
>  }
>  
>  static inline void
>  pci_free_consistent(struct pci_dev *hwdev, size_t size,
>   void *vaddr, dma_addr_t dma_handle)
>  {
> - dma_free_coherent(hwdev == NULL ? NULL : >dev, size, vaddr, 
> dma_handle);
> + dma_free_coherent(>dev, size, vaddr, dma_handle);
>  }
>  
>  static inline dma_addr_t
>  pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
>  {
> - return dma_map_single(hwdev == NULL ? NULL : >dev, ptr, size, 
> (enum dma_data_direction)direction);
> + return dma_map_single(>dev, ptr, size, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline void
>  pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
>size_t size, int direction)
>  {
> - dma_unmap_single(hwdev == NULL ? NULL : >dev, dma_addr, size, 
> (enum dma_data_direction)direction);
> + dma_unmap_single(>dev, dma_addr, size, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline dma_addr_t
>  pci_map_page(struct pci_dev *hwdev, struct page *page,
>unsigned long offset, size_t size, int direction)
>  {
> - return dma_map_page(hwdev == NULL ? NULL : >dev, page, offset, 
> size, (enum dma_data_direction)direction);
> + return dma_map_page(>dev, page, offset, size, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline void
>  pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
>  size_t size, int direction)
>  {
> - dma_unmap_page(hwdev == NULL ? NULL : >dev, dma_address, size, 
> (enum dma_data_direction)direction);
> + dma_unmap_page(>dev, dma_address, size, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline int
>  pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
>  int nents, int direction)
>  {
> - return dma_map_sg(hwdev == NULL ? NULL : >dev, sg, nents, (enum 
> dma_data_direction)direction);
> + return dma_map_sg(>dev, sg, nents, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline void
>  pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
>int nents, int direction)
>  {
> - dma_unmap_sg(hwdev == NULL ? NULL : >dev, sg, nents, (enum 
> dma_data_direction)direction);
> + dma_unmap_sg(>dev, sg, nents, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline void
>  pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
>   size_t size, int direction)
>  {
> - dma_sync_single_for_cpu(hwdev == NULL ? NULL : >dev, dma_handle, 
> size, (enum dma_data_direction)direction);
> + dma_sync_single_for_cpu(>dev, dma_handle, size, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline void
>  pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
>   size_t size, int direction)
>  {
> - dma_sync_single_for_device(hwdev == NULL ? NULL : >dev, 
> dma_handle, size, (enum dma_data_direction)direction);
> + dma_sync_single_for_device(>dev, dma_handle, size, (enum 
> dma_data_direction)direction);
>  }
>  
>  static inline void
>  pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
>   int nelems, int direction)
>  {
> - dma_sync_sg_for_cpu(hwdev == NULL ? NULL : >dev, sg, nelems, 
> (enum dma_data_direction)direction);
> + 

Re: [PATCH 1/3] media/ttusb-budget: remove pci_zalloc_coherent abuse

2018-01-09 Thread Bjorn Helgaas
On Tue, Jan 09, 2018 at 09:39:37PM +0100, Christoph Hellwig wrote:
> Switch to a plain kzalloc instea of pci_zalloc_coherent to allocate
> memory for the USB DMA.

s/instea/instead/

> 
> Signed-off-by: Christoph Hellwig 
> ---
>  drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c 
> b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
> index a142b9dc0feb..b8619fb23351 100644
> --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
> +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
> @@ -102,7 +102,6 @@ struct ttusb {
>   unsigned int isoc_in_pipe;
>  
>   void *iso_buffer;
> - dma_addr_t iso_dma_handle;
>  
>   struct urb *iso_urb[ISO_BUF_COUNT];
>  
> @@ -792,21 +791,15 @@ static void ttusb_free_iso_urbs(struct ttusb *ttusb)
>  
>   for (i = 0; i < ISO_BUF_COUNT; i++)
>   usb_free_urb(ttusb->iso_urb[i]);
> -
> - pci_free_consistent(NULL,
> - ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF *
> - ISO_BUF_COUNT, ttusb->iso_buffer,
> - ttusb->iso_dma_handle);
> + kfree(ttusb->iso_buffer);
>  }
>  
>  static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
>  {
>   int i;
>  
> - ttusb->iso_buffer = pci_zalloc_consistent(NULL,
> -   ISO_FRAME_SIZE * 
> FRAMES_PER_ISO_BUF * ISO_BUF_COUNT,
> -   >iso_dma_handle);
> -
> + ttusb->iso_buffer = kzalloc(ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF *
> + ISO_BUF_COUNT, GFP_KERNEL);
>   if (!ttusb->iso_buffer) {
>   dprintk("%s: pci_alloc_consistent - not enough memory\n",
>   __func__);
> -- 
> 2.14.2
> 


[PATCH] [media] netup_unidvb: use PCI_EXP_DEVCTL2_COMP_TIMEOUT macro

2017-12-15 Thread Bjorn Helgaas
From: Bjorn Helgaas <bhelg...@google.com>

Use the existing PCI_EXP_DEVCTL2_COMP_TIMEOUT macro instead of hard-coding
the PCIe Completion Timeout Value mask.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelg...@google.com>
---
 drivers/media/pci/netup_unidvb/netup_unidvb_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c 
b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
index 11829c0fa138..6cf88a0bf458 100644
--- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
+++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
@@ -862,7 +862,7 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
PCI_EXP_DEVCTL_NOSNOOP_EN, 0);
/* Adjust PCIe completion timeout. */
pcie_capability_clear_and_set_word(pci_dev,
-   PCI_EXP_DEVCTL2, 0xf, 0x2);
+   PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_COMP_TIMEOUT, 0x2);
 
if (netup_unidvb_request_mmio(pci_dev)) {
dev_err(_dev->dev,



Re: [PATCH 08/15] PCI: make device_type const

2017-08-24 Thread Bjorn Helgaas
On Sat, Aug 19, 2017 at 01:52:19PM +0530, Bhumika Goyal wrote:
> Make this const as it is only stored in the type field of a device
> structure, which is const.
> Done using Coccinelle.
> 
> Signed-off-by: Bhumika Goyal 

Applied to pci/misc for v4.14, thanks!

> ---
>  drivers/pci/endpoint/pci-epf-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/endpoint/pci-epf-core.c 
> b/drivers/pci/endpoint/pci-epf-core.c
> index 6877d6a..9d0de12 100644
> --- a/drivers/pci/endpoint/pci-epf-core.c
> +++ b/drivers/pci/endpoint/pci-epf-core.c
> @@ -27,7 +27,7 @@
>  #include 
>  
>  static struct bus_type pci_epf_bus_type;
> -static struct device_type pci_epf_type;
> +static const struct device_type pci_epf_type;
>  
>  /**
>   * pci_epf_linkup() - Notify the function driver that EPC device has
> @@ -275,7 +275,7 @@ static void pci_epf_dev_release(struct device *dev)
>   kfree(epf);
>  }
>  
> -static struct device_type pci_epf_type = {
> +static const struct device_type pci_epf_type = {
>   .release= pci_epf_dev_release,
>  };
>  
> -- 
> 1.9.1
> 


Re: [PATCH 9/9] kernel-api.rst: fix a series of errors when parsing C files

2017-03-30 Thread Bjorn Helgaas
On Thu, Mar 30, 2017 at 05:11:36PM -0300, Mauro Carvalho Chehab wrote:
> ./lib/string.c:134: WARNING: Inline emphasis start-string without end-string.
> ./mm/filemap.c:522: WARNING: Inline interpreted text or phrase reference 
> start-string without end-string.
> ./mm/filemap.c:1283: ERROR: Unexpected indentation.
> ./mm/filemap.c:3003: WARNING: Inline interpreted text or phrase reference 
> start-string without end-string.
> ./mm/vmalloc.c:1544: WARNING: Inline emphasis start-string without end-string.
> ./mm/page_alloc.c:4245: ERROR: Unexpected indentation.
> ./ipc/util.c:676: ERROR: Unexpected indentation.
> ./drivers/pci/irq.c:35: WARNING: Block quote ends without a blank line; 
> unexpected unindent.
> ./security/security.c:109: ERROR: Unexpected indentation.
> ./security/security.c:110: WARNING: Definition list ends without a blank 
> line; unexpected unindent.
> ./block/genhd.c:275: WARNING: Inline strong start-string without end-string.
> ./block/genhd.c:283: WARNING: Inline strong start-string without end-string.
> ./include/linux/clk.h:134: WARNING: Inline emphasis start-string without 
> end-string.
> ./include/linux/clk.h:134: WARNING: Inline emphasis start-string without 
> end-string.
> ./ipc/util.c:477: ERROR: Unknown target name: "s".
> 
> Signed-off-by: Mauro Carvalho Chehab <mche...@s-opensource.com>

Acked-by: Bjorn Helgaas <bhelg...@google.com>   # for drivers/pci/irq.c

> diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c
> index 6684f153ab57..f9f2a0324ecc 100644
> --- a/drivers/pci/irq.c
> +++ b/drivers/pci/irq.c
> @@ -31,7 +31,7 @@ static void pci_note_irq_problem(struct pci_dev *pdev, 
> const char *reason)
>   * driver).
>   *
>   * Returns:
> - *  a suggestion for fixing it (although the driver is not required to
> + * a suggestion for fixing it (although the driver is not required to
>   * act on this).
>   */
>  enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)


Re: [PATCH v2] pci: drop link_reset

2017-02-09 Thread Bjorn Helgaas
On Tue, Jan 24, 2017 at 07:35:56PM +0200, Michael S. Tsirkin wrote:
> No hardware seems to actually call link_reset, and
> no driver implements it as more than a nop stub.
> 
> This drops the mentions of the callback from everywhere.
> It's dropped from the documentation as well, but
> the doc really needs to be updated to reflect
> reality better (e.g. on pcie slot reset is the link reset).
> 
> This will be done in a later patch.
> 
> Signed-off-by: Michael S. Tsirkin 

Applied to pci/aer for v4.11, thanks.

> ---
> 
> changes from v2:
>   - drop from genwqe as well
> 
> Note: Doug has patches dropping the implementation from infiniband card
> drivers in his tree already. This is unlikely to cause conflicts though.
> 
>  Documentation/PCI/pci-error-recovery.txt | 24 +++-
>  drivers/infiniband/hw/hfi1/pcie.c| 10 --
>  drivers/infiniband/hw/qib/qib_pcie.c |  8 
>  drivers/media/pci/ngene/ngene-cards.c|  7 ---
>  drivers/misc/genwqe/card_base.c  |  1 -
>  include/linux/pci.h  |  3 ---
>  6 files changed, 3 insertions(+), 50 deletions(-)
> 
> diff --git a/Documentation/PCI/pci-error-recovery.txt 
> b/Documentation/PCI/pci-error-recovery.txt
> index ac26869..da3b217 100644
> --- a/Documentation/PCI/pci-error-recovery.txt
> +++ b/Documentation/PCI/pci-error-recovery.txt
> @@ -78,7 +78,6 @@ struct pci_error_handlers
>  {
>   int (*error_detected)(struct pci_dev *dev, enum pci_channel_state);
>   int (*mmio_enabled)(struct pci_dev *dev);
> - int (*link_reset)(struct pci_dev *dev);
>   int (*slot_reset)(struct pci_dev *dev);
>   void (*resume)(struct pci_dev *dev);
>  };
> @@ -104,8 +103,7 @@ if it implements any, it must implement error_detected(). 
> If a callback
>  is not implemented, the corresponding feature is considered unsupported.
>  For example, if mmio_enabled() and resume() aren't there, then it
>  is assumed that the driver is not doing any direct recovery and requires
> -a slot reset. If link_reset() is not implemented, the card is assumed to
> -not care about link resets. Typically a driver will want to know about
> +a slot reset.  Typically a driver will want to know about
>  a slot_reset().
>  
>  The actual steps taken by a platform to recover from a PCI error
> @@ -232,25 +230,9 @@ proceeds to STEP 4 (Slot Reset)
>  
>  STEP 3: Link Reset
>  --
> -The platform resets the link, and then calls the link_reset() callback
> -on all affected device drivers.  This is a PCI-Express specific state
> +The platform resets the link.  This is a PCI-Express specific step
>  and is done whenever a non-fatal error has been detected that can be
> -"solved" by resetting the link. This call informs the driver of the
> -reset and the driver should check to see if the device appears to be
> -in working condition.
> -
> -The driver is not supposed to restart normal driver I/O operations
> -at this point.  It should limit itself to "probing" the device to
> -check its recoverability status. If all is right, then the platform
> -will call resume() once all drivers have ack'd link_reset().
> -
> - Result codes:
> - (identical to STEP 3 (MMIO Enabled)
> -
> -The platform then proceeds to either STEP 4 (Slot Reset) or STEP 5
> -(Resume Operations).
> -
> ->>> The current powerpc implementation does not implement this callback.
> +"solved" by resetting the link.
>  
>  STEP 4: Slot Reset
>  --
> diff --git a/drivers/infiniband/hw/hfi1/pcie.c 
> b/drivers/infiniband/hw/hfi1/pcie.c
> index 4ac8f33..ebd941f 100644
> --- a/drivers/infiniband/hw/hfi1/pcie.c
> +++ b/drivers/infiniband/hw/hfi1/pcie.c
> @@ -598,15 +598,6 @@ pci_slot_reset(struct pci_dev *pdev)
>   return PCI_ERS_RESULT_CAN_RECOVER;
>  }
>  
> -static pci_ers_result_t
> -pci_link_reset(struct pci_dev *pdev)
> -{
> - struct hfi1_devdata *dd = pci_get_drvdata(pdev);
> -
> - dd_dev_info(dd, "HFI1 link_reset function called, ignored\n");
> - return PCI_ERS_RESULT_CAN_RECOVER;
> -}
> -
>  static void
>  pci_resume(struct pci_dev *pdev)
>  {
> @@ -625,7 +616,6 @@ pci_resume(struct pci_dev *pdev)
>  const struct pci_error_handlers hfi1_pci_err_handler = {
>   .error_detected = pci_error_detected,
>   .mmio_enabled = pci_mmio_enabled,
> - .link_reset = pci_link_reset,
>   .slot_reset = pci_slot_reset,
>   .resume = pci_resume,
>  };
> diff --git a/drivers/infiniband/hw/qib/qib_pcie.c 
> b/drivers/infiniband/hw/qib/qib_pcie.c
> index 6abe1c6..c379b83 100644
> --- a/drivers/infiniband/hw/qib/qib_pcie.c
> +++ b/drivers/infiniband/hw/qib/qib_pcie.c
> @@ -682,13 +682,6 @@ qib_pci_slot_reset(struct pci_dev *pdev)
>   return PCI_ERS_RESULT_CAN_RECOVER;
>  }
>  
> -static pci_ers_result_t
> -qib_pci_link_reset(struct pci_dev *pdev)
> -{
> - qib_devinfo(pdev, "QIB link_reset function called, ignored\n");
> - return PCI_ERS_RESULT_CAN_RECOVER;
> -}
> -
>  static 

Re: kill off pci_enable_msi_{exact,range}

2017-01-13 Thread Bjorn Helgaas
On Fri, Jan 13, 2017 at 09:05:53AM +0100, Christoph Hellwig wrote:
> On Fri, Jan 13, 2017 at 08:55:03AM +0100, Christoph Hellwig wrote:
> > On Thu, Jan 12, 2017 at 03:29:00PM -0600, Bjorn Helgaas wrote:
> > > Applied all three (with Tom's ack on the amd-xgbe patch) to pci/msi for
> > > v4.11, thanks!
> > 
> > Tom had just send me an event better version of the xgbe patch.  Tom,
> > maybe you can resend that relative to the PCI tree [1], so that we don't
> > lose it for next merge window?
> 
> Actually - Bjorn, your msi branch contains an empty commit from this
> thread:
> 
>   
> https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?h=pci/msi=7a8191de43faa9869b421a1b06075d8126ce7c0b

Yep, I botched that.  Thought I'd fixed it, but guess I got distracted.

> Maybe we should rebase it after all to avoid that?  In that case please
> pick up the xgbe patch from Tom below:

I dropped the empty commit and replaced the xgbe patch with the one below.
Can you take a look at [1] and make sure it's what you expected?

[1] https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/log/?h=pci/msi

Thanks!

> ---
> From: Tom Lendacky <thomas.lenda...@amd.com>
> Subject: [PATCH] amd-xgbe: Update PCI support to use new IRQ functions
> 
> Some of the PCI MSI/MSI-X functions have been deprecated and it is
> recommended to use the new pci_alloc_irq_vectors() function. Convert
> the code over to use the new function. Also, modify the way in which
> the IRQs are requested - try for multiple MSI-X/MSI first, then a
> single MSI/legacy interrupt.
> 
> Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com>
> Signed-off-by: Christoph Hellwig <h...@lst.de>
> ---
>  drivers/net/ethernet/amd/xgbe/xgbe-pci.c |  128 
> +-
>  drivers/net/ethernet/amd/xgbe/xgbe.h |8 +-
>  2 files changed, 41 insertions(+), 95 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c 
> b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c
> index e76b7f6..e436902 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c
> @@ -122,104 +122,40 @@
>  #include "xgbe.h"
>  #include "xgbe-common.h"
>  
> -static int xgbe_config_msi(struct xgbe_prv_data *pdata)
> +static int xgbe_config_multi_msi(struct xgbe_prv_data *pdata)
>  {
> - unsigned int msi_count;
> + unsigned int vector_count;
>   unsigned int i, j;
>   int ret;
>  
> - msi_count = XGBE_MSIX_BASE_COUNT;
> - msi_count += max(pdata->rx_ring_count,
> -  pdata->tx_ring_count);
> - msi_count = roundup_pow_of_two(msi_count);
> + vector_count = XGBE_MSI_BASE_COUNT;
> + vector_count += max(pdata->rx_ring_count,
> + pdata->tx_ring_count);
>  
> - ret = pci_enable_msi_exact(pdata->pcidev, msi_count);
> + ret = pci_alloc_irq_vectors(pdata->pcidev, XGBE_MSI_MIN_COUNT,
> + vector_count, PCI_IRQ_MSI | PCI_IRQ_MSIX);
>   if (ret < 0) {
> - dev_info(pdata->dev, "MSI request for %u interrupts failed\n",
> -  msi_count);
> -
> - ret = pci_enable_msi(pdata->pcidev);
> - if (ret < 0) {
> - dev_info(pdata->dev, "MSI enablement failed\n");
> - return ret;
> - }
> -
> - msi_count = 1;
> - }
> -
> - pdata->irq_count = msi_count;
> -
> - pdata->dev_irq = pdata->pcidev->irq;
> -
> - if (msi_count > 1) {
> - pdata->ecc_irq = pdata->pcidev->irq + 1;
> - pdata->i2c_irq = pdata->pcidev->irq + 2;
> - pdata->an_irq = pdata->pcidev->irq + 3;
> -
> - for (i = XGBE_MSIX_BASE_COUNT, j = 0;
> -  (i < msi_count) && (j < XGBE_MAX_DMA_CHANNELS);
> -  i++, j++)
> - pdata->channel_irq[j] = pdata->pcidev->irq + i;
> - pdata->channel_irq_count = j;
> -
> - pdata->per_channel_irq = 1;
> - pdata->channel_irq_mode = XGBE_IRQ_MODE_LEVEL;
> - } else {
> - pdata->ecc_irq = pdata->pcidev->irq;
> - pdata->i2c_irq = pdata->pcidev->irq;
> - pdata->an_irq = pdata->pcidev->irq;
> - }
> -
> - if (netif_msg_probe(pdata))
> - dev_dbg(pdata->dev, "MSI interrupts enabled\n");
> -
> - return 0;
> -}
> -
> -static int xgbe_config_msix(struct xgbe_

Re: kill off pci_enable_msi_{exact,range}

2017-01-12 Thread Bjorn Helgaas
On Mon, Jan 09, 2017 at 09:37:37PM +0100, Christoph Hellwig wrote:
> I had hope that we could kill these old interfaces of for 4.10-rc,
> but as of today Linus tree still has two users:
> 
>  (1) the cobalt media driver, for which I sent a patch long time ago,
>  it got missed in the merge window.
>  (2) the new xgbe driver was merged in 4.10-rc but used the old interfaces
>  anyway
> 
> This series resend the patch for (1) and adds a new one for (2), as well
> as having the final removal patch behind it.  Maybe we should just queue
> up all three together in the PCI tree for 4.11?

Applied all three (with Tom's ack on the amd-xgbe patch) to pci/msi for
v4.11, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fwd: [Bug 98541] New: there exists a wrong return value of function meye_probe()

2015-05-18 Thread Bjorn Helgaas
-- Forwarded message --
From:  bugzilla-dae...@bugzilla.kernel.org
Date: Mon, May 18, 2015 at 3:19 AM
Subject: [Bug 98541] New: there exists a wrong return value of
function meye_probe()
To: bhelg...@google.com


https://bugzilla.kernel.org/show_bug.cgi?id=98541

Bug ID: 98541
   Summary: there exists a wrong return value of function
meye_probe()
   Product: Drivers
   Version: 2.5
Kernel Version: 3.19.1
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: PCI
  Assignee: drivers_...@kernel-bugs.osdl.org
  Reporter: rucsoft...@gmail.com
Regression: No

In function meye_probe() at drivers/media/pci/meye/meye.c:1592, the call to
video_register_device() in line 1748 may return a negative error code, and thus
function meye_probe() will return the value of variable ret. And, the function
meye_probe() will return 0 at last when it runs well. However, when the call to
video_register_device() in line 1748 return a negative error code, the value of
ret is 0. So the function meye_probe() will return 0 to its caller functions
when it runs error because of the failing call to video_register_device(),
leading to a wrong return value of function meye_probe().
The related code snippets in meye_probe() is as following.
meye_probe @@ drivers/media/pci/meye/meye.c:1592
1592static int meye_probe(struct pci_dev *pcidev, const struct pci_device_id
*ent)
1593{
...
1672if ((ret = pci_enable_device(meye.mchip_dev))) {
1673v4l2_err(v4l2_dev, meye: pci_enable_device failed\n);
1674goto outenabledev;
1675}
...
1748if (video_register_device(meye.vdev, VFL_TYPE_GRABBER,
1749  video_nr)  0) {
1750v4l2_err(v4l2_dev, video_register_device failed\n);
1751goto outvideoreg;
1752}
...
1761outvideoreg:
...
1781outnotdev:
1782return ret;
1783}

Generally, when the call to video_register_device() fails, the return value of
caller functions should be different from another return value set when the
call to video_register_device() succeeds, like the following codes in another
file.
cx8800_initdev @@ drivers/media/pci/cx88/cx88-video.c:1300
1300static int cx8800_initdev(struct pci_dev *pci_dev,
1301  const struct pci_device_id *pci_id)
1302{
...
1493err = video_register_device(dev-video_dev,VFL_TYPE_GRABBER,
1494video_nr[core-nr]);
1495if (err  0) {
1496printk(KERN_ERR %s/0: can't register video device\n,
1497   core-name);
1498goto fail_unreg;
1499}
...
1545fail_unreg:
1546cx8800_unregister_video(dev);
1547free_irq(pci_dev-irq, dev);
1548mutex_unlock(core-lock);
1549fail_core:
1550vb2_dma_sg_cleanup_ctx(dev-alloc_ctx);
1551core-v4ldev = NULL;
1552cx88_core_put(core,dev-pci);
1553fail_free:
1554kfree(dev);
1555return err;
1556}

Thank you

RUC_Soft_Sec

--
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Documentation/dma-buf-sharing.txt: update API descriptions

2014-05-20 Thread Bjorn Helgaas
On Wed, May 14, 2014 at 08:49:43AM +0900, Gioh Kim wrote:
 Update some descriptions for API arguments and descriptions.
 
 Signed-off-by: Gioh Kim gioh@lge.com

I applied this to my dma-api branch for v3.16, thanks!

 ---
  Documentation/dma-buf-sharing.txt |   14 --
  1 file changed, 8 insertions(+), 6 deletions(-)
 
 diff --git a/Documentation/dma-buf-sharing.txt 
 b/Documentation/dma-buf-sharing.txt
 index 505e711..aadd901 100644
 --- a/Documentation/dma-buf-sharing.txt
 +++ b/Documentation/dma-buf-sharing.txt
 @@ -56,10 +56,10 @@ The dma_buf buffer sharing API usage contains the 
 following steps:
size_t size, int flags,
const char *exp_name)
  
 -   If this succeeds, dma_buf_export allocates a dma_buf structure, and 
 returns a
 -   pointer to the same. It also associates an anonymous file with this 
 buffer,
 -   so it can be exported. On failure to allocate the dma_buf object, it 
 returns
 -   NULL.
 +   If this succeeds, dma_buf_export_named allocates a dma_buf structure, and
 +   returns a pointer to the same. It also associates an anonymous file with 
 this
 +   buffer, so it can be exported. On failure to allocate the dma_buf object,
 +   it returns NULL.
  
 'exp_name' is the name of exporter - to facilitate information while
 debugging.
 @@ -76,7 +76,7 @@ The dma_buf buffer sharing API usage contains the following 
 steps:
 drivers and/or processes.
  
 Interface:
 -  int dma_buf_fd(struct dma_buf *dmabuf)
 +  int dma_buf_fd(struct dma_buf *dmabuf, int flags)
  
 This API installs an fd for the anonymous file associated with this 
 buffer;
 returns either 'fd', or error.
 @@ -157,7 +157,9 @@ to request use of buffer for allocation.
 dma_buf-ops- indirection from the users of this interface.
  
 In struct dma_buf_ops, unmap_dma_buf is defined as
 -  void (*unmap_dma_buf)(struct dma_buf_attachment *, struct sg_table *);
 +  void (*unmap_dma_buf)(struct dma_buf_attachment *,
 +struct sg_table *,
 +enum dma_data_direction);
  
 unmap_dma_buf signifies the end-of-DMA for the attachment provided. Like
 map_dma_buf, this API also must be implemented by the exporter.
 -- 
 1.7.9.5
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Documentation/dma-buf-sharing.txt: update API descriptions

2014-05-20 Thread Bjorn Helgaas
On Tue, May 20, 2014 at 9:43 PM, Sumit Semwal sumit.sem...@linaro.org wrote:
 Hi Bjorn,

 On 21 May 2014 04:50, Bjorn Helgaas bhelg...@google.com wrote:
 On Wed, May 14, 2014 at 08:49:43AM +0900, Gioh Kim wrote:
 Update some descriptions for API arguments and descriptions.

 Signed-off-by: Gioh Kim gioh@lge.com

 I applied this to my dma-api branch for v3.16, thanks!
 As always, I would queue this up for my dma-buf pull request, along
 with other dma-buf changes.

OK, I dropped this one.

 ---
  Documentation/dma-buf-sharing.txt |   14 --
  1 file changed, 8 insertions(+), 6 deletions(-)

 diff --git a/Documentation/dma-buf-sharing.txt 
 b/Documentation/dma-buf-sharing.txt
 index 505e711..aadd901 100644
 --- a/Documentation/dma-buf-sharing.txt
 +++ b/Documentation/dma-buf-sharing.txt
 @@ -56,10 +56,10 @@ The dma_buf buffer sharing API usage contains the 
 following steps:
size_t size, int flags,
const char *exp_name)

 -   If this succeeds, dma_buf_export allocates a dma_buf structure, and 
 returns a
 -   pointer to the same. It also associates an anonymous file with this 
 buffer,
 -   so it can be exported. On failure to allocate the dma_buf object, it 
 returns
 -   NULL.
 +   If this succeeds, dma_buf_export_named allocates a dma_buf structure, 
 and
 +   returns a pointer to the same. It also associates an anonymous file 
 with this
 +   buffer, so it can be exported. On failure to allocate the dma_buf 
 object,
 +   it returns NULL.

 'exp_name' is the name of exporter - to facilitate information while
 debugging.
 @@ -76,7 +76,7 @@ The dma_buf buffer sharing API usage contains the 
 following steps:
 drivers and/or processes.

 Interface:
 -  int dma_buf_fd(struct dma_buf *dmabuf)
 +  int dma_buf_fd(struct dma_buf *dmabuf, int flags)

 This API installs an fd for the anonymous file associated with this 
 buffer;
 returns either 'fd', or error.
 @@ -157,7 +157,9 @@ to request use of buffer for allocation.
 dma_buf-ops- indirection from the users of this interface.

 In struct dma_buf_ops, unmap_dma_buf is defined as
 -  void (*unmap_dma_buf)(struct dma_buf_attachment *, struct sg_table 
 *);
 +  void (*unmap_dma_buf)(struct dma_buf_attachment *,
 +struct sg_table *,
 +enum dma_data_direction);

 unmap_dma_buf signifies the end-of-DMA for the attachment provided. Like
 map_dma_buf, this API also must be implemented by the exporter.
 --
 1.7.9.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/



 --
 Thanks and regards,

 Sumit Semwal
 Graphics Engineer - Graphics working group
 Linaro.org │ Open source software for ARM SoCs
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC]

2013-04-18 Thread Bjorn Helgaas
On Tue, Apr 16, 2013 at 12:26 PM, David Howells dhowe...@redhat.com wrote:
 Supply accessor functions to set attributes in proc_dir_entry structs.

 The following are supplied: proc_set_size() and proc_set_user().

 Signed-off-by: David Howells dhowe...@redhat.com
 cc: linuxppc-...@lists.ozlabs.org
 cc: linux-media@vger.kernel.org
 cc: net...@vger.kernel.org
 cc: linux-wirel...@vger.kernel.org
 cc: linux-...@vger.kernel.org
 cc: netfilter-de...@vger.kernel.org
 cc: alsa-de...@alsa-project.org
 ---

  arch/powerpc/kernel/proc_powerpc.c|2 +-
  arch/powerpc/platforms/pseries/reconfig.c |2 +-
  drivers/media/pci/ttpci/av7110_ir.c   |2 +-
  drivers/net/irda/vlsi_ir.c|2 +-
  drivers/net/wireless/airo.c   |   34 
 +
  drivers/pci/proc.c|2 +-

For the drivers/pci part:

Acked-by: Bjorn Helgaas bhelg...@google.com

  fs/proc/generic.c |   13 +++
  include/linux/proc_fs.h   |5 
  kernel/configs.c  |2 +-
  kernel/profile.c  |2 +-
  net/netfilter/xt_recent.c |3 +--
  sound/core/info.c |2 +-
  12 files changed, 38 insertions(+), 33 deletions(-)

 diff --git a/arch/powerpc/kernel/proc_powerpc.c 
 b/arch/powerpc/kernel/proc_powerpc.c
 index 41d8ee9..feb8580 100644
 --- a/arch/powerpc/kernel/proc_powerpc.c
 +++ b/arch/powerpc/kernel/proc_powerpc.c
 @@ -83,7 +83,7 @@ static int __init proc_ppc64_init(void)
page_map_fops, vdso_data);
 if (!pde)
 return 1;
 -   pde-size = PAGE_SIZE;
 +   proc_set_size(pde, PAGE_SIZE);

 return 0;
  }
 diff --git a/arch/powerpc/platforms/pseries/reconfig.c 
 b/arch/powerpc/platforms/pseries/reconfig.c
 index d6491bd..f93cdf5 100644
 --- a/arch/powerpc/platforms/pseries/reconfig.c
 +++ b/arch/powerpc/platforms/pseries/reconfig.c
 @@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void)

 ent = proc_create(powerpc/ofdt, S_IWUSR, NULL, ofdt_fops);
 if (ent)
 -   ent-size = 0;
 +   proc_set_size(ent, 0);

 return 0;
  }
 diff --git a/drivers/media/pci/ttpci/av7110_ir.c 
 b/drivers/media/pci/ttpci/av7110_ir.c
 index eb82286..0e763a7 100644
 --- a/drivers/media/pci/ttpci/av7110_ir.c
 +++ b/drivers/media/pci/ttpci/av7110_ir.c
 @@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110)
 if (av_cnt == 1) {
 e = proc_create(av7110_ir, S_IWUSR, NULL, 
 av7110_ir_proc_fops);
 if (e)
 -   e-size = 4 + 256 * sizeof(u16);
 +   proc_set_size(e, 4 + 256 * sizeof(u16));
 }

 tasklet_init(av7110-ir.ir_tasklet, av7110_emit_key, (unsigned long) 
 av7110-ir);
 diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
 index e22cd4e..5f47584 100644
 --- a/drivers/net/irda/vlsi_ir.c
 +++ b/drivers/net/irda/vlsi_ir.c
 @@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct 
 pci_device_id *id)
 IRDA_WARNING(%s: failed to create proc entry\n,
  __func__);
 } else {
 -   ent-size = 0;
 +   proc_set_size(ent, 0);
 }
 idev-proc_entry = ent;
 }
 diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
 index 66e398d..21d0233 100644
 --- a/drivers/net/wireless/airo.c
 +++ b/drivers/net/wireless/airo.c
 @@ -4507,73 +4507,63 @@ static int setup_proc_entry( struct net_device *dev,
 airo_entry);
 if (!apriv-proc_entry)
 goto fail;
 -   apriv-proc_entry-uid = proc_kuid;
 -   apriv-proc_entry-gid = proc_kgid;
 +   proc_set_user(apriv-proc_entry, proc_kuid, proc_kgid);

 /* Setup the StatsDelta */
 entry = proc_create_data(StatsDelta, S_IRUGO  proc_perm,
  apriv-proc_entry, proc_statsdelta_ops, 
 dev);
 if (!entry)
 goto fail_stats_delta;
 -   entry-uid = proc_kuid;
 -   entry-gid = proc_kgid;
 +   proc_set_user(entry, proc_kuid, proc_kgid);

 /* Setup the Stats */
 entry = proc_create_data(Stats, S_IRUGO  proc_perm,
  apriv-proc_entry, proc_stats_ops, dev);
 if (!entry)
 goto fail_stats;
 -   entry-uid = proc_kuid;
 -   entry-gid = proc_kgid;
 +   proc_set_user(entry, proc_kuid, proc_kgid);

 /* Setup the Status */
 entry = proc_create_data(Status, S_IRUGO  proc_perm,
  apriv-proc_entry, proc_status_ops, dev);
 if (!entry)
 goto fail_status;
 -   entry-uid = proc_kuid;
 -   entry-gid = proc_kgid;
 +   proc_set_user(entry

Re: PCI: make pci_restore_state return void

2010-12-02 Thread Bjorn Helgaas
On Tuesday, November 30, 2010 04:43:26 pm Jon Mason wrote:
 pci_restore_state only ever returns 0, thus there is no benefit in
 having it return any value.  Also, a large majority of the callers do
 not check the return code of pci_restore_state.  Make the
 pci_restore_state a void return and avoid the overhead.
 
 Signed-off-by: Jon Mason jon.ma...@exar.com

Looks reasonable to me, but doesn't appear to be a regression fix or
anything urgent that needs to be in .37, so I'll wait and let Jesse
handle this when he returns from vacation.  OK?

Bjorn

 ---
  drivers/media/video/cafe_ccic.c |4 +---
  drivers/net/myri10ge/myri10ge.c |4 +---
  drivers/net/sfc/falcon.c|   25 +
  drivers/net/skge.c  |4 +---
  drivers/net/sky2.c  |5 +
  drivers/net/wireless/rt2x00/rt2x00pci.c |4 ++--
  drivers/pci/pci-driver.c|3 ++-
  drivers/pci/pci.c   |7 ++-
  drivers/scsi/ipr.c  |8 +---
  drivers/scsi/pmcraid.c  |7 +--
  drivers/staging/sm7xx/smtcfb.c  |2 +-
  include/linux/pci.h |8 +++-
  sound/pci/cs5535audio/cs5535audio_pm.c  |7 +--
  13 files changed, 22 insertions(+), 66 deletions(-)
 
 diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
 index 2934770..3e653f3 100644
 --- a/drivers/media/video/cafe_ccic.c
 +++ b/drivers/media/video/cafe_ccic.c
 @@ -2186,9 +2186,7 @@ static int cafe_pci_resume(struct pci_dev *pdev)
   struct cafe_camera *cam = to_cam(v4l2_dev);
   int ret = 0;
  
 - ret = pci_restore_state(pdev);
 - if (ret)
 - return ret;
 + pci_restore_state(pdev);
   ret = pci_enable_device(pdev);
  
   if (ret) {
 diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
 index 8524cc4..d3c4a37 100644
 --- a/drivers/net/myri10ge/myri10ge.c
 +++ b/drivers/net/myri10ge/myri10ge.c
 @@ -3403,9 +3403,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
   return -EIO;
   }
  
 - status = pci_restore_state(pdev);
 - if (status)
 - return status;
 + pci_restore_state(pdev);
  
   status = pci_enable_device(pdev);
   if (status) {
 diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
 index 267019b..1763b9a 100644
 --- a/drivers/net/sfc/falcon.c
 +++ b/drivers/net/sfc/falcon.c
 @@ -1066,22 +1066,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum 
 reset_type method)
  
   /* Restore PCI configuration if needed */
   if (method == RESET_TYPE_WORLD) {
 - if (efx_nic_is_dual_func(efx)) {
 - rc = pci_restore_state(nic_data-pci_dev2);
 - if (rc) {
 - netif_err(efx, drv, efx-net_dev,
 -   failed to restore PCI config for 
 -   the secondary function\n);
 - goto fail3;
 - }
 - }
 - rc = pci_restore_state(efx-pci_dev);
 - if (rc) {
 - netif_err(efx, drv, efx-net_dev,
 -   failed to restore PCI config for the 
 -   primary function\n);
 - goto fail4;
 - }
 + if (efx_nic_is_dual_func(efx))
 + pci_restore_state(nic_data-pci_dev2);
 + pci_restore_state(efx-pci_dev);
   netif_dbg(efx, drv, efx-net_dev,
 successfully restored PCI config\n);
   }
 @@ -1092,7 +1079,7 @@ static int falcon_reset_hw(struct efx_nic *efx, enum 
 reset_type method)
   rc = -ETIMEDOUT;
   netif_err(efx, hw, efx-net_dev,
 timed out waiting for hardware reset\n);
 - goto fail5;
 + goto fail3;
   }
   netif_dbg(efx, hw, efx-net_dev, hardware reset complete\n);
  
 @@ -1100,11 +1087,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum 
 reset_type method)
  
   /* pci_save_state() and pci_restore_state() MUST be called in pairs */
  fail2:
 -fail3:
   pci_restore_state(efx-pci_dev);
  fail1:
 -fail4:
 -fail5:
 +fail3:
   return rc;
  }
  
 diff --git a/drivers/net/skge.c b/drivers/net/skge.c
 index 220e039..61553af 100644
 --- a/drivers/net/skge.c
 +++ b/drivers/net/skge.c
 @@ -4087,9 +4087,7 @@ static int skge_resume(struct pci_dev *pdev)
   if (err)
   goto out;
  
 - err = pci_restore_state(pdev);
 - if (err)
 - goto out;
 + pci_restore_state(pdev);
  
   err = skge_reset(hw);
   if (err)
 diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
 index d657708..be3aee7 100644
 --- a/drivers/net/sky2.c
 +++ b/drivers/net/sky2.c
 @@ -4969,10 +4969,7 @@ static int sky2_resume(struct