Re: [PATCH] pcmcia: fix up alignf issues

2010-04-05 Thread Komuro
Hi,

 cf-io.win[0].base returns 0 at smc_configcheck();
 So I think this is a pcmcia_request_io problem.

Actually, it seems to be an issue with rsrc_nonstatic. Attached is a patch
for 2.6.34-rc;

OK. works.


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCH] pcmcia: fix up alignf issues

2010-04-05 Thread Dominik Brodowski
On Mon, Apr 05, 2010 at 08:18:52PM +0900, Komuro wrote:
 Hi,
 
  cf-io.win[0].base returns 0 at smc_configcheck();
  So I think this is a pcmcia_request_io problem.
 
 Actually, it seems to be an issue with rsrc_nonstatic. Attached is a patch
 for 2.6.34-rc;
 
 OK. works.

Thanks for testing! 2.6.33 does not seem to have this problem. I'll push the
fix to Linus soon.

Best,
Dominik

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH] pcmcia: fix up alignf issues

2010-04-04 Thread Dominik Brodowski
Hey,

On Sun, Apr 04, 2010 at 09:13:44PM +0900, Komuro wrote:
 cf-io.win[0].base returns 0 at smc_configcheck();
 So I think this is a pcmcia_request_io problem.

Actually, it seems to be an issue with rsrc_nonstatic. Attached is a patch
for 2.6.34-rc; I'll look whether 2.6.33 requires a backport right away.

Best,
Dominik

From: Dominik Brodowski li...@dominikbrodowski.net
Date: Sun, 4 Apr 2010 18:10:35 +0200
Subject: [PATCH] pcmcia: fix up alignf issues

- pcmcia_align() used a start variable twice. That's obviously a bad
  idea.

- pcmcia_common_resource() needs the current start parameter being
  passed, instead of res-start.

- pcmcia_common_resource() doesn't use the size and align parameters,
  so get rid of those.

Signed-off-by: Dominik Brodowski li...@dominikbrodowski.net

diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 2e47991..559069a 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -596,19 +596,17 @@ struct pcmcia_align_data {
struct resource_map *map;
 };
 
-static resource_size_t
-pcmcia_common_align(void *align_data, const struct resource *res,
-   resource_size_t size, resource_size_t align)
+static resource_size_t pcmcia_common_align(struct pcmcia_align_data 
*align_data,
+   resource_size_t start)
 {
-   struct pcmcia_align_data *data = align_data;
-   resource_size_t start;
+   resource_size_t ret;
/*
 * Ensure that we have the correct start address
 */
-   start = (res-start  ~data-mask) + data-offset;
-   if (start  res-start)
-   start += data-mask + 1;
-   return start;
+   ret = (start  ~align_data-mask) + align_data-offset;
+   if (ret  start)
+   ret += align_data-mask + 1;
+   return ret;
 }
 
 static resource_size_t
@@ -619,29 +617,28 @@ pcmcia_align(void *align_data, const struct resource *res,
struct resource_map *m;
resource_size_t start;
 
-   start = pcmcia_common_align(data, res, size, align);
+   start = pcmcia_common_align(data, res-start);
 
for (m = data-map-next; m != data-map; m = m-next) {
-   unsigned long start = m-base;
-   unsigned long end = m-base + m-num - 1;
+   unsigned long map_start = m-base;
+   unsigned long map_end = m-base + m-num - 1;
 
/*
 * If the lower resources are not available, try aligning
 * to this entry of the resource database to see if it'll
 * fit here.
 */
-   if (res-start  start) {
-   start = pcmcia_common_align(data, res, size, align);
-   }
+   if (start  map_start)
+   start = pcmcia_common_align(data, map_start);
 
/*
 * If we're above the area which was passed in, there's
 * no point proceeding.
 */
-   if (res-start = res-end)
+   if (start = res-end)
break;
 
-   if ((res-start + size - 1) = end)
+   if ((start + size - 1) = map_end)
break;
}
 

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia