Skip to content

Commit 9c86dd2

Browse files
committed
fix: onHotSwap callback per-device - upgrade.
1 parent ace8238 commit 9c86dd2

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

pciApp/devLibPCI.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,6 @@ int devPCIDisableInterrupt(const epicsPCIDevice *dev);
451451
epicsShareFunc
452452
const char* devPCIDeviceClassToString(int classId);
453453

454-
/**
455-
* @brief Optional callback invoked on PCI device hot-swap.
456-
*
457-
* This function pointer may be set to a custom handler that will be called
458-
* when a PCI device is successfully reopened (e.g. after hot-swap).
459-
*
460-
* @param name Identifier or name of the reopened PCI device.
461-
*/
462-
epicsShareExtern void (*devPCIonHotSwapHook)(const char*);
463-
464454
#ifdef __cplusplus
465455
} /* extern "C" */
466456
#endif

pciApp/os/Linux/devLibPCIOSD.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ struct osdPCIDevice {
104104

105105
epicsMutexId devLock; /* guard access to isrs list */
106106

107+
//Optional callback invoked on PCI device hot-swap.
108+
void (*onHotSwap)(struct osdPCIDevice* dev);
109+
107110
ELLNODE node;
108111

109112
ELLLIST isrs; /* contains struct osdISR */
@@ -997,7 +1000,7 @@ void isrThread(void* arg)
9971000
epicsMutexMustLock(osd->devLock);
9981001
if (reopen_uio(osd) == 0) {
9991002
errlogPrintf("isrThread '%s': Successfully reopened UIO device\n", name);
1000-
if (devPCIonHotSwapHook) devPCIonHotSwapHook(name);
1003+
if (osd->onHotSwap) osd->onHotSwap(osd);
10011004
} else {
10021005
errlogPrintf("isrThread '%s': UIO reopen failed. Will retry.\n", name);
10031006
}

0 commit comments

Comments
 (0)