summaryrefslogtreecommitdiff
path: root/arch/s390
diff options
context:
space:
mode:
authorNiklas Schnelle <schnelle@linux.ibm.com>2020-08-21 11:16:48 +0200
committerVasily Gorbik <gor@linux.ibm.com>2020-09-14 11:38:35 +0200
commitc3b2c9064e76fa3952c99982f11a98e0327f3dbe (patch)
treee98a7a26a6dd7c6b65880d8a7cf7232f9902675e /arch/s390
parent809fcfaf9238052f03e8002f6dad156a7fb6cd5e (diff)
s390/pci: remove clp_rescan_pci_devices_simple()
clp_rescan_pci_devices_simple() is neither simpler than clp_scan_pci_devices() nor does it really scan PCI devices, in particular it will neither add newly discovered devices nor remove those which disappeared. Instead it only refreshes PCI function handles and also has just a single callsite in the same translation unit left which in fact only refreshes one specific function handle identified by a FID. Clarify this by renaming the function and its helper to clp_refresh_fh() respectvely __clp_refresh_fh() and make it take a fid directly which saves us dealing with the NULL case which updated all function handles but is not used anymore. Furthermore since the only callsite is in the same translation unit make it static. Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/pci.h1
-rw-r--r--arch/s390/pci/pci_clp.c44
2 files changed, 21 insertions, 24 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 430f694163c1..178a24e0af5f 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -210,7 +210,6 @@ void zpci_remove_reserved_devices(void);
/* CLP */
int clp_setup_writeback_mio(void);
int clp_scan_pci_devices(void);
-int clp_rescan_pci_devices_simple(u32 *fid);
int clp_add_pci_device(u32, u32, int);
int clp_enable_fh(struct zpci_dev *, u8);
int clp_disable_fh(struct zpci_dev *);
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index 6aabfb131c1e..5a34a1359dc5 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -244,6 +244,7 @@ error:
return rc;
}
+static int clp_refresh_fh(u32 fid);
/*
* Enable/Disable a given PCI function and update its function handle if
* necessary
@@ -286,7 +287,7 @@ static int clp_set_pci_fn(struct zpci_dev *zdev, u8 nr_dma_as, u8 command)
} else if (!rc && rrb->response.hdr.rsp == CLP_RC_SETPCIFN_ALRDY &&
rrb->response.fh == 0) {
/* Function is already in desired state - update handle */
- rc = clp_rescan_pci_devices_simple(&fid);
+ rc = clp_refresh_fh(fid);
}
clp_free_block(rrb);
return rc;
@@ -408,24 +409,6 @@ static void __clp_add(struct clp_fh_list_entry *entry, void *data)
clp_add_pci_device(entry->fid, entry->fh, entry->config_state);
}
-static void __clp_update(struct clp_fh_list_entry *entry, void *data)
-{
- struct zpci_dev *zdev;
- u32 *fid = data;
-
- if (!entry->vendor_id)
- return;
-
- if (fid && *fid != entry->fid)
- return;
-
- zdev = get_zdev_by_fid(entry->fid);
- if (!zdev)
- return;
-
- zdev->fh = entry->fh;
-}
-
int clp_scan_pci_devices(void)
{
struct clp_req_rsp_list_pci *rrb;
@@ -441,10 +424,25 @@ int clp_scan_pci_devices(void)
return rc;
}
-/* Rescan PCI functions and refresh function handles. If fid is non-NULL only
- * refresh the handle of the function matching @fid
+static void __clp_refresh_fh(struct clp_fh_list_entry *entry, void *data)
+{
+ struct zpci_dev *zdev;
+ u32 fid = *((u32 *)data);
+
+ if (!entry->vendor_id || fid != entry->fid)
+ return;
+
+ zdev = get_zdev_by_fid(fid);
+ if (!zdev)
+ return;
+
+ zdev->fh = entry->fh;
+}
+
+/*
+ * Refresh the function handle of the function matching @fid
*/
-int clp_rescan_pci_devices_simple(u32 *fid)
+static int clp_refresh_fh(u32 fid)
{
struct clp_req_rsp_list_pci *rrb;
int rc;
@@ -453,7 +451,7 @@ int clp_rescan_pci_devices_simple(u32 *fid)
if (!rrb)
return -ENOMEM;
- rc = clp_list_pci(rrb, fid, __clp_update);
+ rc = clp_list_pci(rrb, &fid, __clp_refresh_fh);
clp_free_block(rrb);
return rc;