linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix ft1000-pcmcia driver.
@ 2010-12-17  8:13 Marek Belisko
  2010-12-17  8:13 ` [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors Marek Belisko
  2010-12-17  8:13 ` [PATCH 2/2] staging: ft1000-pcmcia: Fix compilation warning Marek Belisko
  0 siblings, 2 replies; 6+ messages in thread
From: Marek Belisko @ 2010-12-17  8:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, chl.pixo, Marek Belisko

Following patches fix compilation errors in ft1000-pcmcia driver.
Driver was marked as BROKEN.

Thanks chl.pixo@gmail.com for his contribution and testing.

Marek Belisko (2):
  staging: ft1000-pcmcia: Fix compilation errors.
  staging: ft1000-pcmcia: Fix compilation warning.

 drivers/staging/ft1000/Kconfig                     |    2 +-
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c   |  286 +++++---------------
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c |    2 +-
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c   |    2 +-
 4 files changed, 70 insertions(+), 222 deletions(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors.
  2010-12-17  8:13 [PATCH 0/2] Fix ft1000-pcmcia driver Marek Belisko
@ 2010-12-17  8:13 ` Marek Belisko
  2010-12-17 13:04   ` Dominik Brodowski
  2010-12-17  8:13 ` [PATCH 2/2] staging: ft1000-pcmcia: Fix compilation warning Marek Belisko
  1 sibling, 1 reply; 6+ messages in thread
From: Marek Belisko @ 2010-12-17  8:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, chl.pixo, Marek Belisko

Following patch will fix all compilation errors. Main problems
was with pcmcia API changes. Also remove BROKEN as now driver
is properly build.

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 drivers/staging/ft1000/Kconfig                   |    2 +-
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c |  286 +++++-----------------
 2 files changed, 68 insertions(+), 220 deletions(-)

diff --git a/drivers/staging/ft1000/Kconfig b/drivers/staging/ft1000/Kconfig
index d6da130..c54b4e8 100644
--- a/drivers/staging/ft1000/Kconfig
+++ b/drivers/staging/ft1000/Kconfig
@@ -13,7 +13,7 @@ config FT1000_USB
 
 config FT1000_PCMCIA
 	tristate "Driver for ft1000 pcmcia device."
-	depends on PCMCIA && BROKEN
+	depends on PCMCIA
 	depends on NET
 	help
 	  Say Y if you want to have support for Flarion card also called
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
index 2163eae..71c3a83 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
@@ -39,9 +39,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 
-//#include <pcmcia/version.h>		// Slavius 21.10.2009 removed from kernel
-#include <pcmcia/cs_types.h>
-#include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/cisreg.h>
 #include <pcmcia/ds.h>
@@ -51,8 +48,6 @@
 #include <asm/byteorder.h>
 #include <asm/uaccess.h>
 
-#include "ft1000_cs.h"			// Slavius 21.10.2009 because CS_SUCCESS constant is missing due to removed pcmcia/version.h
-
 /*====================================================================*/
 
 /* Module parameters */
@@ -111,73 +106,7 @@ typedef struct local_info_t {
 
 static void ft1000_reset(struct pcmcia_device * link)
 {
-	conf_reg_t reg;
-
-	DEBUG(0, "ft1000_cs:ft1000_reset is called................\n");
-
-	/* Soft-Reset card */
-	reg.Action = CS_WRITE;
-	reg.Offset = CISREG_COR;
-	reg.Value = COR_SOFT_RESET;
-	pcmcia_access_configuration_register(link, &reg);
-
-	/* Wait until the card has acknowledged our reset */
-	udelay(2);
-
-	/* Restore original COR configuration index */
-	/* Need at least 2 write to respond */
-	reg.Action = CS_WRITE;
-	reg.Offset = CISREG_COR;
-	reg.Value = COR_DEFAULT;
-	pcmcia_access_configuration_register(link, &reg);
-
-	/* Wait until the card has finished restarting */
-	udelay(1);
-
-	reg.Action = CS_WRITE;
-	reg.Offset = CISREG_COR;
-	reg.Value = COR_DEFAULT;
-	pcmcia_access_configuration_register(link, &reg);
-
-	/* Wait until the card has finished restarting */
-	udelay(1);
-
-	reg.Action = CS_WRITE;
-	reg.Offset = CISREG_COR;
-	reg.Value = COR_DEFAULT;
-	pcmcia_access_configuration_register(link, &reg);
-
-	/* Wait until the card has finished restarting */
-	udelay(1);
-
-}
-
-/*====================================================================*/
-
-static int get_tuple_first(struct pcmcia_device *link, tuple_t * tuple,
-			   cisparse_t * parse)
-{
-	int i;
-	i = pcmcia_get_first_tuple(link, tuple);
-	if (i != CS_SUCCESS)
-		return i;
-	i = pcmcia_get_tuple_data(link, tuple);
-	if (i != CS_SUCCESS)
-		return i;
-	return pcmcia_parse_tuple(tuple, parse);	// Slavius 21.10.2009 removed unused link parameter
-}
-
-static int get_tuple_next(struct pcmcia_device *link, tuple_t * tuple,
-			  cisparse_t * parse)
-{
-	int i;
-	i = pcmcia_get_next_tuple(link, tuple);
-	if (i != CS_SUCCESS)
-		return i;
-	i = pcmcia_get_tuple_data(link, tuple);
-	if (i != CS_SUCCESS)
-		return i;
-	return pcmcia_parse_tuple(tuple, parse);	// Slavius 21.10.2009 removed unused link parameter
+	pcmcia_reset_card(link->socket);
 }
 
 /*======================================================================
@@ -202,13 +131,10 @@ static int ft1000_attach(struct pcmcia_device *link)
 	link->priv = local;
 	local->dev = NULL;
 
-	link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
-	link->irq.IRQInfo1 = IRQ_LEVEL_ID;
-	link->conf.Attributes = CONF_ENABLE_IRQ;
-	link->conf.IntType = INT_MEMORY_AND_IO;
-	link->irq.Handler = NULL;
+	link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
 
 	return ft1000_config(link);
+
 }				/* ft1000_attach */
 
 /*======================================================================
@@ -235,7 +161,7 @@ static void ft1000_detach(struct pcmcia_device *link)
 		stop_ft1000_card(dev);
 	}
 
-	ft1000_release(link);
+	pcmcia_disable_device(link);
 
 	/* This points to the parent local_info_t struct */
 	free_netdev(dev);
@@ -244,166 +170,91 @@ static void ft1000_detach(struct pcmcia_device *link)
 
 /*======================================================================
 
-    ft1000_config() is scheduled to run after a CARD_INSERTION event
-    is received, to configure the PCMCIA socket, and to make the
-    device available to the system.
+    Check if the current tuple contains MAC address.
+    Return 0 if MAC was found else return 1.
 
 ======================================================================*/
-
-#define CS_CHECK(fn, ret) \
-	do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-
-#define CFG_CHECK(fn, ret) \
-	last_fn = (fn); if ((last_ret = (ret)) != 0) goto next_entry
-
-static int ft1000_config(struct pcmcia_device * link)
+int ft1000_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple, void *priv)
 {
-	tuple_t tuple;
+	int i;
 	cisparse_t parse;
-	int last_fn, last_ret, i;
-	u_char buf[64];
 	cistpl_lan_node_id_t *node_id;
-	cistpl_cftable_entry_t dflt = { 0 };
-	cistpl_cftable_entry_t *cfg;
-	unsigned char mac_address[6];
-
-	DEBUG(0, "ft1000_cs: ft1000_config(0x%p)\n", link);
 
+	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;
+			}
+		}
+	}
 	/*
-	   This reads the card's CONFIG tuple to find its configuration
-	   registers.
+	 * we did not find MAC address in this tuple
+	 * continue pcmcia_loop_tuple
 	 */
-//	tuple.DesiredTuple = CISTPL_CONFIG;
-//	tuple.Attributes = 0;
-	tuple.TupleData = buf;
-	tuple.TupleDataMax = sizeof(buf);
-	tuple.TupleOffset = 0;
-//	CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
-//	CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
-//	CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
-//	link->conf.ConfigBase = parse.config.base;
-//	link->conf.Present = parse.config.rmask[0];
+	return 1;
+}                               /* ft1000_get_mac */
 
-	/*
-	   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;
-	tuple.Attributes = 0;
-	CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
-	while (1) {
-		cfg = &(parse.cftable_entry);
-		CFG_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
-		CFG_CHECK(ParseTuple,
-			  pcmcia_parse_tuple(&tuple, &parse));		// Slavius 21.10.2009 removed unused link parameter
-
-		if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
-			dflt = *cfg;
-		if (cfg->index == 0)
-			goto next_entry;
-		link->conf.ConfigIndex = cfg->index;
-
-		/* 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)) {
-				DEBUG(0, "ft1000_cs: IO_DATA_PATH_WIDTH_16\n");
-				link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
-			}
-			if (!(io->flags & CISTPL_IO_16BIT)) {
-				DEBUG(0, "ft1000_cs: IO_DATA_PATH_WIDTH_8\n");
-				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 */
-			pcmcia_request_io(link, &link->io);
-		}
+/*======================================================================
 
-		break;
+   Check if the io window is configured
 
-	 next_entry:
-		last_ret = pcmcia_get_next_tuple(link, &tuple);
-	}
-	if (last_ret != CS_SUCCESS) {
-		cs_error(link, RequestIO, last_ret);
-		goto failed;
-	}
+======================================================================*/
+int ft1000_confcheck(struct pcmcia_device *link, void *priv_data)
+{
 
-	/*
-	   Allocate an interrupt line.  Note that this does not assign a
-	   handler to the interrupt, unless the 'Handler' member of the
-	   irq structure is initialized.
-	 */
-		CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
+	return pcmcia_request_io(link);
+}				/* ft1000_confcheck */
 
-	/*
-	   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.
-	 */
-	CS_CHECK(RequestConfiguration,
-		 pcmcia_request_configuration(link, &link->conf));
-
-	/* Get MAC address from tuples */
-
-	tuple.Attributes = tuple.TupleOffset = 0;
-	tuple.TupleData = buf;
-	tuple.TupleDataMax = sizeof(buf);
-
-	/* Check for a LAN function extension tuple */
-	tuple.DesiredTuple = CISTPL_FUNCE;
-	i = get_tuple_first(link, &tuple, &parse);
-	while (i == CS_SUCCESS) {
-		if (parse.funce.type == CISTPL_FUNCE_LAN_NODE_ID)
-			break;
-		i = get_tuple_next(link, &tuple, &parse);
-	}
+/*======================================================================
 
-	if (i == CS_SUCCESS) {
-		node_id = (cistpl_lan_node_id_t *) parse.funce.data;
-		if (node_id->nb == 6) {
-			for (i = 0; i < 6; i++)
-				mac_address[i] = node_id->id[i];
-		}
+    ft1000_config() is scheduled to run after a CARD_INSERTION event
+    is received, to configure the PCMCIA socket, and to make the
+    device available to the system.
+
+======================================================================*/
+
+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;
 	}
 
-	((local_info_t *) link->priv)->dev =
-		init_ft1000_card(link->irq.AssignedIRQ, link->io.BasePort1,
-				 &mac_address[0], ft1000_reset, link,
-				 &handle_to_dev(link));
+	/* configure device */
+	ret = pcmcia_enable_device(link);
+	if (ret)
+		goto failed;
 
-	/*
-	   At this point, the dev_node_t structure(s) need to be
-	   initialized and arranged in a linked list at link->dev.
-	 */
+	/* get the MAC address */
+	ret = pcmcia_loop_tuple(link, CISTPL_FUNCE,
+				ft1000_get_mac, mac_address);
+	if (ret)
+		goto failed;
+
+	((local_info_t *) link->priv)->dev =
+		init_ft1000_card(link->irq, link->resource[0]->start,
+				 &mac_address[0], &ft1000_reset, link,
+				 &link->dev);
 
 	/* Finally, report what we've done */
 
 	return 0;
 
-cs_failed:
-	cs_error(link, last_fn, last_ret);
 failed:
 	ft1000_release(link);
 	return -ENODEV;
@@ -429,9 +280,6 @@ static void ft1000_release(struct pcmcia_device * link)
 	   no one will try to access the device or its data structures.
 	 */
 
-	/* Unlink the device chain */
-	link->dev_node = NULL;
-
 	/*
 	   In a normal driver, additional code may be needed to release
 	   other kernel data structures associated with this device.
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] staging: ft1000-pcmcia: Fix compilation warning.
  2010-12-17  8:13 [PATCH 0/2] Fix ft1000-pcmcia driver Marek Belisko
  2010-12-17  8:13 ` [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors Marek Belisko
@ 2010-12-17  8:13 ` Marek Belisko
  1 sibling, 0 replies; 6+ messages in thread
From: Marek Belisko @ 2010-12-17  8:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, chl.pixo, Marek Belisko

Fix following compilation warning:
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:
In function ‘ft1000_reset_card’:

drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:525:2:
warning: passing argument 2 of ‘card_download’ discards qualifiers from pointer target type

drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:56:5:
note: expected ‘void *’ but argument is of type ‘const u8 * const’

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c |    2 +-
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
index 0bf398d..c56f588 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
@@ -310,7 +310,7 @@ USHORT hdr_checksum(PPSEUDO_HDR pHdr)
 	return chksum;
 }
 
-int card_download(struct net_device *dev, void *pFileStart, UINT FileLength)
+int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)
 {
 	FT1000_INFO *info = (PFT1000_INFO) netdev_priv(dev);
 	int Status = SUCCESS;
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index 588afd5..813e184 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -53,7 +53,7 @@
 #include "ft1000_dev.h"
 #include "ft1000.h"
 
-int card_download(struct net_device *dev, void *pFileStart, UINT FileLength);
+int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength);
 
 void ft1000InitProc(struct net_device *dev);
 void ft1000CleanupProc(struct net_device *dev);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors.
  2010-12-17  8:13 ` [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors Marek Belisko
@ 2010-12-17 13:04   ` Dominik Brodowski
  2010-12-17 13:16     ` Belisko Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Dominik Brodowski @ 2010-12-17 13:04 UTC (permalink / raw)
  To: Marek Belisko; +Cc: gregkh, devel, linux-kernel, chl.pixo

Hey,

On Fri, Dec 17, 2010 at 09:13:11AM +0100, Marek Belisko wrote:
> Following patch will fix all compilation errors. Main problems
> was with pcmcia API changes. Also remove BROKEN as now driver
> is properly build.

Thanks!

One question, though:

> +int ft1000_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple, void *priv)
>  {
> -	tuple_t tuple;
> +	int i;
>  	cisparse_t parse;
> -	int last_fn, last_ret, i;
> -	u_char buf[64];
>  	cistpl_lan_node_id_t *node_id;
> -	cistpl_cftable_entry_t dflt = { 0 };
> -	cistpl_cftable_entry_t *cfg;
> -	unsigned char mac_address[6];
> -
> -	DEBUG(0, "ft1000_cs: ft1000_config(0x%p)\n", link);
>  
> +	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;
> +			}
> +		}
> +	}
>  	/*
> -	   This reads the card's CONFIG tuple to find its configuration
> -	   registers.
> +	 * we did not find MAC address in this tuple
> +	 * continue pcmcia_loop_tuple
>  	 */
> -//	tuple.DesiredTuple = CISTPL_CONFIG;
> -//	tuple.Attributes = 0;
> -	tuple.TupleData = buf;
> -	tuple.TupleDataMax = sizeof(buf);
> -	tuple.TupleOffset = 0;
> -//	CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
> -//	CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
> -//	CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
> -//	link->conf.ConfigBase = parse.config.base;
> -//	link->conf.Present = parse.config.rmask[0];
> +	return 1;
> +}                               /* ft1000_get_mac */

...

> +	/* get the MAC address */
> +	ret = pcmcia_loop_tuple(link, CISTPL_FUNCE,
> +				ft1000_get_mac, mac_address);
> +	if (ret)
> +		goto failed;

Does this differ from the generic pcmcia_get_mac_from_cis() function, or
could we use this generic function for the purposes needed in this driver?

Best,
	Dominik

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors.
  2010-12-17 13:04   ` Dominik Brodowski
@ 2010-12-17 13:16     ` Belisko Marek
       [not found]       ` <AANLkTinD0f06h75dP9b9d8k3jZ2jbaYX2u=tRS4UWZbc@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Belisko Marek @ 2010-12-17 13:16 UTC (permalink / raw)
  To: Dominik Brodowski, Marek Belisko, gregkh, devel, linux-kernel, chl.pixo

Hi,

On Fri, Dec 17, 2010 at 2:04 PM, Dominik Brodowski
<linux@dominikbrodowski.net> wrote:
> Hey,
>
> On Fri, Dec 17, 2010 at 09:13:11AM +0100, Marek Belisko wrote:
>> Following patch will fix all compilation errors. Main problems
>> was with pcmcia API changes. Also remove BROKEN as now driver
>> is properly build.
>
> Thanks!
>
> One question, though:
>
>> +int ft1000_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple, void *priv)
>>  {
>> -     tuple_t tuple;
>> +     int i;
>>       cisparse_t parse;
>> -     int last_fn, last_ret, i;
>> -     u_char buf[64];
>>       cistpl_lan_node_id_t *node_id;
>> -     cistpl_cftable_entry_t dflt = { 0 };
>> -     cistpl_cftable_entry_t *cfg;
>> -     unsigned char mac_address[6];
>> -
>> -     DEBUG(0, "ft1000_cs: ft1000_config(0x%p)\n", link);
>>
>> +     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;
>> +                     }
>> +             }
>> +     }
>>       /*
>> -        This reads the card's CONFIG tuple to find its configuration
>> -        registers.
>> +      * we did not find MAC address in this tuple
>> +      * continue pcmcia_loop_tuple
>>        */
>> -//   tuple.DesiredTuple = CISTPL_CONFIG;
>> -//   tuple.Attributes = 0;
>> -     tuple.TupleData = buf;
>> -     tuple.TupleDataMax = sizeof(buf);
>> -     tuple.TupleOffset = 0;
>> -//   CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
>> -//   CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
>> -//   CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
>> -//   link->conf.ConfigBase = parse.config.base;
>> -//   link->conf.Present = parse.config.rmask[0];
>> +     return 1;
>> +}                               /* ft1000_get_mac */
>
> ...
>
>> +     /* get the MAC address */
>> +     ret = pcmcia_loop_tuple(link, CISTPL_FUNCE,
>> +                             ft1000_get_mac, mac_address);
>> +     if (ret)
>> +             goto failed;
>
> Does this differ from the generic pcmcia_get_mac_from_cis() function, or
> could we use this generic function for the purposes needed in this driver?
Thanks for reviewing. We miss such a helper function.  After checking
it do the same think.
@Greg: should resend or will send in next patch?
>
> Best,
>        Dominik
>

thanks,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors.
       [not found]       ` <AANLkTinD0f06h75dP9b9d8k3jZ2jbaYX2u=tRS4UWZbc@mail.gmail.com>
@ 2010-12-22 20:14         ` Dominik Brodowski
  0 siblings, 0 replies; 6+ messages in thread
From: Dominik Brodowski @ 2010-12-22 20:14 UTC (permalink / raw)
  To: Stano Lanči
  Cc: Belisko Marek, Marek Belisko, gregkh, devel, linux-kernel

Hey,

On Wed, Dec 22, 2010 at 05:14:14PM +0100, Stano Lanči wrote:
> I reviewed your suggestion to use pcmcia_get_mac_from_cis().
> The problem is we need net_device structure and we create it
> in init_ft1000_card() that needs the mac address as one input parameter.
> I can move the code for it to ft1000_hw.c that deals with network part of
> the code, but then if the pcmcia API change that file will also
> have to be reviewed.

If it isn't too much of a hassle to update ft1000_hw.c, I'd prefer that
approach, for I do not intend to change the pcmcia API in this regard. And
if I do, I'll feel responsible for fixing ft1000 as well :)

Best,
	Dominik

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-22 20:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-17  8:13 [PATCH 0/2] Fix ft1000-pcmcia driver Marek Belisko
2010-12-17  8:13 ` [PATCH 1/2] staging: ft1000-pcmcia: Fix compilation errors Marek Belisko
2010-12-17 13:04   ` Dominik Brodowski
2010-12-17 13:16     ` Belisko Marek
     [not found]       ` <AANLkTinD0f06h75dP9b9d8k3jZ2jbaYX2u=tRS4UWZbc@mail.gmail.com>
2010-12-22 20:14         ` Dominik Brodowski
2010-12-17  8:13 ` [PATCH 2/2] staging: ft1000-pcmcia: Fix compilation warning Marek Belisko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).