<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/pcmcia, branch v3.0.65</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/pcmcia?h=v3.0.65</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/pcmcia?h=v3.0.65'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-10-28T17:02:11Z</updated>
<entry>
<title>pcmcia: sharpsl: don't discard sharpsl_pcmcia_ops</title>
<updated>2012-10-28T17:02:11Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2012-04-30T13:50:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7b48126837ed4804b9f6c1807a21d803cc35172d'/>
<id>urn:sha1:7b48126837ed4804b9f6c1807a21d803cc35172d</id>
<content type='text'>
commit fdc858a466b738d35d3492bc7cf77b1dac98bf7c upstream.

The sharpsl_pcmcia_ops structure gets passed into
sa11xx_drv_pcmcia_probe, where it gets accessed at run-time,
unlike all other pcmcia drivers that pass their structures
into platform_device_add_data, which makes a copy.

This means the gcc warning is valid and the structure
must not be marked as __initdata.

Without this patch, building collie_defconfig results in:

drivers/pcmcia/pxa2xx_sharpsl.c:22:31: fatal error: mach-pxa/hardware.h: No such file or directory
compilation terminated.
make[3]: *** [drivers/pcmcia/pxa2xx_sharpsl.o] Error 1
make[2]: *** [drivers/pcmcia] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Dominik Brodowski &lt;linux@dominikbrodowski.net&gt;
Cc: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
Cc: Pavel Machek &lt;pavel@suse.cz&gt;
Cc: linux-pcmcia@lists.infradead.org
Cc: Jochen Friedrich &lt;jochen@scram.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>pcmcia: fix socket refcount decrementing on each resume</title>
<updated>2012-02-13T19:06:10Z</updated>
<author>
<name>Russell King</name>
<email>rmk+kernel@arm.linux.org.uk</email>
</author>
<published>2012-02-09T01:13:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a5e2ba3e021e7a3135a7dbb8e188d21971a59f49'/>
<id>urn:sha1:a5e2ba3e021e7a3135a7dbb8e188d21971a59f49</id>
<content type='text'>
commit 025e4ab3db07fcbf62c01e4f30d1012234beb980 upstream.

This fixes a memory-corrupting bug: not only does it cause the warning,
but as a result of dropping the refcount to zero, it causes the
pcmcia_socket0 device structure to be freed while it still has
references, causing slab caches corruption.  A fatal oops quickly
follows this warning - often even just a 'dmesg' following the warning
causes the kernel to oops.

While testing suspend/resume on an ARM device with PCMCIA support, and a
CF card inserted, I found that after five suspend and resumes, the
kernel would complain, and shortly die after with slab corruption.

  WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()

As the message doesn't give a clue about which kobject, and the built-in
debugging in drivers/base/power/main.c happens too late, this was added
right before each get_device():

  printk("%s: %p [%s] %u\n", __func__, dev, kobject_name(&amp;dev-&gt;kobj), atomic_read(&amp;dev-&gt;kobj.kref.refcount));

and on the 3rd s2ram cycle, the following behaviour observed:

On the 3rd suspend/resume cycle:

  dpm_prepare: c1a0d998 [pcmcia_socket0] 3
  dpm_suspend: c1a0d998 [pcmcia_socket0] 3
  dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 3
  dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 3
  dpm_resume: c1a0d998 [pcmcia_socket0] 3
  dpm_complete: c1a0d998 [pcmcia_socket0] 2

4th:

  dpm_prepare: c1a0d998 [pcmcia_socket0] 2
  dpm_suspend: c1a0d998 [pcmcia_socket0] 2
  dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 2
  dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 2
  dpm_resume: c1a0d998 [pcmcia_socket0] 2
  dpm_complete: c1a0d998 [pcmcia_socket0] 1

5th:

  dpm_prepare: c1a0d998 [pcmcia_socket0] 1
  dpm_suspend: c1a0d998 [pcmcia_socket0] 1
  dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 1
  dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 1
  dpm_resume: c1a0d998 [pcmcia_socket0] 1
  dpm_complete: c1a0d998 [pcmcia_socket0] 0
  ------------[ cut here ]------------
  WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
  Modules linked in: ucb1x00_core
  Backtrace:
  [&lt;c0212090&gt;] (dump_backtrace+0x0/0x110) from [&lt;c04799dc&gt;] (dump_stack+0x18/0x1c)
  [&lt;c04799c4&gt;] (dump_stack+0x0/0x1c) from [&lt;c021cba0&gt;] (warn_slowpath_common+0x50/0x68)
  [&lt;c021cb50&gt;] (warn_slowpath_common+0x0/0x68) from [&lt;c021cbdc&gt;] (warn_slowpath_null+0x24/0x28)
  [&lt;c021cbb8&gt;] (warn_slowpath_null+0x0/0x28) from [&lt;c0335374&gt;] (kobject_get+0x28/0x50)
  [&lt;c033534c&gt;] (kobject_get+0x0/0x50) from [&lt;c03804f4&gt;] (get_device+0x1c/0x24)
  [&lt;c0388c90&gt;] (dpm_complete+0x0/0x1a0) from [&lt;c0389cc0&gt;] (dpm_resume_end+0x1c/0x20)
  ...

Looking at commit 7b24e7988263 ("pcmcia: split up central event handler"),
the following change was made to cs.c:

                return 0;
        }
 #endif
-
-       send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
+       if (!(skt-&gt;state &amp; SOCKET_CARDBUS) &amp;&amp; (skt-&gt;callback))
+               skt-&gt;callback-&gt;early_resume(skt);
        return 0;
 }

And the corresponding change in ds.c is from:

-static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
-{
-       struct pcmcia_socket *s = pcmcia_get_socket(skt);
...
-       switch (event) {
...
-       case CS_EVENT_PM_RESUME:
-               if (verify_cis_cache(skt) != 0) {
-                       dev_dbg(&amp;skt-&gt;dev, "cis mismatch - different card\n");
-                       /* first, remove the card */
-                       ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
-                       mutex_lock(&amp;s-&gt;ops_mutex);
-                       destroy_cis_cache(skt);
-                       kfree(skt-&gt;fake_cis);
-                       skt-&gt;fake_cis = NULL;
-                       s-&gt;functions = 0;
-                       mutex_unlock(&amp;s-&gt;ops_mutex);
-                       /* now, add the new card */
-                       ds_event(skt, CS_EVENT_CARD_INSERTION,
-                                CS_EVENT_PRI_LOW);
-               }
-               break;
...
-    }

-    pcmcia_put_socket(s);

-    return 0;
-} /* ds_event */

to:

+static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
+{
+       if (!verify_cis_cache(skt)) {
+               pcmcia_put_socket(skt);
+               return 0;
+       }

+       dev_dbg(&amp;skt-&gt;dev, "cis mismatch - different card\n");

+       /* first, remove the card */
+       pcmcia_bus_remove(skt);
+       mutex_lock(&amp;skt-&gt;ops_mutex);
+       destroy_cis_cache(skt);
+       kfree(skt-&gt;fake_cis);
+       skt-&gt;fake_cis = NULL;
+       skt-&gt;functions = 0;
+       mutex_unlock(&amp;skt-&gt;ops_mutex);

+       /* now, add the new card */
+       pcmcia_bus_add(skt);
+       return 0;
+}

As can be seen, the original function called pcmcia_get_socket() and
pcmcia_put_socket() around the guts, whereas the replacement code
calls pcmcia_put_socket() only in one path.  This creates an imbalance
in the refcounting.

Testing with pcmcia_put_socket() put removed shows that the bug is gone:

  dpm_suspend: c1a10998 [pcmcia_socket0] 5
  dpm_suspend_noirq: c1a10998 [pcmcia_socket0] 5
  dpm_resume_noirq: c1a10998 [pcmcia_socket0] 5
  dpm_resume: c1a10998 [pcmcia_socket0] 5
  dpm_complete: c1a10998 [pcmcia_socket0] 5

Tested-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
Cc: Dominik Brodowski &lt;linux@dominikbrodowski.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>pcmcia: pxa2xx/vpac270: free gpios on exist rather than requesting</title>
<updated>2011-07-11T06:26:34Z</updated>
<author>
<name>Jonathan Cameron</name>
<email>jic23@cam.ac.uk</email>
</author>
<published>2011-06-06T14:24:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=512b7938fefd03d512463aa597a1216cf088dfe3'/>
<id>urn:sha1:512b7938fefd03d512463aa597a1216cf088dfe3</id>
<content type='text'>
Signed-off-by: Jonathan Cameron &lt;jic23@cam.ac.uk&gt;
Acked-by: Marek Vasut &lt;marek.vasut@gmail.com&gt;
Signed-off-by: Eric Miao &lt;eric.y.miao@gmail.com&gt;
</content>
</entry>
<entry>
<title>gpio: include linux/gpio.h where needed</title>
<updated>2011-06-16T14:40:44Z</updated>
<author>
<name>Randy Dunlap</name>
<email>randy.dunlap@oracle.com</email>
</author>
<published>2011-06-15T00:06:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=158f1e95180d01ebfd7cd5c8de23050528303f26'/>
<id>urn:sha1:158f1e95180d01ebfd7cd5c8de23050528303f26</id>
<content type='text'>
Some files use GPIOF_ macros but don't include the header file
for them.  These macros are being moved to &lt;linux/gpio.h&gt;, so add
includes for &lt;linux/gpio.h&gt; where needed.

Signed-off-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>pcmcia: Make declaration and uses of struct pcmcia_device_id const</title>
<updated>2011-05-06T05:46:15Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2011-05-04T02:29:00Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e9fb13bfec7e017130ddc5c1b5466340470f4900'/>
<id>urn:sha1:e9fb13bfec7e017130ddc5c1b5466340470f4900</id>
<content type='text'>
Const allows tables to be moved into text sections.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Dominik Brodowski &lt;linux@dominikbrodowski.net&gt;
</content>
</entry>
<entry>
<title>pcmcia/sa1100: put sa11x0_pcmcia_hw_init[] to .devinit.data</title>
<updated>2011-05-06T05:46:11Z</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2011-04-06T14:31:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=37fac4b6e6fde4ea4f5fd76948ba6f3e5dc63c01'/>
<id>urn:sha1:37fac4b6e6fde4ea4f5fd76948ba6f3e5dc63c01</id>
<content type='text'>
sa11x0_pcmcia_hw_init is only used by sa11x0_drv_pcmcia_probe which
lives in .devinit.text so it can go to .devinit.data.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Dominik Brodowski &lt;linux@dominikbrodowski.net&gt;
</content>
</entry>
<entry>
<title>Revert wrong fixes for common misspellings</title>
<updated>2011-04-27T06:31:11Z</updated>
<author>
<name>Lucas De Marchi</name>
<email>lucas.demarchi@profusion.mobi</email>
</author>
<published>2011-04-27T06:28:26Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e9c549998dc24209847007e1f209f3b6c88d21ba'/>
<id>urn:sha1:e9c549998dc24209847007e1f209f3b6c88d21ba</id>
<content type='text'>
These changes were incorrectly fixed by codespell. They were now
manually corrected.

Signed-off-by: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
</content>
</entry>
<entry>
<title>ARM: pxa: convert incorrect IRQ_TO_IRQ() to irq_to_gpio()</title>
<updated>2011-04-13T01:30:40Z</updated>
<author>
<name>Eric Miao</name>
<email>eric.y.miao@gmail.com</email>
</author>
<published>2011-04-12T10:39:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7db6a7fa09884b34d2a5d4e6e4ed58664a5f0cf8'/>
<id>urn:sha1:7db6a7fa09884b34d2a5d4e6e4ed58664a5f0cf8</id>
<content type='text'>
This fixes the failure to register the IRQ_RTCAlrm alarm as a wakeup
event.  It is misinterpreted as a gpio irq not a PWER bitmask. Fixed
this by converting the incorrect IRQ_TO_IRQ() to a correct version of
irq_to_gpio().

Reported-by: Nick Bane &lt;nickbane1@gmail.com&gt;
Signed-off-by: Eric Miao &lt;eric.y.miao@gmail.com&gt;
</content>
</entry>
<entry>
<title>pcmcia: limit pxa2xx_trizeps4 subdriver to trizeps4 platform</title>
<updated>2011-04-12T15:07:42Z</updated>
<author>
<name>Dmitry Eremin-Solenikov</name>
<email>dbaryshkov@gmail.com</email>
</author>
<published>2011-04-01T09:28:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=735443fede138fbbad062ec258e4d49648a0a56d'/>
<id>urn:sha1:735443fede138fbbad062ec258e4d49648a0a56d</id>
<content type='text'>
pxa2xx_trizeps4 tries to register pxa2xx-pcmcia device not checking whether
machine is really trizeps4, thus messing multi-machine kernels. Fix it up.

Signed-off-by: Dmitry Eremin-Solenikov &lt;dbaryshkov@gmail.com&gt;
Signed-off-by: Eric Miao &lt;eric.y.miao@gmail.com&gt;
</content>
</entry>
<entry>
<title>pcmcia: limit pxa2xx_balloon3 subdriver to balloon3 platform</title>
<updated>2011-04-12T15:07:42Z</updated>
<author>
<name>Dmitry Eremin-Solenikov</name>
<email>dbaryshkov@gmail.com</email>
</author>
<published>2011-04-01T09:28:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=af21cbb1ef6aa366fcb629ea4d4330300ba22de7'/>
<id>urn:sha1:af21cbb1ef6aa366fcb629ea4d4330300ba22de7</id>
<content type='text'>
pxa2xx_balloon3 tries to register pxa2xx-pcmcia device not checking whether
machine is really balloon3, thus messing multi-machine kernels. Fix it up.

Signed-off-by: Dmitry Eremin-Solenikov &lt;dbaryshkov@gmail.com&gt;
Signed-off-by: Eric Miao &lt;eric.y.miao@gmail.com&gt;
</content>
</entry>
</feed>
