Skip to content

Commit b277eef

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

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
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 & 3 deletions
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 (*onHotSwapHook)(struct osdPCIDevice* dev);
109+
107110
ELLNODE node;
108111

109112
ELLLIST isrs; /* contains struct osdISR */
@@ -944,8 +947,6 @@ static int reopen_uio(struct osdPCIDevice *osd)
944947
return 0;
945948
}
946949

947-
epicsShareDef void (*devPCIonHotSwapHook)(const char* name) = NULL;
948-
949950
static
950951
void isrThread(void* arg)
951952
{
@@ -997,7 +998,7 @@ void isrThread(void* arg)
997998
epicsMutexMustLock(osd->devLock);
998999
if (reopen_uio(osd) == 0) {
9991000
errlogPrintf("isrThread '%s': Successfully reopened UIO device\n", name);
1000-
if (devPCIonHotSwapHook) devPCIonHotSwapHook(name);
1001+
if (osd->onHotSwapHook) osd->onHotSwapHook(osd);
10011002
} else {
10021003
errlogPrintf("isrThread '%s': UIO reopen failed. Will retry.\n", name);
10031004
}

0 commit comments

Comments
 (0)