diff options
Diffstat (limited to 'drivers/mmc/wbsd.c')
-rw-r--r-- | drivers/mmc/wbsd.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index c7eb7c269081..4f13bd2ccf9a 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -1456,13 +1456,11 @@ static int __devinit wbsd_scan(struct wbsd_host* host) | |||
1456 | * Iterate through all ports, all codes to | 1456 | * Iterate through all ports, all codes to |
1457 | * find hardware that is in our known list. | 1457 | * find hardware that is in our known list. |
1458 | */ | 1458 | */ |
1459 | for (i = 0;i < sizeof(config_ports)/sizeof(int);i++) | 1459 | for (i = 0; i < ARRAY_SIZE(config_ports); i++) { |
1460 | { | ||
1461 | if (!request_region(config_ports[i], 2, DRIVER_NAME)) | 1460 | if (!request_region(config_ports[i], 2, DRIVER_NAME)) |
1462 | continue; | 1461 | continue; |
1463 | 1462 | ||
1464 | for (j = 0;j < sizeof(unlock_codes)/sizeof(int);j++) | 1463 | for (j = 0; j < ARRAY_SIZE(unlock_codes); j++) { |
1465 | { | ||
1466 | id = 0xFFFF; | 1464 | id = 0xFFFF; |
1467 | 1465 | ||
1468 | host->config = config_ports[i]; | 1466 | host->config = config_ports[i]; |
@@ -1478,8 +1476,7 @@ static int __devinit wbsd_scan(struct wbsd_host* host) | |||
1478 | 1476 | ||
1479 | wbsd_lock_config(host); | 1477 | wbsd_lock_config(host); |
1480 | 1478 | ||
1481 | for (k = 0;k < sizeof(valid_ids)/sizeof(int);k++) | 1479 | for (k = 0; k < ARRAY_SIZE(valid_ids); k++) { |
1482 | { | ||
1483 | if (id == valid_ids[k]) | 1480 | if (id == valid_ids[k]) |
1484 | { | 1481 | { |
1485 | host->chip_id = id; | 1482 | host->chip_id = id; |
@@ -2090,10 +2087,20 @@ static int __init wbsd_drv_init(void) | |||
2090 | if (result < 0) | 2087 | if (result < 0) |
2091 | return result; | 2088 | return result; |
2092 | 2089 | ||
2093 | wbsd_device = platform_device_register_simple(DRIVER_NAME, -1, | 2090 | wbsd_device = platform_device_alloc(DRIVER_NAME, -1); |
2094 | NULL, 0); | 2091 | if (!wbsd_device) |
2095 | if (IS_ERR(wbsd_device)) | 2092 | { |
2096 | return PTR_ERR(wbsd_device); | 2093 | platform_driver_unregister(&wbsd_driver); |
2094 | return -ENOMEM; | ||
2095 | } | ||
2096 | |||
2097 | result = platform_device_add(wbsd_device); | ||
2098 | if (result) | ||
2099 | { | ||
2100 | platform_device_put(wbsd_device); | ||
2101 | platform_driver_unregister(&wbsd_driver); | ||
2102 | return result; | ||
2103 | } | ||
2097 | } | 2104 | } |
2098 | 2105 | ||
2099 | return 0; | 2106 | return 0; |