On Thu, Dec 23, 2010 at 10:50:44AM +0100, Stano LanĨi wrote:
> Use pcmcia_get_mac_from_cis() to retrieve MAC address.
> Remove unused header file.
Looks good, just your Signed-off-by - Line seems to be missing. Otherwise:
Reviewed-by: Dominik Brodowski <[email protected]>
>
> ---
> drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 95
> ++++++----------------
> drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.h | 1 -
> drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 31 ++++----
> 3 files changed, 40 insertions(+), 87 deletions(-)
> delete mode 100644 drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.h
>
> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> index 35693c8..a9a7c13 100644
> --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> @@ -77,9 +77,7 @@ MODULE_LICENSE("GPL");
>
> /*====================================================================*/
>
> -struct net_device *init_ft1000_card(int, int, unsigned char *,
> - void *ft1000_reset, struct pcmcia_device * link,
> - struct device *fdev);
> +struct net_device *init_ft1000_card(struct pcmcia_device *link, void
> *ft1000_reset);
> void stop_ft1000_card(struct net_device *);
>
> static int ft1000_config(struct pcmcia_device *link);
> @@ -160,53 +158,18 @@ static void ft1000_detach(struct pcmcia_device *link)
> if (dev) {
> stop_ft1000_card(dev);
> }
> -
> - pcmcia_disable_device(link);
> + pcmcia_disable_device(link);
>
> /* This points to the parent local_info_t struct */
> free_netdev(dev);
> -
> } /* ft1000_detach */
>
> /*======================================================================
>
> - Check if the current tuple contains MAC address.
> - Return 0 if MAC was found else return 1.
> -
> -======================================================================*/
> -int ft1000_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple, void *priv)
> -{
> - int i;
> - cisparse_t parse;
> - cistpl_lan_node_id_t *node_id;
> -
> - if (!pcmcia_parse_tuple(tuple, &parse)) {
> - if (parse.funce.type == CISTPL_FUNCE_LAN_NODE_ID) {
> - node_id = (cistpl_lan_node_id_t *) parse.funce.data;
> - if (node_id->nb == 6) {
> - for (i = 0; i < 6; i++)
> - *((unsigned char *)priv + i) =
> - node_id->id[i];
> - /*
> - * we found MAC address and will
> - * end the pcmcia_loop_tuple
> - */
> - return 0;
> - }
> - }
> - }
> - /*
> - * we did not find MAC address in this tuple
> - * continue pcmcia_loop_tuple
> - */
> - return 1;
> -} /* ft1000_get_mac */
> -
> -/*======================================================================
> -
> Check if the io window is configured
>
> ======================================================================*/
> +
> int ft1000_confcheck(struct pcmcia_device *link, void *priv_data)
> {
>
> @@ -223,42 +186,34 @@ int ft1000_confcheck(struct pcmcia_device *link, void
> *priv_data)
>
> static int ft1000_config(struct pcmcia_device *link)
> {
> - int ret;
> - unsigned char mac_address[6];
> -
> - dev_dbg(&link->dev, "ft1000_cs: ft1000_config(0x%p)\n", link);
> -
> - /* setup IO window */
> - ret = pcmcia_loop_config(link, ft1000_confcheck, NULL);
> - if (ret) {
> - printk(KERN_INFO "ft1000: Could not configure pcmcia\n");
> - goto failed;
> + int ret;
> + dev_dbg(&link->dev, "ft1000_cs: ft1000_config(0x%p)\n", link);
> +
> + /* setup IO window */
> + ret = pcmcia_loop_config(link, ft1000_confcheck, NULL);
> + if (ret) {
> + printk(KERN_INFO "ft1000: Could not configure pcmcia\n");
> + return -ENODEV;
> }
>
> - /* configure device */
> - ret = pcmcia_enable_device(link);
> - if (ret)
> - goto failed;
> -
> - /* get the MAC address */
> - ret = pcmcia_loop_tuple(link, CISTPL_FUNCE,
> - ft1000_get_mac, mac_address);
> - if (ret)
> - goto failed;
> + /* configure device */
> + ret = pcmcia_enable_device(link);
> + if (ret) {
> + printk(KERN_INFO "ft1000: Could not enable pcmcia\n");
> + ft1000_release(link);
> + return -ENODEV;
> + }
>
> - ((local_info_t *) link->priv)->dev =
> - init_ft1000_card(link->irq, link->resource[0]->start,
> - &mac_address[0], &ft1000_reset, link,
> - &link->dev);
> + ((local_info_t *) link->priv)->dev = init_ft1000_card(link,
> &ft1000_reset);
> + if (((local_info_t *) link->priv)->dev == NULL) {
> + printk(KERN_INFO "ft1000: Could not register as network device\n");
> + ft1000_release(link);
> + return -ENODEV;
> + }
>
> /* Finally, report what we've done */
>
> return 0;
> -
> -failed:
> - ft1000_release(link);
> - return -ENODEV;
> -
> } /* ft1000_config */
>
> /*======================================================================
> @@ -284,7 +239,7 @@ static void ft1000_release(struct pcmcia_device * link)
> In a normal driver, additional code may be needed to release
> other kernel data structures associated with this device.
> */
> -
> + kfree( (local_info_t *) link->priv);
> /* Don't bother checking to see if these succeed or not */
>
> pcmcia_disable_device(link);
> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.h
> b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.h
> deleted file mode 100644
> index 2b5e383..0000000
> --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.h
> +++ /dev/null
> @@ -1 +0,0 @@
> -#define CS_SUCCESS 0x00
> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> index 5f5a669..57a4475 100644
> --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> @@ -43,6 +43,10 @@
> #include <linux/firmware.h>
> #include <linux/ethtool.h>
>
> +#include <pcmcia/cistpl.h>
> +#include <pcmcia/cisreg.h>
> +#include <pcmcia/ds.h>
> +
> #ifdef FT_DEBUG
> #define DEBUG(n, args...) printk(KERN_DEBUG args);
> #else
> @@ -2148,13 +2152,10 @@ static const struct ethtool_ops ops = {
> .get_link = ft1000_get_link
> };
>
> -struct net_device *init_ft1000_card(unsigned short irq, int port,
> - unsigned char *mac_addr, void *ft1000_reset,
> - void *link, struct device *fdev)
> +struct net_device *init_ft1000_card(struct pcmcia_device *link, void
> *ft1000_reset)
> {
> FT1000_INFO *info;
> struct net_device *dev;
> - int i;
>
> static const struct net_device_ops ft1000ops = // Slavius
> 21.10.2009 due to kernel changes
> {
> @@ -2165,8 +2166,8 @@ struct net_device *init_ft1000_card(unsigned short
> irq, int port,
> };
>
> DEBUG(1, "ft1000_hw: init_ft1000_card()\n");
> - DEBUG(1, "ft1000_hw: irq = %d\n", irq);
> - DEBUG(1, "ft1000_hw: port = 0x%04x\n", port);
> + DEBUG(1, "ft1000_hw: irq = %d\n", link->irq);
> + DEBUG(1, "ft1000_hw: port = 0x%04x\n", link->resource[0]->start);
>
> flarion_ft1000_cnt++;
>
> @@ -2184,7 +2185,7 @@ struct net_device *init_ft1000_card(unsigned short
> irq, int port,
> return NULL;
> }
>
> - SET_NETDEV_DEV(dev, fdev);
> + SET_NETDEV_DEV(dev, &link->dev);
> info = (FT1000_INFO *) netdev_priv(dev);
>
> memset(info, 0, sizeof(FT1000_INFO));
> @@ -2227,15 +2228,13 @@ struct net_device *init_ft1000_card(unsigned short
> irq, int port,
>
> DEBUG(0, "device name = %s\n", dev->name);
>
> - for (i = 0; i < 6; i++) {
> - dev->dev_addr[i] = mac_addr[i];
> - DEBUG(1, "ft1000_hw: mac_addr %d = 0x%02x\n", i, mac_addr[i]);
> + dev->irq = link->irq;
> + dev->base_addr = link->resource[0]->start;
> + if (pcmcia_get_mac_from_cis(link,dev)) {
> + printk(KERN_ERR "ft1000: Could not read mac address\n");
> + goto err_dev;
> }
>
> - netif_stop_queue(dev);
> - dev->irq = irq;
> - dev->base_addr = port;
> -
> if (request_irq(dev->irq, ft1000_interrupt, IRQF_SHARED, dev->name,
> dev)) {
> printk(KERN_ERR "ft1000: Could not request_irq\n");
> goto err_dev;
> @@ -2254,13 +2253,13 @@ struct net_device *init_ft1000_card(unsigned short
> irq, int port,
> info->AsicID = ft1000_read_reg(dev, FT1000_REG_ASIC_ID);
> if (info->AsicID == ELECTRABUZZ_ID) {
> DEBUG(0, "ft1000_hw: ELECTRABUZZ ASIC\n");
> - if (request_firmware(&fw_entry, "ft1000.img", fdev) != 0) {
> + if (request_firmware(&fw_entry, "ft1000.img", &link->dev) != 0) {
> printk(KERN_INFO "ft1000: Could not open ft1000.img\n");
> goto err_unreg;
> }
> } else {
> DEBUG(0, "ft1000_hw: MAGNEMITE ASIC\n");
> - if (request_firmware(&fw_entry, "ft2000.img", fdev) != 0) {
> + if (request_firmware(&fw_entry, "ft2000.img", &link->dev) != 0) {
> printk(KERN_INFO "ft1000: Could not open ft2000.img\n");
> goto err_unreg;
> }
> --
> 1.7.1
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel