Luc Verhaegen has uploaded this change for review. ( https://review.coreboot.org/29082
Change subject: pci2: add a second device private called data ......................................................................
pci2: add a second device private called data
This needs to be dynamically allocated so it can be used to, for instance, save/restore register values.
Change-Id: I7927773a88439ca3828d694785e58a4cf2b7795c Signed-off-by: Luc Verhaegen libv@skynet.be --- M pcidev.c M programmer.h 2 files changed, 9 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/82/29082/1
diff --git a/pcidev.c b/pcidev.c index 7680e78..18ddb3b 100644 --- a/pcidev.c +++ b/pcidev.c @@ -547,10 +547,15 @@ free(device->sysfs_path); device->sysfs_path = NULL;
+ if (device->private_data) + msg_perr("%s: device "%s"still has private data attached!\n" + "Please report a bug at flashrom@flashrom.org\n", + device->name, __func__); + device->private = NULL; + free(device->name); device->name = NULL;
- device->private = NULL; free(device);
return 0; diff --git a/programmer.h b/programmer.h index 7ec4291..5f02c6e 100644 --- a/programmer.h +++ b/programmer.h @@ -871,7 +871,9 @@ volatile uint8_t *mmio; /* mapped io memory */ size_t mmio_size;
- const void *private; /* programmer specific hook */ + /* programmer specifics */ + const void *private; /* filled in from flashrom_pci_match */ + void *private_data; /* alloced and freed by programmer */
/* housekeeping */ bool enabled;