summaryrefslogtreecommitdiffstats
path: root/pcidev.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-07-03 11:02:10 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-07-03 11:02:10 +0000
commitad3cc55e139b2e239325815464fe5f7d828aa794 (patch)
tree46568cf766d19740418be5ca8eaa494c7e69cc36 /pcidev.c
parentb63b067ae22803689592db482611093b33a29eef (diff)
downloadast2050-flashrom-ad3cc55e139b2e239325815464fe5f7d828aa794.zip
ast2050-flashrom-ad3cc55e139b2e239325815464fe5f7d828aa794.tar.gz
Kill global variables, constants and functions if local scope suffices
Constify variables where possible. Initialize programmer-related variables explicitly in programmer_init to allow running programmer_init from a clean state after programmer_shutdown. Prohibit registering programmer shutdown functions before init or after shutdown. Kill some dead code. Rename global variables with namespace-polluting names. Use a previously unused locking helper function in sst49lfxxxc.c. This is needed for libflashrom. Effects on the binary size of flashrom are minimal (300 bytes shrinkage), but the data section shrinks by 4384 bytes, and that's a good thing if flashrom is operating in constrained envionments. Corresponding to flashrom svn r1068. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Diffstat (limited to 'pcidev.c')
-rw-r--r--pcidev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pcidev.c b/pcidev.c
index add1fce..3153f15 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -25,11 +25,10 @@
uint32_t io_base_addr;
struct pci_access *pacc;
-struct pci_filter filter;
struct pci_dev *pcidev_dev = NULL;
uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar,
- struct pcidev_status *devs)
+ const struct pcidev_status *devs)
{
int i;
/* FIXME: 64 bit memory BARs need a 64 bit addr. */
@@ -79,9 +78,10 @@ uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar,
}
uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar,
- struct pcidev_status *devs, char *pcidev_bdf)
+ const struct pcidev_status *devs, char *pcidev_bdf)
{
struct pci_dev *dev;
+ struct pci_filter filter;
char *msg = NULL;
int found = 0;
uint32_t addr = 0, curaddr = 0;
@@ -125,7 +125,7 @@ uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar,
return curaddr;
}
-void print_supported_pcidevs(struct pcidev_status *devs)
+void print_supported_pcidevs(const struct pcidev_status *devs)
{
int i;
OpenPOWER on IntegriCloud