serial_cs: use pcmcia_loop_config() and pre-determined values
Subsystems (8)
PATCH 1/9 serial_cs: use pcmcia_loop_config() and pre-determined values
As the PCMCIA core already determines the multifunction count, the ConfigBase address and the Present value, we can use them directly instead of parsing the CIS again. By making use of pcmcia_loop_config(), we can further remove the remaining call to pcmcia_get_first_tuple() and friends.
--- drivers/serial/serial_cs.c | 87 ++++++++++++-------------------------------- 1 files changed, 23 insertions(+), 64 deletions(-)
drivers/serial/serial_cs.c +23 -64
@@ -426,21 +426,6 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info,/*====================================================================*/ -static int -first_tuple (struct pcmcia_device *handle,tuple_t * tuple,cisparse_t * parse) -{ -int i; - i =pcmcia_get_first_tuple (handle, tuple); -if (i !=0 ) -return i; - i =pcmcia_get_tuple_data (handle, tuple); -if (i !=0 ) -return i; -return pcmcia_parse_tuple (tuple, parse); -} - -/*====================================================================*/ - static int simple_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt,
@@ -665,6 +650,25 @@ static int multi_config(struct pcmcia_device *link)return 0 ; } +static int serial_check_for_multi (struct pcmcia_device *p_dev, +cistpl_cftable_entry_t *cf, +cistpl_cftable_entry_t *dflt, +unsigned int vcc, +void *priv_data) +{ +struct serial_info *info = p_dev->priv; + +if ((cf->io.nwin ==1 ) && (cf->io.win[0 ].len %8 ==0 )) + info->multi = cf->io.win[0 ].len >>3 ; + +if ((cf->io.nwin ==2 ) && (cf->io.win[0 ].len ==8 ) && + (cf->io.win[1 ].len ==8 )) + info->multi =2 ; + +return 0 ;/* break */ +} + +/*====================================================================== serial_config() is scheduled to run after a CARD_INSERTION event
@@ -676,46 +680,14 @@ static int multi_config(struct pcmcia_device *link)static int serial_config (struct pcmcia_device * link) {struct serial_info *info = link->priv; -struct serial_cfg_mem *cfg_mem; -tuple_t *tuple; -u_char *buf; -cisparse_t *parse; -cistpl_cftable_entry_t *cf; -int i, last_ret, last_fn; +int i;DEBUG (0 ,"serial_config(0x%p)\n" , link); - cfg_mem =kmalloc (sizeof (struct serial_cfg_mem ),GFP_KERNEL ); -if (!cfg_mem) - goto failed; - - tuple = &cfg_mem->tuple; - parse = &cfg_mem->parse; - cf = &parse->cftable_entry; - buf = cfg_mem->buf; - - tuple->TupleData = (cisdata_t *) buf; - tuple->TupleOffset =0 ; - tuple->TupleDataMax =255 ; - tuple->Attributes =0 ; - -/* Get configuration register information */ - tuple->DesiredTuple =CISTPL_CONFIG ; - last_ret =first_tuple (link, tuple, parse); -if (last_ret !=0 ) { - last_fn = ParseTuple; - goto cs_failed; - } - link->conf.ConfigBase = parse->config.base; - link->conf.Present = parse->config.rmask[0 ]; -/* Is this a compliant multifunction card? */ - tuple->DesiredTuple =CISTPL_LONGLINK_MFC ; - tuple->Attributes =TUPLE_RETURN_COMMON |TUPLE_RETURN_LINK ; - info->multi = (first_tuple (link, tuple, parse) ==0 ); + info->multi = (link->socket->functions >1 );/* Is this a multiport card? */ - tuple->DesiredTuple =CISTPL_MANFID ; info->manfid = link->manf_id; info->prodid = link->card_id;
@@ -730,20 +702,11 @@ static int serial_config(struct pcmcia_device * link)/* Another check for dual-serial cards: look for either serial or multifunction cards that ask for appropriate IO port ranges */ - tuple->DesiredTuple =CISTPL_FUNCID ;if ((info->multi ==0 ) && (link->has_func_id) && ((link->func_id ==CISTPL_FUNCID_MULTI ) || - (link->func_id ==CISTPL_FUNCID_SERIAL ))) { - tuple->DesiredTuple =CISTPL_CFTABLE_ENTRY ; -if (first_tuple (link, tuple, parse) ==0 ) { -if ((cf->io.nwin ==1 ) && (cf->io.win[0 ].len %8 ==0 )) - info->multi = cf->io.win[0 ].len >>3 ; -if ((cf->io.nwin ==2 ) && (cf->io.win[0 ].len ==8 ) && - (cf->io.win[1 ].len ==8 )) - info->multi =2 ; - } - } + (link->func_id ==CISTPL_FUNCID_SERIAL ))) +pcmcia_loop_config (link, serial_check_for_multi, info);/* * Apply any multi-port quirk.
@@ -768,14 +731,10 @@ static int serial_config(struct pcmcia_device * link) goto failed; link->dev_node = &info->node[0 ]; -kfree (cfg_mem);return 0 ; -cs_failed: -cs_error (link, last_fn, last_ret); failed:serial_remove (link); -kfree (cfg_mem);return -ENODEV ; }
Signature · 1 line
1.6.0.4
PATCH 2/9 pcmcia: use pre-determined values
A few PCMCIA network drivers can make use of values provided by the pcmcia core, instead of tedious, independent CIS parsing.
xirc32ps_cs.c: manf_id
hostap_cs.c: multifunction count
b43/pcmcia.c: ConfigBase address and "Present"
smc91c92_cs.c: By default, mhz_setup() can use VERS_1 as it is stored in struct pcmcia_device. Only some cards require workarounds, such as reading out VERS_1 twice.
--- drivers/net/pcmcia/smc91c92_cs.c | 11 +++++++++-- drivers/net/pcmcia/xirc2ps_cs.c | 5 ++--- drivers/net/wireless/b43/pcmcia.c | 20 -------------------- drivers/net/wireless/hostap/hostap_cs.c | 21 +-------------------- 4 files changed, 12 insertions(+), 45 deletions(-)
drivers/net/pcmcia/smc91c92_cs.c +9 -2
@@ -545,6 +545,14 @@ static int mhz_setup(struct pcmcia_device *link)u_char *buf, *station_addr;int rc; +/* Read the station address from the CIS. It is stored as the last +(fourth) string in the Version 1 Version/ID tuple. */ +if ((link->prod_id[3 ]) && + (cvt_ascii_address (dev, link->prod_id[3 ]) ==0 )) +return 0 ; + +/* Workarounds for broken cards start here. */ + cfg_mem =kmalloc (sizeof (struct smc_cfg_mem ),GFP_KERNEL );if (!cfg_mem)return -1 ;
@@ -557,8 +565,7 @@ static int mhz_setup(struct pcmcia_device *link) tuple->TupleData = (cisdata_t *)buf; tuple->TupleDataMax =255 ; -/* Read the station address from the CIS. It is stored as the last -(fourth) string in the Version 1 Version/ID tuple. */ +/* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ tuple->DesiredTuple =CISTPL_VERS_1 ;if (first_tuple (link, tuple, parse) !=0 ) { rc =-1 ;
drivers/net/pcmcia/xirc2ps_cs.c +2 -3
@@ -792,13 +792,12 @@ xirc2ps_config(struct pcmcia_device * link) tuple.TupleOffset =0 ;/* Is this a valid card */ - tuple.DesiredTuple =CISTPL_MANFID ; -if ((err=first_tuple (link, &tuple, &parse))) { +if (link->has_manf_id ==0 ) {printk (KNOT_XIRC "manfid not found in CIS\n" ); goto failure; } -switch (parse.manfid.manf) { +switch (link->manf_id) {case MANFID_XIRCOM : local->manf_str ="Xircom" ;break ;
drivers/net/wireless/b43/pcmcia.c +0 -20
@@ -65,35 +65,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)struct ssb_bus *ssb;win_req_t win;memreq_t mem; -tuple_t tuple; -cisparse_t parse;int err = -ENOMEM ;int res =0 ; -unsigned char buf[64 ]; ssb =kzalloc (sizeof (*ssb),GFP_KERNEL );if (!ssb) goto out_error; err = -ENODEV ; - tuple.DesiredTuple =CISTPL_CONFIG ; - tuple.Attributes =0 ; - tuple.TupleData = buf; - tuple.TupleDataMax =sizeof (buf); - tuple.TupleOffset =0 ; - res =pcmcia_get_first_tuple (dev, &tuple); -if (res !=0 ) - goto err_kfree_ssb; - res =pcmcia_get_tuple_data (dev, &tuple); -if (res !=0 ) - goto err_kfree_ssb; - res =pcmcia_parse_tuple (&tuple, &parse); -if (res !=0 ) - goto err_kfree_ssb; - - dev->conf.ConfigBase = parse.config.base; - dev->conf.Present = parse.config.rmask[0 ]; dev->conf.Attributes =CONF_ENABLE_IRQ ; dev->conf.IntType =INT_MEMORY_AND_IO ;
drivers/net/wireless/hostap/hostap_cs.c +1 -20
@@ -274,9 +274,6 @@ static int sandisk_enable_wireless(struct net_device *dev)conf_reg_t reg;struct hostap_interface *iface =netdev_priv (dev);local_info_t *local = iface->local; -tuple_t tuple; -cisparse_t *parse =NULL ; -u_char buf[64 ];struct hostap_cs_priv *hw_priv = local->hw_priv;if (hw_priv->link->io.NumPorts1 <0x42 ) {
@@ -285,28 +282,13 @@ static int sandisk_enable_wireless(struct net_device *dev) goto done; } - parse =kmalloc (sizeof (cisparse_t),GFP_KERNEL ); -if (parse ==NULL ) { - ret = -ENOMEM ; - goto done; - } - - tuple.Attributes =TUPLE_RETURN_COMMON ; - tuple.TupleData = buf; - tuple.TupleDataMax =sizeof (buf); - tuple.TupleOffset =0 ; -if (hw_priv->link->manf_id !=0xd601 || hw_priv->link->card_id !=0x0101 ) {/* No SanDisk manfid found */ ret = -ENODEV ; goto done; } - tuple.DesiredTuple =CISTPL_LONGLINK_MFC ; -if (pcmcia_get_first_tuple (hw_priv->link, &tuple) || -pcmcia_get_tuple_data (hw_priv->link, &tuple) || -pcmcia_parse_tuple (&tuple, parse) || - parse->longlink_mfc.nfn <2 ) { +if (hw_priv->link->socket->functions <2 ) {/* No multi-function links found */ ret = -ENODEV ; goto done;
@@ -354,7 +336,6 @@ static int sandisk_enable_wireless(struct net_device *dev)udelay (10 ); done: -kfree (parse);return ret; }
Signature · 1 line
1.6.0.4
PATCH 3/9 pcmcia: use pcmcia_loop_config in misc pcmcia drivers
Use pcmcia_loop_config() in a few drivers missed during the first round. On fmvj18x_cs.c it -- strangely -- only requries us to set conf.ConfigIndex, which is done by the core, so include an empty loop function which returns 0 unconditionally.
--- drivers/char/pcmcia/ipwireless/main.c | 103 +++++++-------------------------- drivers/char/pcmcia/synclink_cs.c | 64 ++++++++------------- drivers/net/pcmcia/fmvj18x_cs.c | 22 +++++-- drivers/net/wireless/libertas/if_cs.c | 67 +++++++++------------- 4 files changed, 88 insertions(+), 168 deletions(-)
drivers/char/pcmcia/ipwireless/main.c +22 -81
@@ -79,14 +79,32 @@ static void signalled_reboot_callback(void *callback_data)schedule_work (&ipw->work_reboot); } +static int ipwireless_ioprobe (struct pcmcia_device *p_dev, +cistpl_cftable_entry_t *cfg, +cistpl_cftable_entry_t *dflt, +unsigned int vcc, +void *priv_data) +{ + p_dev->io.Attributes1 =IO_DATA_PATH_WIDTH_AUTO ; + p_dev->io.BasePort1 = cfg->io.win[0 ].base; + p_dev->io.NumPorts1 = cfg->io.win[0 ].len; + p_dev->io.IOAddrLines =16 ; + + p_dev->irq.IRQInfo1 = cfg->irq.IRQInfo1; + +/* 0x40 causes it to generate level mode interrupts. */ +/* 0x04 enables IREQ pin. */ + p_dev->conf.ConfigIndex = cfg->index |0x44 ; +return pcmcia_request_io (p_dev, &p_dev->io); +} +static int config_ipwireless (struct ipw_dev *ipw) {struct pcmcia_device *link = ipw->link; -int ret; +int ret =0 ;tuple_t tuple;unsigned short buf[64 ];cisparse_t parse; -unsigned short cor_value;memreq_t memreq_attr_memory;memreq_t memreq_common_memory;
@@ -97,103 +115,26 @@ static int config_ipwireless(struct ipw_dev *ipw) tuple.TupleDataMax =sizeof (buf); tuple.TupleOffset =0 ; - tuple.DesiredTuple =RETURN_FIRST_TUPLE ; - - ret =pcmcia_get_first_tuple (link, &tuple); - -while (ret ==0 ) { - ret =pcmcia_get_tuple_data (link, &tuple); - -if (ret !=0 ) { -cs_error (link, GetTupleData, ret); - goto exit0; - } - ret =pcmcia_get_next_tuple (link, &tuple); - } - - tuple.DesiredTuple =CISTPL_CFTABLE_ENTRY ; - - ret =pcmcia_get_first_tuple (link, &tuple); - -if (ret !=0 ) { -cs_error (link, GetFirstTuple, ret); - goto exit0; - } - - ret =pcmcia_get_tuple_data (link, &tuple); - -if (ret !=0 ) { -cs_error (link, GetTupleData, ret); - goto exit0; - } - - ret =pcmcia_parse_tuple (&tuple, &parse); - -if (ret !=0 ) { -cs_error (link, ParseTuple, ret); - goto exit0; - } - - link->io.Attributes1 =IO_DATA_PATH_WIDTH_AUTO ; - link->io.BasePort1 = parse.cftable_entry.io.win[0 ].base; - link->io.NumPorts1 = parse.cftable_entry.io.win[0 ].len; - link->io.IOAddrLines =16 ; - - link->irq.IRQInfo1 = parse.cftable_entry.irq.IRQInfo1; - -/* 0x40 causes it to generate level mode interrupts. */ -/* 0x04 enables IREQ pin. */ - cor_value = parse.cftable_entry.index |0x44 ; - link->conf.ConfigIndex = cor_value; - -/* IRQ and I/O settings */ - tuple.DesiredTuple =CISTPL_CONFIG ; - - ret =pcmcia_get_first_tuple (link, &tuple); - + ret =pcmcia_loop_config (link, ipwireless_ioprobe,NULL );if (ret !=0 ) { -cs_error (link, GetFirstTuple, ret); - goto exit0; - } - - ret =pcmcia_get_tuple_data (link, &tuple); - -if (ret !=0 ) { -cs_error (link, GetTupleData, ret); +cs_error (link, RequestIO, ret); goto exit0; } - ret =pcmcia_parse_tuple (&tuple, &parse); - -if (ret !=0 ) { -cs_error (link, GetTupleData, ret); - goto exit0; - } link->conf.Attributes =CONF_ENABLE_IRQ ; - link->conf.ConfigBase = parse.config.base; - link->conf.Present = parse.config.rmask[0 ]; link->conf.IntType =INT_MEMORY_AND_IO ; link->irq.Attributes =IRQ_TYPE_DYNAMIC_SHARING |IRQ_HANDLE_PRESENT ; link->irq.Handler = ipwireless_interrupt; link->irq.Instance = ipw->hardware; - ret =pcmcia_request_io (link, &link->io); - -if (ret !=0 ) { -cs_error (link, RequestIO, ret); - goto exit0; - } -request_region (link->io.BasePort1, link->io.NumPorts1,IPWIRELESS_PCCARD_NAME );/* memory settings */ - tuple.DesiredTuple =CISTPL_CFTABLE_ENTRY ; ret =pcmcia_get_first_tuple (link, &tuple); -if (ret !=0 ) {cs_error (link, GetFirstTuple, ret); goto exit1;
drivers/char/pcmcia/synclink_cs.c +24 -40
79 lines not on this page · raw message
drivers/net/pcmcia/fmvj18x_cs.c +15 -7
@@ -341,14 +341,23 @@ static int ungermann_try_io_port(struct pcmcia_device *link)return ret;/* RequestIO failed */ } +static int fmvj18x_ioprobe (struct pcmcia_device *p_dev, +cistpl_cftable_entry_t *cfg, +cistpl_cftable_entry_t *dflt, +unsigned int vcc, +void *priv_data) +{ +return 0 ;/* strange, but that's what the code did already before... */ +} + +static int fmvj18x_config (struct pcmcia_device *link) {struct net_device *dev = link->priv;local_info_t *lp =netdev_priv (dev);tuple_t tuple; -cisparse_t parse;u_short buf[32 ]; -int i, last_fn =0 , last_ret =0 , ret; +int i, last_fn = RequestIO, last_ret =0 , ret;unsigned int ioaddr;cardtype_t cardtype;char *card_name ="unknown" ;
@@ -362,12 +371,11 @@ static int fmvj18x_config(struct pcmcia_device *link) tuple.DesiredTuple =CISTPL_FUNCE ; tuple.TupleOffset =0 ;if (pcmcia_get_first_tuple (link, &tuple) ==0 ) { + last_ret =pcmcia_loop_config (link, fmvj18x_ioprobe,NULL ); +if (last_ret !=0 ) + goto cs_failed; +/* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ - tuple.DesiredTuple =CISTPL_CFTABLE_ENTRY ; -CS_CHECK (GetFirstTuple,pcmcia_get_first_tuple (link, &tuple)); -CS_CHECK (GetTupleData,pcmcia_get_tuple_data (link, &tuple)); -CS_CHECK (ParseTuple,pcmcia_parse_tuple (&tuple, &parse)); - link->conf.ConfigIndex = parse.cftable_entry.index;switch (link->manf_id) {case MANFID_TDK : cardtype =TDK ;
drivers/net/wireless/libertas/if_cs.c +27 -40
88 lines not on this page · raw message
Signature · 1 line
1.6.0.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 6/9 pcmcia: convert net pcmcia drivers to use new CIS helpers
Use the new CIS helpers in net pcmcia drivers, which allows for a few code cleanups.
--- drivers/net/pcmcia/3c574_cs.c | 18 ++-- drivers/net/pcmcia/3c589_cs.c | 24 ++--- drivers/net/pcmcia/fmvj18x_cs.c | 51 ++++----- drivers/net/pcmcia/nmclan_cs.c | 19 ++-- drivers/net/pcmcia/smc91c92_cs.c | 238 +++++++++++--------------------------- drivers/net/pcmcia/xirc2ps_cs.c | 101 ++++++---------- 6 files changed, 154 insertions(+), 297 deletions(-)
drivers/net/pcmcia/3c574_cs.c +8 -10
@@ -344,13 +344,13 @@ static int tc574_config(struct pcmcia_device *link) {struct net_device *dev = link->priv;struct el3_private *lp =netdev_priv (dev); -tuple_t tuple; -__le16 buf[32 ];int last_fn, last_ret, i, j;unsigned int ioaddr;__be16 *phys_addr;char *cardname;__u32 config; +u8 *buf; +size_t len; phys_addr = (__be16 *)dev->dev_addr;
@@ -378,16 +378,14 @@ static int tc574_config(struct pcmcia_device *link)/* The 3c574 normally uses an EEPROM for configuration info, including the hardware address. The future products may include a modem chip and put the address in the CIS. */ - tuple.Attributes =0 ; - tuple.TupleData = (cisdata_t *)buf; - tuple.TupleDataMax =64 ; - tuple.TupleOffset =0 ; - tuple.DesiredTuple =0x88 ; -if (pcmcia_get_first_tuple (link, &tuple) ==0 ) { -pcmcia_get_tuple_data (link, &tuple); + + len =pcmcia_get_tuple (link,0x88 , &buf); +if (buf && len >=6 ) {for (i =0 ; i <3 ; i++) - phys_addr[i] =htons (le16_to_cpu (buf[i])); + phys_addr[i] =htons (le16_to_cpu (buf[i *2 ])); +kfree (buf); }else { +kfree (buf);/* 0 < len < 6 */ EL3WINDOW (0 );for (i =0 ; i <3 ; i++) phys_addr[i] =htons (read_eeprom (ioaddr, i +10 ));
drivers/net/pcmcia/3c589_cs.c +9 -15
@@ -256,22 +256,15 @@ static int tc589_config(struct pcmcia_device *link) {struct net_device *dev = link->priv;struct el3_private *lp =netdev_priv (dev); -tuple_t tuple; -__le16 buf[32 ]; -__be16 *phys_addr; +__be16 *phys_addr =NULL ;int last_fn, last_ret, i, j, multi =0 , fifo;unsigned int ioaddr;char *ram_split[] = {"5:3" ,"3:1" ,"1:1" ,"3:5" }; +u8 *buf; +size_t len;DEBUG (0 ,"3c589_config(0x%p)\n" , link); - phys_addr = (__be16 *)dev->dev_addr; - tuple.Attributes =0 ; - tuple.TupleData = (cisdata_t *)buf; - tuple.TupleDataMax =sizeof (buf); - tuple.TupleOffset =0 ; - tuple.Attributes =TUPLE_RETURN_COMMON ; -/* Is this a 3c562? */ if (link->manf_id !=MANFID_3COM ) printk(KERN_INFO "3c589_cs: hmmm, is this really a "
@@ -301,12 +294,13 @@ static int tc589_config(struct pcmcia_device *link)/* The 3c589 has an extra EEPROM for configuration info, including the hardware address. The 3c562 puts the address in the CIS. */ - tuple.DesiredTuple =0x88 ; -if (pcmcia_get_first_tuple (link, &tuple) ==0 ) { -pcmcia_get_tuple_data (link, &tuple); -for (i =0 ; i <3 ; i++) - phys_addr[i] =htons (le16_to_cpu (buf[i])); + len =pcmcia_get_tuple (link,0x88 , &buf); +if (buf && len >=6 ) { +for (i =0 ; i <3 ; i++) + phys_addr[i] =htons (le16_to_cpu (buf[i*2 ])); +kfree (buf); }else { +kfree (buf);/* 0 < len < 6 */ for (i =0 ; i <3 ; i++) phys_addr[i] =htons (read_eeprom (ioaddr, i));if (phys_addr[0 ] ==htons (0x6060 )) {
drivers/net/pcmcia/fmvj18x_cs.c +23 -28
97 lines not on this page · raw message
drivers/net/pcmcia/nmclan_cs.c +9 -10
@@ -661,8 +661,8 @@ static int nmclan_config(struct pcmcia_device *link) {struct net_device *dev = link->priv;mace_private *lp =netdev_priv (dev); -tuple_t tuple; -u_char buf[64 ]; +u8 *buf; +size_t len;int i, last_ret, last_fn;unsigned int ioaddr;
@@ -677,14 +677,13 @@ static int nmclan_config(struct pcmcia_device *link) ioaddr = dev->base_addr;/* Read the ethernet address from the CIS. */ - tuple.DesiredTuple =0x80 /* CISTPL_CFTABLE_ENTRY_MISC */ ; - tuple.TupleData = buf; - tuple.TupleDataMax =64 ; - tuple.TupleOffset =0 ; - tuple.Attributes =0 ; -CS_CHECK (GetFirstTuple,pcmcia_get_first_tuple (link, &tuple)); -CS_CHECK (GetTupleData,pcmcia_get_tuple_data (link, &tuple)); -memcpy (dev->dev_addr, tuple.TupleData,ETHER_ADDR_LEN ); + len =pcmcia_get_tuple (link,0x80 , &buf); +if (!buf || len <ETHER_ADDR_LEN ) { +kfree (buf); + goto failed; + } +memcpy (dev->dev_addr, buf,ETHER_ADDR_LEN ); +kfree (buf);/* Verify configuration by reading the MACE ID. */ {
drivers/net/pcmcia/smc91c92_cs.c +66 -172
331 lines not on this page · raw message
drivers/net/pcmcia/xirc2ps_cs.c +39 -62
131 lines not on this page · raw message
Signature · 1 line
1.6.0.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 8/9 pcmcia: convert pcmciamtd driver to use new CIS helpers
Convert the (broken) pcmciamtd driver to use the new CIS helpers.
--- drivers/mtd/maps/pcmciamtd.c | 175 ++++++++++++++++++++++-------------------- 1 files changed, 91 insertions(+), 84 deletions(-)
drivers/mtd/maps/pcmciamtd.c +91 -84
@@ -354,101 +354,108 @@ static void pcmciamtd_release(struct pcmcia_device *link) } -static void card_settings (struct pcmciamtd_dev *dev,struct pcmcia_device *link,int *new_name) +#ifdef CONFIG_MTD_DEBUG +static int pcmciamtd_cistpl_format (struct pcmcia_device *p_dev, +tuple_t *tuple, +void *priv_data) { -int rc; -tuple_t tuple;cisparse_t parse; -u_char buf[64 ]; - - tuple.Attributes =0 ; - tuple.TupleData = (cisdata_t *)buf; - tuple.TupleDataMax =sizeof (buf); - tuple.TupleOffset =0 ; - tuple.DesiredTuple =RETURN_FIRST_TUPLE ; - - rc =pcmcia_get_first_tuple (link, &tuple); -while (rc ==0 ) { - rc =pcmcia_get_tuple_data (link, &tuple); -if (rc !=0 ) { -cs_error (link, GetTupleData, rc); -break ; - } - rc =pcmcia_parse_tuple (&tuple, &parse); -if (rc !=0 ) { -cs_error (link, ParseTuple, rc); -break ; - } -switch (tuple.TupleCode) { -case CISTPL_FORMAT : { -cistpl_format_t *t = &parse.format; - (void )t;/* Shut up, gcc */ -DEBUG (2 ,"Format type: %u, Error Detection: %u, offset = %u, length =%u" , - t->type, t->edc, t->offset, t->length); -break ; +if (!pcmcia_parse_tuple (tuple, &parse)) { +cistpl_format_t *t = &parse.format; + (void )t;/* Shut up, gcc */ +DEBUG (2 ,"Format type: %u, Error Detection: %u, offset = %u, length =%u" , + t->type, t->edc, t->offset, t->length); + } +return -ENOSPC ; +} - } +static int pcmciamtd_cistpl_jedec (struct pcmcia_device *p_dev, +tuple_t *tuple, +void *priv_data) +{ +cisparse_t parse; +int i; -case CISTPL_DEVICE : { -cistpl_device_t *t = &parse.device; -int i; -DEBUG (2 ,"Common memory:" ); - dev->pcmcia_map.size = t->dev[0 ].size; -for (i =0 ; i < t->ndev; i++) { -DEBUG (2 ,"Region %d, type = %u" , i, t->dev[i].type); -DEBUG (2 ,"Region %d, wp = %u" , i, t->dev[i].wp); -DEBUG (2 ,"Region %d, speed = %u ns" , i, t->dev[i].speed); -DEBUG (2 ,"Region %d, size = %u bytes" , i, t->dev[i].size); - } -break ; - } +if (!pcmcia_parse_tuple (tuple, &parse)) { +cistpl_jedec_t *t = &parse.jedec; +for (i =0 ; i < t->nid; i++) +DEBUG (2 ,"JEDEC: 0x%02x 0x%02x" , t->id[i].mfr, t->id[i].info); + } +return -ENOSPC ; +} +#endif -case CISTPL_VERS_1 : { -cistpl_vers_1_t *t = &parse.version_1; -int i; -if (t->ns) { - dev->mtd_name[0 ] ='\0' ; -for (i =0 ; i < t->ns; i++) { -if (i) -strcat (dev->mtd_name," " ); -strcat (dev->mtd_name, t->str+t->ofs[i]); - } - } -DEBUG (2 ,"Found name: %s" , dev->mtd_name); -break ; - } +static int pcmciamtd_cistpl_device (struct pcmcia_device *p_dev, +tuple_t *tuple, +void *priv_data) +{ +struct pcmciamtd_dev *dev = priv_data; +cisparse_t parse; +cistpl_device_t *t = &parse.device; + +if (pcmcia_parse_tuple (tuple, &parse)) +return -EINVAL ; + +DEBUG (2 ,"Common memory:" ); + dev->pcmcia_map.size = t->dev[0 ].size; +/* from here on: DEBUG only */ +for (i =0 ; i < t->ndev; i++) { +DEBUG (2 ,"Region %d, type = %u" , i, t->dev[i].type); +DEBUG (2 ,"Region %d, wp = %u" , i, t->dev[i].wp); +DEBUG (2 ,"Region %d, speed = %u ns" , i, t->dev[i].speed); +DEBUG (2 ,"Region %d, size = %u bytes" , i, t->dev[i].size); + } +return 0 ; +} -case CISTPL_JEDEC_C : { -cistpl_jedec_t *t = &parse.jedec; -int i; -for (i =0 ; i < t->nid; i++) { -DEBUG (2 ,"JEDEC: 0x%02x 0x%02x" , t->id[i].mfr, t->id[i].info); - } -break ; - } +static int pcmciamtd_cistpl_geo (struct pcmcia_device *p_dev, +tuple_t *tuple, +void *priv_data) +{ +struct pcmciamtd_dev *dev = priv_data; +cisparse_t parse; +cistpl_device_geo_t *t = &parse.device_geo; + +if (pcmcia_parse_tuple (tuple, &parse)) +return -EINVAL ; + + dev->pcmcia_map.bankwidth = t->geo[0 ].buswidth; +/* from here on: DEBUG only */ +for (i =0 ; i < t->ngeo; i++) { +DEBUG (2 ,"region: %d bankwidth = %u" , i, t->geo[i].buswidth); +DEBUG (2 ,"region: %d erase_block = %u" , i, t->geo[i].erase_block); +DEBUG (2 ,"region: %d read_block = %u" , i, t->geo[i].read_block); +DEBUG (2 ,"region: %d write_block = %u" , i, t->geo[i].write_block); +DEBUG (2 ,"region: %d partition = %u" , i, t->geo[i].partition); +DEBUG (2 ,"region: %d interleave = %u" , i, t->geo[i].interleave); + } +return 0 ; +} -case CISTPL_DEVICE_GEO : { -cistpl_device_geo_t *t = &parse.device_geo; -int i; - dev->pcmcia_map.bankwidth = t->geo[0 ].buswidth; -for (i =0 ; i < t->ngeo; i++) { -DEBUG (2 ,"region: %d bankwidth = %u" , i, t->geo[i].buswidth); -DEBUG (2 ,"region: %d erase_block = %u" , i, t->geo[i].erase_block); -DEBUG (2 ,"region: %d read_block = %u" , i, t->geo[i].read_block); -DEBUG (2 ,"region: %d write_block = %u" , i, t->geo[i].write_block); -DEBUG (2 ,"region: %d partition = %u" , i, t->geo[i].partition); -DEBUG (2 ,"region: %d interleave = %u" , i, t->geo[i].interleave); - } -break ; - } -default : -DEBUG (2 ,"Unknown tuple code %d" , tuple.TupleCode); - } +static void card_settings (struct pcmciamtd_dev *dev,struct pcmcia_device *link,int *new_name) +{ +int i; - rc =pcmcia_get_next_tuple (link, &tuple); +if (p_dev->prod_id[0 ]) { + dev->mtd_name[0 ] ='\0' ; +for (i =0 ; i <4 ; i++) { +if (i) +strcat (dev->mtd_name," " ); +if (p_dev->prod_id[i]) +strcat (dev->mtd_name, p_dev->prod_id[i]); + } +DEBUG (2 ,"Found name: %s" , dev->mtd_name); } + +#ifdef CONFIG_MTD_DEBUG +pcmcia_loop_tuple (p_dev,CISTPL_FORMAT , pcmciamtd_cistpl_format,NULL ); +pcmcia_loop_tuple (p_dev,CISTPL_JEDEC_C , pcmciamtd_cistpl_jedec,NULL ); +#endif +pcmcia_loop_tuple (p_dev,CISTPL_DEVICE , pcmciamtd_cistpl_device, dev); +pcmcia_loop_tuple (p_dev,CISTPL_DEVICE_GEO , pcmciamtd_cistpl_geo, dev); +if (!dev->pcmcia_map.size) dev->pcmcia_map.size =MAX_PCMCIA_ADDR ;
Signature · 1 line
1.6.0.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
Quoted 2 lines · On Mon, 19 Oct 2009 01:07:35 +0200 Dominik Brodowski wrote:
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple' drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data' drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'
There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
Quoted 43 lines
Signed-off-by Dominik Brodowski <[email protected]>--- drivers/pcmcia/cs_internal.h | 9 +++++++++ include/pcmcia/ds.h | 15 --------------- 2 files changed, 9 insertions(+), 15 deletions(-)drivers/pcmcia/cs_internal.h +9
-0@@ -206,6 +206,15 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, cisparse_t *parse, void *priv_data)); +int pccard_get_first_tuple (struct pcmcia_socket *s,unsigned int function, +tuple_t *tuple); + +int pccard_get_next_tuple (struct pcmcia_socket *s,unsigned int function, +tuple_t *tuple); + +int pccard_get_tuple_data (struct pcmcia_socket *s,tuple_t *tuple); + +/* rsrc_mgr.c */ int pcmcia_validate_mem (struct pcmcia_socket *s); struct resource *pcmcia_find_io_region(unsigned long base,include/pcmcia/ds.h +0
-8@@ -229,21 +229,6 @@ int pcmcia_reset_card(struct pcmcia_socket *skt);int pcmcia_access_configuration_register (struct pcmcia_device *p_dev,conf_reg_t *reg); -/* deprecated -- do not use in drivers. */ -int pccard_get_first_tuple (struct pcmcia_socket *s,unsigned int function, -tuple_t *tuple); -#define pcmcia_get_first_tuple (p_dev, tuple) \ - pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple) - -int pccard_get_next_tuple (struct pcmcia_socket *s,unsigned int function, -tuple_t *tuple);
include/pcmcia/ds.h int pcmcia_reset_card(struct pcmcia_socket *skt); · line 234
Quoted 10 lines
include/pcmcia/ds.h +0
-7-#define pcmcia_get_next_tuple (p_dev, tuple) \ - pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple) - -int pccard_get_tuple_data (struct pcmcia_socket *s,tuple_t *tuple); -#define pcmcia_get_tuple_data (p_dev, tuple) \ - pccard_get_tuple_data(p_dev->socket, tuple) -/* device configuration */ int pcmcia_request_io (struct pcmcia_device *p_dev,io_req_t *req);int pcmcia_request_irq (struct pcmcia_device *p_dev,irq_req_t *req);
---
~Randy
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
Randy,
Quoted 11 lines · Randy Dunlap
Quoted 2 lines
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple'drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data'drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
What are the current rules on drivers in staging/ ? Do they need to be updated as well on API changes?
Thanks,
Dominik
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
Quoted 12 lines · Dominik Brodowski
Randy,
Quoted 9 lines · Randy Dunlap
Quoted 2 lines
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple'drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data'drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'
Quoted 5 lines
Quoted 2 lines
There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
What are the current rules on drivers in staging/ ? Do they need to be updated as well on API changes?
You don't have to do it, no. I'll be glad to do so as long as I get a hint as to what needs to be done :)
thanks,
greg k-h
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
Greg,
Quoted 13 lines · Greg KH
Quoted 12 lines · Dominik Brodowski
Randy,
Quoted 9 lines · Randy Dunlap
Quoted 2 lines
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple'drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data'drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
What are the current rules on drivers in staging/ ? Do they need to be updated as well on API changes?
You don't have to do it, no. I'll be glad to do so as long as I get a hint as to what needs to be done :)
These hints are in Documentation/pcmcia/driver-changes.txt . However, I'll try to get some patches cooked up myself tonight for those drivers. Whom shall I submit them to, or shall I just add them to the PCMCIA tree?
Best,
Dominik
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
Quoted 22 lines · Dominik Brodowski
Greg,
Quoted 19 lines · Greg KH
Quoted 17 lines · Dominik Brodowski
Randy,
Quoted 11 lines · Randy Dunlap
Quoted 2 lines
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple'drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data'drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
What are the current rules on drivers in staging/ ? Do they need to be updated as well on API changes?
Quoted 6 lines
Quoted 2 lines
You don't have to do it, no. I'll be glad to do so as long as I get a hint as to what needs to be done :)
These hints are in
Documentation/pcmcia/driver-changes.txt. However, I'll try to get some patches cooked up myself tonight for those drivers. Whom shall I submit them to, or shall I just add them to the PCMCIA tree?
You can send them to me, or you can take them in your tree if you want, whatever is easier for you.
thanks,
greg k-h
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
In reply to Dominik BrodowskiQuoted 20 lines · Dominik Brodowski
Quoted 19 lines · Greg KH
Quoted 17 lines · Dominik Brodowski
Randy,
Quoted 11 lines · Randy Dunlap
Quoted 2 lines
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple'drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data'drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
What are the current rules on drivers in staging/ ? Do they need to be updated as well on API changes?
Quoted 6 lines
Quoted 2 lines
You don't have to do it, no. I'll be glad to do so as long as I get a hint as to what needs to be done :)
These hints are in
Documentation/pcmcia/driver-changes.txt. However, I'll try to get some patches cooked up myself tonight for those drivers. Whom shall I submit them to, or shall I just add them to the PCMCIA tree?
Update all changes (already those not included in linux-next) which are in the queue for 2.6.33 for all comedi PCMCIA drivers. Compile-tested only, and I'll queue it up with the other PCMCIA patches.
From: Dominik Brodowski <[email protected]>
Date: Thu, 29 Oct 2009 00:54:49 +0100
Subject: [PATCH 1/1] pcmcia/staging: update comedi drivers
Update comedi PCMCIA drivers to work with recent PCMCIA changes documented in Documentation/pcmcia/driver-changes.txt:
- use pcmcia_config_loop()
- don't use PCMCIA_DEBUG, but use dev_dbg()
- don't use cs_error()
- re-use prod_id and card_id values already stored
--- drivers/staging/comedi/drivers/cb_das16_cs.c | 220 +++++--------------- drivers/staging/comedi/drivers/das08_cs.c | 202 +++++-------------- drivers/staging/comedi/drivers/ni_daq_700.c | 236 +++++++--------------- drivers/staging/comedi/drivers/ni_daq_dio24.c | 235 +++++++--------------- drivers/staging/comedi/drivers/ni_labpc_cs.c | 224 +++++++-------------- drivers/staging/comedi/drivers/ni_mio_cs.c | 127 +++--------- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 215 +++++--------------- 7 files changed, 424 insertions(+), 1035 deletions(-)
drivers/staging/comedi/drivers/cb_das16_cs.c +55 -165
@@ -141,37 +141,14 @@ static int das16cs_timer_insn_config(struct comedi_device *dev,struct comedi_insn *insn, unsigned int *data); -static int get_prodid (struct comedi_device *dev,struct pcmcia_device *link) -{ -tuple_t tuple; -u_short buf[128 ]; -int prodid =0 ; - - tuple.TupleData = (cisdata_t *) buf; - tuple.TupleOffset =0 ; - tuple.TupleDataMax =255 ; - tuple.DesiredTuple =CISTPL_MANFID ; - tuple.Attributes =TUPLE_RETURN_COMMON ; -if ((pcmcia_get_first_tuple (link, &tuple) ==0 ) && - (pcmcia_get_tuple_data (link, &tuple) ==0 )) { - prodid =le16_to_cpu (buf[1 ]); - } - -return prodid; -} -static const struct das16cs_board *das16cs_probe (struct comedi_device *dev,struct pcmcia_device *link) { -int id;int i; - id =get_prodid (dev, link); -for (i =0 ; i < n_boards; i++) { -if (das16cs_boards[i].device_id == id) { +if (das16cs_boards[i].device_id == link->card_id)return das16cs_boards + i; - } }printk ("unknown board!\n" );
@@ -660,27 +637,8 @@ static int das16cs_timer_insn_config(struct comedi_device *dev,======================================================================*/ -/* -All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If -you do not define PCMCIA_DEBUG at all, all the debug code will be -left out. If you compile with PCMCIA_DEBUG=0, the debug code will -be present but disabled -- but it can then be enabled for specific -modules at load time with a 'pc_debug=#' option to insmod. -*/ #if defined(CONFIG_PCMCIA ) || defined(CONFIG_PCMCIA_MODULE ) -#ifdef PCMCIA_DEBUG -static int pc_debug =PCMCIA_DEBUG ; -module_param (pc_debug, int,0644 ); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"cb_das16_cs.c pcmcia code (David Schleef), modified from dummy_cs.c 1.31 2001/08/24 12:13:13 (David Hinds)" ; -#else -#define DEBUG(n, args...) -#endif - -/*====================================================================*/ -static void das16cs_pcmcia_config (struct pcmcia_device *link);static void das16cs_pcmcia_release (struct pcmcia_device *link);static int das16cs_pcmcia_suspend (struct pcmcia_device *p_dev);
@@ -733,7 +691,7 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) {struct local_info_t *local; -DEBUG (0 ,"das16cs_pcmcia_attach()\n" ); +dev_dbg (&link->dev,"das16cs_pcmcia_attach()\n" );/* Allocate space for private device-specific data */ local =kzalloc (sizeof (struct local_info_t ),GFP_KERNEL );
@@ -760,7 +718,7 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link)static void das16cs_pcmcia_detach (struct pcmcia_device *link) { -DEBUG (0 ,"das16cs_pcmcia_detach(0x%p)\n" , link); +dev_dbg (&link->dev,"das16cs_pcmcia_detach\n" );if (link->dev_node) { ((struct local_info_t *)link->priv)->stop =1 ;
@@ -771,118 +729,55 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link)kfree (link->priv); }/* das16cs_pcmcia_detach */ -static void das16cs_pcmcia_config (struct pcmcia_device *link) -{ -struct local_info_t *dev = link->priv; -tuple_t tuple; -cisparse_t parse; -int last_fn, last_ret; -u_char buf[64 ]; -cistpl_cftable_entry_t dflt = {0 }; -DEBUG (0 ,"das16cs_pcmcia_config(0x%p)\n" , link); - -/* -This reads the card's CONFIG tuple to find its configuration -registers. -*/ - tuple.DesiredTuple =CISTPL_CONFIG ; - tuple.Attributes =0 ; - tuple.TupleData = buf; - tuple.TupleDataMax =sizeof (buf); - tuple.TupleOffset =0 ; - - last_fn = GetFirstTuple; - last_ret =pcmcia_get_first_tuple (link, &tuple); -if (last_ret !=0 ) - goto cs_failed; - - last_fn = GetTupleData; - last_ret =pcmcia_get_tuple_data (link, &tuple); -if (last_ret !=0 ) - goto cs_failed; - - last_fn = ParseTuple; - last_ret =pcmcia_parse_tuple (&tuple, &parse); -if (last_ret !=0 ) - goto cs_failed; - - link->conf.ConfigBase = parse.config.base; - link->conf.Present = parse.config.rmask[0 ]; +static int das16cs_pcmcia_config_loop (struct pcmcia_device *p_dev, +cistpl_cftable_entry_t *cfg, +cistpl_cftable_entry_t *dflt, +unsigned int vcc, +void *priv_data) +{ +if (cfg->index ==0 ) +return -EINVAL ; -/* -In this loop, we scan the CIS for configuration table entries, -each of which describes a valid card configuration, including -voltage, IO window, memory window, and interrupt settings. - -We make no assumptions about the card to be configured: we use -just the information available in the CIS. In an ideal world, -this would work for any PCMCIA card, but it requires a complete -and accurate CIS. In practice, a driver usually "knows" most of -these things without consulting the CIS, and most client drivers -will only use the CIS to fill in implementation-defined details. -*/ - tuple.DesiredTuple =CISTPL_CFTABLE_ENTRY ; - last_fn = GetFirstTuple; - - last_ret =pcmcia_get_first_tuple (link, &tuple); -if (last_ret) - goto cs_failed; - -while (1 ) { -cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); -if (pcmcia_get_tuple_data (link, &tuple)) - goto next_entry; -if (pcmcia_parse_tuple (&tuple, &parse)) - goto next_entry; - -if (cfg->flags &CISTPL_CFTABLE_DEFAULT ) - dflt = *cfg; -if (cfg->index ==0 ) - goto next_entry; - link->conf.ConfigIndex = cfg->index; - -/* Does this card need audio output? */ -/* if (cfg->flags & CISTPL_CFTABLE_AUDIO) { -link->conf.Attributes |= CONF_ENABLE_SPKR; -link->conf.Status = CCSR_AUDIO_ENA; -} -*/ -/* Do we need to allocate an interrupt? */ -if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) - link->conf.Attributes |=CONF_ENABLE_IRQ ; - -/* IO window settings */ - link->io.NumPorts1 = link->io.NumPorts2 =0 ; -if ((cfg->io.nwin >0 ) || (dflt.io.nwin >0 )) { -cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; - link->io.Attributes1 =IO_DATA_PATH_WIDTH_AUTO ; -if (!(io->flags &CISTPL_IO_8BIT )) - link->io.Attributes1 =IO_DATA_PATH_WIDTH_16 ; -if (!(io->flags &CISTPL_IO_16BIT )) - link->io.Attributes1 =IO_DATA_PATH_WIDTH_8 ; - link->io.IOAddrLines = io->flags &CISTPL_IO_LINES_MASK ; - link->io.BasePort1 = io->win[0 ].base; - link->io.NumPorts1 = io->win[0 ].len; -if (io->nwin >1 ) { - link->io.Attributes2 = link->io.Attributes1; - link->io.BasePort2 = io->win[1 ].base; - link->io.NumPorts2 = io->win[1 ].len; - } -/* This reserves IO space but doesn't actually enable it */ -if (pcmcia_request_io (link, &link->io)) - goto next_entry; +/* Do we need to allocate an interrupt? */ +if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) + p_dev->conf.Attributes |=CONF_ENABLE_IRQ ; + +/* IO window settings */ + p_dev->io.NumPorts1 = p_dev->io.NumPorts2 =0 ; +if ((cfg->io.nwin >0 ) || (dflt->io.nwin >0 )) { +cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; + p_dev->io.Attributes1 =IO_DATA_PATH_WIDTH_AUTO ; +if (!(io->flags &CISTPL_IO_8BIT )) + p_dev->io.Attributes1 =IO_DATA_PATH_WIDTH_16 ; +if (!(io->flags &CISTPL_IO_16BIT )) + p_dev->io.Attributes1 =IO_DATA_PATH_WIDTH_8 ; + p_dev->io.IOAddrLines = io->flags &CISTPL_IO_LINES_MASK ; + p_dev->io.BasePort1 = io->win[0 ].base; + p_dev->io.NumPorts1 = io->win[0 ].len; +if (io->nwin >1 ) { + p_dev->io.Attributes2 = p_dev->io.Attributes1; + p_dev->io.BasePort2 = io->win[1 ].base; + p_dev->io.NumPorts2 = io->win[1 ].len; } +/* This reserves IO space but doesn't actually enable it */ +return pcmcia_request_io (p_dev, &p_dev->io); + } -/* If we got this far, we're cool! */ -break ; +return 0 ; +} + +static void das16cs_pcmcia_config (struct pcmcia_device *link) +{ +struct local_info_t *dev = link->priv; +int ret; -next_entry: - last_fn = GetNextTuple; +dev_dbg (&link->dev,"das16cs_pcmcia_config\n" ); - last_ret =pcmcia_get_next_tuple (link, &tuple); -if (last_ret) - goto cs_failed; + ret =pcmcia_loop_config (link, das16cs_pcmcia_config_loop,NULL ); +if (ret) { +dev_warn (&link->dev,"no configuration found\n" ); + goto failed; }/*
@@ -891,21 +786,18 @@ next_entry:irq structure is initialized. */ if (link->conf.Attributes &CONF_ENABLE_IRQ ) { - last_fn = RequestIRQ; - - last_ret =pcmcia_request_irq (link, &link->irq); -if (last_ret) - goto cs_failed; + ret =pcmcia_request_irq (link, &link->irq); +if (ret) + goto failed; }/* This actually configures the PCMCIA socket -- setting up the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - last_fn = RequestConfiguration; - last_ret =pcmcia_request_configuration (link, &link->conf); -if (last_ret) - goto cs_failed; + ret =pcmcia_request_configuration (link, &link->conf); +if (ret) + goto failed;/* At this point, the dev_node_t structure(s) need to be
@@ -930,14 +822,13 @@ next_entry:return ; -cs_failed: -cs_error (link, last_fn, last_ret); +failed:das16cs_pcmcia_release (link); }/* das16cs_pcmcia_config */ static void das16cs_pcmcia_release (struct pcmcia_device *link) { -DEBUG (0 ,"das16cs_pcmcia_release(0x%p)\n" , link); +dev_dbg (&link->dev,"das16cs_pcmcia_release\n" );pcmcia_disable_device (link); }/* das16cs_pcmcia_release */
@@ -983,14 +874,13 @@ struct pcmcia_driver das16cs_driver = {static int __init init_das16cs_pcmcia_cs (void ) { -DEBUG (0 ,"%s\n" , version);pcmcia_register_driver (&das16cs_driver);return 0 ; } static void __exit exit_das16cs_pcmcia_cs(void) { -DEBUG (0 ,"das16cs_pcmcia_cs: unloading\n" ); +pr_debug ("das16cs_pcmcia_cs: unloading\n" );pcmcia_unregister_driver (&das16cs_driver); }
drivers/staging/comedi/drivers/das08_cs.c +55 -147
267 lines not on this page · raw message
drivers/staging/comedi/drivers/ni_daq_700.c +78 -158
309 lines not on this page · raw message
drivers/staging/comedi/drivers/ni_daq_dio24.c +77 -158
308 lines not on this page · raw message
drivers/staging/comedi/drivers/ni_labpc_cs.c +75 -149
297 lines not on this page · raw message
drivers/staging/comedi/drivers/ni_mio_cs.c +29 -98
165 lines not on this page · raw message
drivers/staging/comedi/drivers/quatech_daqp_cs.c +55 -160
294 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Greg KH
Acked-by Greg Kroah-HartmanRe: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
Quoted 7 lines · Dominik Brodowski
From: Dominik Brodowski <[email protected]>
Date: Thu, 29 Oct 2009 00:54:49 +0100
Subject: [PATCH 1/1] pcmcia/staging: update comedi driversUpdate comedi PCMCIA drivers to work with recent PCMCIA changes documented in
Documentation/pcmcia/driver-changes.txt:
Quoted 6 lines
- use
pcmcia_config_loop()
- don't usePCMCIA_DEBUG, but usedev_dbg()
- don't usecs_error()
- re-useprod_idandcard_idvalues already storedSigned-off-by Dominik Brodowski <[email protected]>
Looks good to me, feel free to add:
to it.
thanks,
greg k-h
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
In reply to Dominik BrodowskiQuoted 24 lines · On Thu, 29 Oct 2009 01:02:50 +0100 Dominik Brodowski wrote:
Quoted 23 lines · Dominik Brodowski
Quoted 21 lines · Greg KH
Quoted 12 lines · Dominik Brodowski
Randy,
Quoted 9 lines · Randy Dunlap
Quoted 2 lines
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple'drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data'drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'Quoted 5 lines
Quoted 2 lines
There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
What are the current rules on drivers in staging/ ? Do they need to be updated as well on API changes?
You don't have to do it, no. I'll be glad to do so as long as I get a hint as to what needs to be done :)
Quoted 8 lines
Quoted 3 lines
These hints are in
Documentation/pcmcia/driver-changes.txt. However, I'll try to get some patches cooked up myself tonight for those drivers. Whom shall I submit them to, or shall I just add them to the PCMCIA tree?Update all changes (already those not included in linux-next) which are in the queue for 2.6.33 for all comedi PCMCIA drivers. Compile-tested only, and I'll queue it up with the other PCMCIA patches.
Thanks for the update. What is the patch made against? I cannot apply it cleanly to linux-next-2009102*.
Quoted 14 lines
From: Dominik Brodowski <[email protected]>
Date: Thu, 29 Oct 2009 00:54:49 +0100
Subject: [PATCH 1/1] pcmcia/staging: update comedi driversUpdate comedi PCMCIA drivers to work with recent PCMCIA changes documented in
Documentation/pcmcia/driver-changes.txt:- use
pcmcia_config_loop()
- don't usePCMCIA_DEBUG, but usedev_dbg()
- don't usecs_error()
- re-useprod_idandcard_idvalues already storedSigned-off-by Dominik Brodowski <[email protected]>
Quoted 9 lines
--- drivers/staging/comedi/drivers/cb_das16_cs.c | 220 +++++--------------- drivers/staging/comedi/drivers/das08_cs.c | 202 +++++-------------- drivers/staging/comedi/drivers/ni_daq_700.c | 236 +++++++--------------- drivers/staging/comedi/drivers/ni_daq_dio24.c | 235 +++++++--------------- drivers/staging/comedi/drivers/ni_labpc_cs.c | 224 +++++++-------------- drivers/staging/comedi/drivers/ni_mio_cs.c | 127 +++--------- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 215 +++++--------------- 7 files changed, 424 insertions(+), 1035 deletions(-)
---
~Randy
Re: [PATCH 9/9] pcmcia: remove pcmcia_get_{first,next}_tuple()
Quoted 30 lines · Randy Dunlap
Quoted 28 lines · On Thu, 29 Oct 2009 01:02:50 +0100 Dominik Brodowski wrote:
Quoted 26 lines · Dominik Brodowski
Quoted 13 lines · Greg KH
Quoted 12 lines · Dominik Brodowski
Randy,
Quoted 9 lines · Randy Dunlap
Quoted 2 lines
Remove the pcmcia_get_{first,next}_tuple() calls no longer needed by (current) pcmcia device drivers.
linux-next 20091026:
drivers/staging/comedi/drivers/cb_das16_cs.c:155: error: implicit declaration of function 'pcmcia_get_first_tuple'drivers/staging/comedi/drivers/cb_das16_cs.c:156: error: implicit declaration of function 'pcmcia_get_tuple_data'drivers/staging/comedi/drivers/cb_das16_cs.c:883: error: implicit declaration of function 'pcmcia_get_next_tuple'Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
There are also other comedi/ drivers that this randconfig didn't attempt to build that are still using these same interfaces.
What are the current rules on drivers in staging/ ? Do they need to be updated as well on API changes?
You don't have to do it, no. I'll be glad to do so as long as I get a hint as to what needs to be done :)
These hints are in
Documentation/pcmcia/driver-changes.txt. However, I'll try to get some patches cooked up myself tonight for those drivers. Whom shall I submit them to, or shall I just add them to the PCMCIA tree?
Quoted 6 lines
Quoted 4 lines
Update all changes (already those not included in linux-next) which are in the queue for 2.6.33 for all comedi PCMCIA drivers. Compile-tested only, and I'll queue it up with the other PCMCIA patches.
Thanks for the update. What is the patch made against?
2.6.32-rc5 and quite a lot of pcmcia patches which I'll submit for 2.6.33-rc1. Will put it into the repository which "next" pulls from soon.
Best,
Dominik
Re: [PATCH 3/9] pcmcia: use pcmcia_loop_config in misc pcmcia drivers
In reply to Dominik BrodowskiQuoted 12 lines · Dominik Brodowski
Use
pcmcia_loop_config()in a few drivers missed during the first round. Onfmvj18x_cs.cit -- strangely -- only requries us to set conf.ConfigIndex, which is done by the core, so include an empty loop function which returns 0 unconditionally.CC David S. Miller <[email protected]>CC John W. Linville <[email protected]>CC Jiri Kosina <[email protected]>CC David Sterba <[email protected]>Signed-off-by Dominik Brodowski <[email protected]>
Quoted 2 lines
--- drivers/char/pcmcia/ipwireless/main.c | 103 +++++++--------------------------
For the ipwireless part
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
A message that is not in the archive (sent off-list or not yet received): 1255907255-28297-3-git-send-email-linux-X3ehHDuj6sIIGcDfoQAp7OTW4wlIGRCZ@public.gmane.org
John W. Linville
Acked-byRe: [PATCH 3/9] pcmcia: use pcmcia_loop_config in misc pcmcia drivers
Quoted 5 lines · Dominik Brodowski
Use
pcmcia_loop_config()in a few drivers missed during the first round. Onfmvj18x_cs.cit -- strangely -- only requries us to set conf.ConfigIndex, which is done by the core, so include an empty loop function which returns 0 unconditionally.
Quoted 7 lines
CC David S. Miller <davem-fT/PcQaiUtIeIZ0/[email protected]>CC John W. Linville <[email protected]>CC Jiri Kosina <[email protected]>CC David Sterba <[email protected]>Signed-off-by Dominik Brodowski <[email protected]>
Signature · 6 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/9] pcmcia: use pre-determined values
In reply to Dominik BrodowskiQuoted 13 lines · Dominik Brodowski
A few PCMCIA network drivers can make use of values provided by the pcmcia core, instead of tedious, independent CIS parsing.
xirc32ps_cs.c:manf_id
hostap_cs.c: multifunction count
b43/pcmcia.c: ConfigBase address and "Present"
smc91c92_cs.c: By default,mhz_setup()can useVERS_1as it is stored in structpcmcia_device. Only some cards require workarounds, such as reading outVERS_1twice.
Quoted 5 lines
CC David S. Miller <[email protected]>CC John W. Linville <[email protected]>Signed-off-by Dominik Brodowski <[email protected]>
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Hi,
Please don't remove the code below.
This code loades the "2nd" ConfigBase of the multi-function card.
Quoted 37 lines
static int
serial_config(struct pcmcia_device * link){ struct serial_info *info = link->priv;drivers/serial/serial_cs.c +1
-6-struct serial_cfg_mem *cfg_mem; -tuple_t *tuple; -u_char *buf; -cisparse_t *parse; -cistpl_cftable_entry_t *cf; -int i, last_ret, last_fn; +int i;DEBUG(0, "serial_config(0x%p)\n", link);drivers/serial/serial_cs.c +0
-24- cfg_mem =kmalloc (sizeof (struct serial_cfg_mem ),GFP_KERNEL ); -if (!cfg_mem) - goto failed; - - tuple = &cfg_mem->tuple; - parse = &cfg_mem->parse; - cf = &parse->cftable_entry; - buf = cfg_mem->buf; - - tuple->TupleData = (cisdata_t *) buf; - tuple->TupleOffset =0 ; - tuple->TupleDataMax =255 ; - tuple->Attributes =0 ; - -/* Get configuration register information */ - tuple->DesiredTuple =CISTPL_CONFIG ; - last_ret =first_tuple (link, tuple, parse); -if (last_ret !=0 ) { - last_fn = ParseTuple; - goto cs_failed; - } - link->conf.ConfigBase = parse->config.base; - link->conf.Present = parse->config.rmask[0 ]; -
Hey,
Quoted 2 lines · Komuro
Please don't remove the code below.
This code loades the "2nd" ConfigBase of the multi-function card.
isn't this properly handled by the patch
pcmcia: pccard_read tuple and TUPLE_RETURN_COMMON cleanup
Best,
Dominik
Hi,
Quoted 7 lines · Komuro
Quoted 2 lines
Please don't remove the code below.
This code loades the "2nd" ConfigBase of the multi-function card.isn't this properly handled by the patch
pcmcia:
pccard_readtuple andTUPLE_RETURN_COMMONcleanup
OK.
works.
Best Regards
Komuro
Hey,
Quoted 6 lines · Komuro
Hi,
Quoted 4 lines · Komuro
Quoted 2 lines
Please don't remove the code below.
This code loades the "2nd" ConfigBase of the multi-function card.
Quoted 7 lines
Quoted 3 lines
isn't this properly handled by the patch
pcmcia:
pccard_readtuple andTUPLE_RETURN_COMMONcleanupOK.
works.
Thanks for testing!
Dominik