修改了platform_device.c

Signed-off-by: yinshuqing <yinshuqing@huawei.com>
This commit is contained in:
yinshuqing
2021-07-23 10:04:01 +08:00
parent 40c3db44be
commit 87fd7cec7f
2 changed files with 7 additions and 8 deletions
+5 -6
View File
@@ -38,7 +38,7 @@ static void PlatformDeviceOnLastPut(struct HdfSRef *sref)
device->ready = false;
DLIST_FOR_EACH_ENTRY_SAFE(pos, tmp, &device->notifiers, struct PlatformNotifierNode, node) {
if (pos!=NULL && pos->notifier != NULL && pos->notifier->handle != NULL) {
if (pos->notifier != NULL && pos->notifier->handle != NULL) {
pos->notifier->handle(device, PLAT_EVENT_DEAD, pos->notifier->data);
}
}
@@ -155,13 +155,12 @@ static void PlatformDeviceRemoveNotifier(struct PlatformDevice *device, struct P
DLIST_FOR_EACH_ENTRY_SAFE(pos, tmp, &device->notifiers, struct PlatformNotifierNode, node) {
if (pos->notifier != NULL) {
/* if notifier not set, we remove all the notifier nodes. */
if (notifier == NULL || notifier == pos->notifier) {
DListRemove(&pos->node);
OsalMemFree(pos);
}
if (notifier == pos->notifier) {
DListRemove(&pos->node);
OsalMemFree(pos);
break;
}else if (notifier == NULL) {
DListRemove(&pos->node);
OsalMemFree(pos);
}
}
}
@@ -78,7 +78,7 @@ int32_t PlatformManagerAddDevice(struct PlatformManager *manager, struct Platfor
(void)OsalSpinLock(&manager->spin);
DLIST_FOR_EACH_ENTRY(tmp, &manager->devices, struct PlatformDevice, node) {
if (tmp!=NULL && tmp->magic == device->magic) {
if (tmp != NULL && tmp->magic == device->magic) {
repeatId = true;
HDF_LOGE("PlatformManagerAddDevice: repeated magic:%u!", device->magic);
break;
@@ -130,7 +130,7 @@ struct PlatformDevice *PlatformManagerFindDevice(struct PlatformManager *manager
(void)OsalSpinLock(&manager->spin);
DLIST_FOR_EACH_ENTRY(tmp, &manager->devices, struct PlatformDevice, node) {
if (tmp!=NULL && match(tmp, data)) {
if (tmp != NULL && match(tmp, data)) {
pdevice = PlatformDeviceGet(tmp);
}
}