pcmcia: pcmcia_config_loop() default CIS entry handling
Many drivers use the default CIS entry within their pcmcia_config_loop()
callback function. Therefore, factor the default CIS entry handling out.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index ba34ac8..5ddfd46 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -915,6 +915,7 @@
tuple_t tuple;
cisparse_t parse;
u8 buf[256];
+ cistpl_cftable_entry_t dflt;
};
/**
@@ -933,10 +934,12 @@
int pcmcia_loop_config(struct pcmcia_device *p_dev,
int (*conf_check) (struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data),
void *priv_data)
{
struct pcmcia_cfg_mem *cfg_mem;
+
tuple_t *tuple;
int ret = -ENODEV;
@@ -963,8 +966,10 @@
/* default values */
p_dev->conf.ConfigIndex = cfg->index;
+ if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
+ cfg_mem->dflt = *cfg;
- ret = conf_check(p_dev, cfg, priv_data);
+ ret = conf_check(p_dev, cfg, &cfg_mem->dflt, priv_data);
if (!ret)
break;