2 * The PCI Library -- Parameters
4 * Copyright (c) 2008 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
16 pci_get_param(struct pci_access *acc, char *param)
20 for (p=acc->params; p; p=p->next)
21 if (!strcmp(p->param, param))
27 pci_define_param(struct pci_access *acc, char *param, char *value, char *help)
29 struct pci_param *p = pci_malloc(acc, sizeof(*p));
31 p->next = acc->params;
35 p->value_malloced = 0;
40 pci_set_param_internal(struct pci_access *acc, char *param, char *value, int copy)
44 for (p=acc->params; p; p=p->next)
45 if (!strcmp(p->param, param))
47 if (p->value_malloced)
49 p->value_malloced = copy;
51 p->value = pci_strdup(acc, value);
60 pci_set_param(struct pci_access *acc, char *param, char *value)
62 return pci_set_param_internal(acc, param, value, 1);
66 pci_free_params(struct pci_access *acc)
70 while (p = acc->params)
72 acc->params = p->next;
73 if (p->value_malloced)
80 pci_walk_params(struct pci_access *acc, struct pci_param *prev)
82 /* So far, the params form a simple linked list, but this can change in the future */