Commit 74cf4a55 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: m32 registration failure fixup

The pseudo-unregistration of PCMCIA sockets in case the registration of any
such socket failed causes lockups.

See http://bugme.osdl.org/show_bug.cgi?id=4115 for details (same problem,
Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5dc0ff31
...@@ -239,6 +239,7 @@ void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size, ...@@ -239,6 +239,7 @@ void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size,
/*====================================================================*/ /*====================================================================*/
#define IS_REGISTERED 0x2000
#define IS_ALIVE 0x8000 #define IS_ALIVE 0x8000
typedef struct pcc_t { typedef struct pcc_t {
...@@ -835,11 +836,9 @@ static int __init init_m32r_pcc(void) ...@@ -835,11 +836,9 @@ static int __init init_m32r_pcc(void)
socket[i].socket.owner = THIS_MODULE; socket[i].socket.owner = THIS_MODULE;
socket[i].number = i; socket[i].number = i;
ret = pcmcia_register_socket(&socket[i].socket); ret = pcmcia_register_socket(&socket[i].socket);
if (ret && i--) { if (!ret)
for (; i>= 0; i--) socket[i].flags |= IS_REGISTERED;
pcmcia_unregister_socket(&socket[i].socket);
break;
}
#if 0 /* driver model ordering issue */ #if 0 /* driver model ordering issue */
class_device_create_file(&socket[i].socket.dev, class_device_create_file(&socket[i].socket.dev,
&class_device_attr_info); &class_device_attr_info);
...@@ -865,6 +864,7 @@ static void __exit exit_m32r_pcc(void) ...@@ -865,6 +864,7 @@ static void __exit exit_m32r_pcc(void)
int i; int i;
for (i = 0; i < pcc_sockets; i++) for (i = 0; i < pcc_sockets; i++)
if (socket[i].flags & IS_REGISTERED)
pcmcia_unregister_socket(&socket[i].socket); pcmcia_unregister_socket(&socket[i].socket);
platform_device_unregister(&pcc_device); platform_device_unregister(&pcc_device);
......
...@@ -257,6 +257,7 @@ void pcc_iowrite(int sock, unsigned long port, void *buf, size_t size, size_t nm ...@@ -257,6 +257,7 @@ void pcc_iowrite(int sock, unsigned long port, void *buf, size_t size, size_t nm
/*====================================================================*/ /*====================================================================*/
#define IS_REGISTERED 0x2000
#define IS_ALIVE 0x8000 #define IS_ALIVE 0x8000
typedef struct pcc_t { typedef struct pcc_t {
...@@ -772,11 +773,9 @@ static int __init init_m32r_pcc(void) ...@@ -772,11 +773,9 @@ static int __init init_m32r_pcc(void)
socket[i].socket.owner = THIS_MODULE; socket[i].socket.owner = THIS_MODULE;
socket[i].number = i; socket[i].number = i;
ret = pcmcia_register_socket(&socket[i].socket); ret = pcmcia_register_socket(&socket[i].socket);
if (ret && i--) { if (!ret)
for (; i>= 0; i--) socket[i].flags |= IS_REGISTERED;
pcmcia_unregister_socket(&socket[i].socket);
break;
}
#if 0 /* driver model ordering issue */ #if 0 /* driver model ordering issue */
class_device_create_file(&socket[i].socket.dev, class_device_create_file(&socket[i].socket.dev,
&class_device_attr_info); &class_device_attr_info);
...@@ -802,6 +801,7 @@ static void __exit exit_m32r_pcc(void) ...@@ -802,6 +801,7 @@ static void __exit exit_m32r_pcc(void)
int i; int i;
for (i = 0; i < pcc_sockets; i++) for (i = 0; i < pcc_sockets; i++)
if (socket[i].flags & IS_REGISTERED)
pcmcia_unregister_socket(&socket[i].socket); pcmcia_unregister_socket(&socket[i].socket);
platform_device_unregister(&pcc_device); platform_device_unregister(&pcc_device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment