diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/acpiphp.h | 3 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 12 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp.h | 3 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp_core.c | 14 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp_ctrl.c | 56 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_hpc.c | 10 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 3 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 68 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp.h | 3 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_ctrl.c | 98 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_hpc.c | 2 |
13 files changed, 143 insertions, 137 deletions
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 293603e1b7c3..6a91cfb0f688 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/acpi.h> | 38 | #include <linux/acpi.h> |
39 | #include <linux/kobject.h> /* for KOBJ_NAME_LEN */ | 39 | #include <linux/kobject.h> /* for KOBJ_NAME_LEN */ |
40 | #include <linux/mutex.h> | ||
40 | #include "pci_hotplug.h" | 41 | #include "pci_hotplug.h" |
41 | 42 | ||
42 | #define dbg(format, arg...) \ | 43 | #define dbg(format, arg...) \ |
@@ -118,7 +119,7 @@ struct acpiphp_slot { | |||
118 | struct acpiphp_bridge *bridge; /* parent */ | 119 | struct acpiphp_bridge *bridge; /* parent */ |
119 | struct list_head funcs; /* one slot may have different | 120 | struct list_head funcs; /* one slot may have different |
120 | objects (i.e. for each function) */ | 121 | objects (i.e. for each function) */ |
121 | struct semaphore crit_sect; | 122 | struct mutex crit_sect; |
122 | 123 | ||
123 | u32 id; /* slot id (serial #) for hotplug core */ | 124 | u32 id; /* slot id (serial #) for hotplug core */ |
124 | u8 device; /* pci device# */ | 125 | u8 device; /* pci device# */ |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 509a5b3ae998..4e25d9c7cc39 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <linux/kernel.h> | 46 | #include <linux/kernel.h> |
47 | #include <linux/pci.h> | 47 | #include <linux/pci.h> |
48 | #include <linux/smp_lock.h> | 48 | #include <linux/smp_lock.h> |
49 | #include <asm/semaphore.h> | 49 | #include <linux/mutex.h> |
50 | 50 | ||
51 | #include "../pci.h" | 51 | #include "../pci.h" |
52 | #include "pci_hotplug.h" | 52 | #include "pci_hotplug.h" |
@@ -188,7 +188,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
188 | slot->device = device; | 188 | slot->device = device; |
189 | slot->sun = sun; | 189 | slot->sun = sun; |
190 | INIT_LIST_HEAD(&slot->funcs); | 190 | INIT_LIST_HEAD(&slot->funcs); |
191 | init_MUTEX(&slot->crit_sect); | 191 | mutex_init(&slot->crit_sect); |
192 | 192 | ||
193 | slot->next = bridge->slots; | 193 | slot->next = bridge->slots; |
194 | bridge->slots = slot; | 194 | bridge->slots = slot; |
@@ -1401,7 +1401,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
1401 | { | 1401 | { |
1402 | int retval; | 1402 | int retval; |
1403 | 1403 | ||
1404 | down(&slot->crit_sect); | 1404 | mutex_lock(&slot->crit_sect); |
1405 | 1405 | ||
1406 | /* wake up all functions */ | 1406 | /* wake up all functions */ |
1407 | retval = power_on_slot(slot); | 1407 | retval = power_on_slot(slot); |
@@ -1413,7 +1413,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
1413 | retval = enable_device(slot); | 1413 | retval = enable_device(slot); |
1414 | 1414 | ||
1415 | err_exit: | 1415 | err_exit: |
1416 | up(&slot->crit_sect); | 1416 | mutex_unlock(&slot->crit_sect); |
1417 | return retval; | 1417 | return retval; |
1418 | } | 1418 | } |
1419 | 1419 | ||
@@ -1424,7 +1424,7 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) | |||
1424 | { | 1424 | { |
1425 | int retval = 0; | 1425 | int retval = 0; |
1426 | 1426 | ||
1427 | down(&slot->crit_sect); | 1427 | mutex_lock(&slot->crit_sect); |
1428 | 1428 | ||
1429 | /* unconfigure all functions */ | 1429 | /* unconfigure all functions */ |
1430 | retval = disable_device(slot); | 1430 | retval = disable_device(slot); |
@@ -1437,7 +1437,7 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) | |||
1437 | goto err_exit; | 1437 | goto err_exit; |
1438 | 1438 | ||
1439 | err_exit: | 1439 | err_exit: |
1440 | up(&slot->crit_sect); | 1440 | mutex_unlock(&slot->crit_sect); |
1441 | return retval; | 1441 | return retval; |
1442 | } | 1442 | } |
1443 | 1443 | ||
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h index cb88404c89fe..c74e9e37e76b 100644 --- a/drivers/pci/hotplug/cpqphp.h +++ b/drivers/pci/hotplug/cpqphp.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
33 | #include <asm/io.h> /* for read? and write? functions */ | 33 | #include <asm/io.h> /* for read? and write? functions */ |
34 | #include <linux/delay.h> /* for delays */ | 34 | #include <linux/delay.h> /* for delays */ |
35 | #include <linux/mutex.h> | ||
35 | 36 | ||
36 | #define MY_NAME "cpqphp" | 37 | #define MY_NAME "cpqphp" |
37 | 38 | ||
@@ -286,7 +287,7 @@ struct event_info { | |||
286 | struct controller { | 287 | struct controller { |
287 | struct controller *next; | 288 | struct controller *next; |
288 | u32 ctrl_int_comp; | 289 | u32 ctrl_int_comp; |
289 | struct semaphore crit_sect; /* critical section semaphore */ | 290 | struct mutex crit_sect; /* critical section mutex */ |
290 | void __iomem *hpc_reg; /* cookie for our pci controller location */ | 291 | void __iomem *hpc_reg; /* cookie for our pci controller location */ |
291 | struct pci_resource *mem_head; | 292 | struct pci_resource *mem_head; |
292 | struct pci_resource *p_mem_head; | 293 | struct pci_resource *p_mem_head; |
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index b3659ffccac9..8626901daeb8 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -599,7 +599,7 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
599 | hp_slot = func->device - ctrl->slot_device_offset; | 599 | hp_slot = func->device - ctrl->slot_device_offset; |
600 | 600 | ||
601 | // Wait for exclusive access to hardware | 601 | // Wait for exclusive access to hardware |
602 | down(&ctrl->crit_sect); | 602 | mutex_lock(&ctrl->crit_sect); |
603 | 603 | ||
604 | if (status == 1) { | 604 | if (status == 1) { |
605 | amber_LED_on (ctrl, hp_slot); | 605 | amber_LED_on (ctrl, hp_slot); |
@@ -607,7 +607,7 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
607 | amber_LED_off (ctrl, hp_slot); | 607 | amber_LED_off (ctrl, hp_slot); |
608 | } else { | 608 | } else { |
609 | // Done with exclusive hardware access | 609 | // Done with exclusive hardware access |
610 | up(&ctrl->crit_sect); | 610 | mutex_unlock(&ctrl->crit_sect); |
611 | return(1); | 611 | return(1); |
612 | } | 612 | } |
613 | 613 | ||
@@ -617,7 +617,7 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
617 | wait_for_ctrl_irq (ctrl); | 617 | wait_for_ctrl_irq (ctrl); |
618 | 618 | ||
619 | // Done with exclusive hardware access | 619 | // Done with exclusive hardware access |
620 | up(&ctrl->crit_sect); | 620 | mutex_unlock(&ctrl->crit_sect); |
621 | 621 | ||
622 | return(0); | 622 | return(0); |
623 | } | 623 | } |
@@ -1084,7 +1084,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1084 | dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, | 1084 | dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, |
1085 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); | 1085 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); |
1086 | 1086 | ||
1087 | init_MUTEX(&ctrl->crit_sect); | 1087 | mutex_init(&ctrl->crit_sect); |
1088 | init_waitqueue_head(&ctrl->queue); | 1088 | init_waitqueue_head(&ctrl->queue); |
1089 | 1089 | ||
1090 | /* initialize our threads if they haven't already been started up */ | 1090 | /* initialize our threads if they haven't already been started up */ |
@@ -1223,7 +1223,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1223 | 1223 | ||
1224 | // turn off empty slots here unless command line option "ON" set | 1224 | // turn off empty slots here unless command line option "ON" set |
1225 | // Wait for exclusive access to hardware | 1225 | // Wait for exclusive access to hardware |
1226 | down(&ctrl->crit_sect); | 1226 | mutex_lock(&ctrl->crit_sect); |
1227 | 1227 | ||
1228 | num_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; | 1228 | num_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; |
1229 | 1229 | ||
@@ -1270,12 +1270,12 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1270 | rc = init_SERR(ctrl); | 1270 | rc = init_SERR(ctrl); |
1271 | if (rc) { | 1271 | if (rc) { |
1272 | err("init_SERR failed\n"); | 1272 | err("init_SERR failed\n"); |
1273 | up(&ctrl->crit_sect); | 1273 | mutex_unlock(&ctrl->crit_sect); |
1274 | goto err_free_irq; | 1274 | goto err_free_irq; |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | // Done with exclusive hardware access | 1277 | // Done with exclusive hardware access |
1278 | up(&ctrl->crit_sect); | 1278 | mutex_unlock(&ctrl->crit_sect); |
1279 | 1279 | ||
1280 | cpqhp_create_debugfs_files(ctrl); | 1280 | cpqhp_create_debugfs_files(ctrl); |
1281 | 1281 | ||
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 771ed34b1819..72eb8e2d2065 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -1299,7 +1299,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1299 | **********************************/ | 1299 | **********************************/ |
1300 | rc = CARD_FUNCTIONING; | 1300 | rc = CARD_FUNCTIONING; |
1301 | } else { | 1301 | } else { |
1302 | down(&ctrl->crit_sect); | 1302 | mutex_lock(&ctrl->crit_sect); |
1303 | 1303 | ||
1304 | /* turn on board without attaching to the bus */ | 1304 | /* turn on board without attaching to the bus */ |
1305 | enable_slot_power (ctrl, hp_slot); | 1305 | enable_slot_power (ctrl, hp_slot); |
@@ -1333,12 +1333,12 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1333 | /* Wait for SOBS to be unset */ | 1333 | /* Wait for SOBS to be unset */ |
1334 | wait_for_ctrl_irq (ctrl); | 1334 | wait_for_ctrl_irq (ctrl); |
1335 | 1335 | ||
1336 | up(&ctrl->crit_sect); | 1336 | mutex_unlock(&ctrl->crit_sect); |
1337 | 1337 | ||
1338 | if (rc) | 1338 | if (rc) |
1339 | return rc; | 1339 | return rc; |
1340 | 1340 | ||
1341 | down(&ctrl->crit_sect); | 1341 | mutex_lock(&ctrl->crit_sect); |
1342 | 1342 | ||
1343 | slot_enable (ctrl, hp_slot); | 1343 | slot_enable (ctrl, hp_slot); |
1344 | green_LED_blink (ctrl, hp_slot); | 1344 | green_LED_blink (ctrl, hp_slot); |
@@ -1350,7 +1350,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1350 | /* Wait for SOBS to be unset */ | 1350 | /* Wait for SOBS to be unset */ |
1351 | wait_for_ctrl_irq (ctrl); | 1351 | wait_for_ctrl_irq (ctrl); |
1352 | 1352 | ||
1353 | up(&ctrl->crit_sect); | 1353 | mutex_unlock(&ctrl->crit_sect); |
1354 | 1354 | ||
1355 | /* Wait for ~1 second because of hot plug spec */ | 1355 | /* Wait for ~1 second because of hot plug spec */ |
1356 | long_delay(1*HZ); | 1356 | long_delay(1*HZ); |
@@ -1375,7 +1375,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1375 | * called for the "base" bus/dev/func of an | 1375 | * called for the "base" bus/dev/func of an |
1376 | * adapter. */ | 1376 | * adapter. */ |
1377 | 1377 | ||
1378 | down(&ctrl->crit_sect); | 1378 | mutex_lock(&ctrl->crit_sect); |
1379 | 1379 | ||
1380 | amber_LED_on (ctrl, hp_slot); | 1380 | amber_LED_on (ctrl, hp_slot); |
1381 | green_LED_off (ctrl, hp_slot); | 1381 | green_LED_off (ctrl, hp_slot); |
@@ -1386,7 +1386,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1386 | /* Wait for SOBS to be unset */ | 1386 | /* Wait for SOBS to be unset */ |
1387 | wait_for_ctrl_irq (ctrl); | 1387 | wait_for_ctrl_irq (ctrl); |
1388 | 1388 | ||
1389 | up(&ctrl->crit_sect); | 1389 | mutex_unlock(&ctrl->crit_sect); |
1390 | 1390 | ||
1391 | if (rc) | 1391 | if (rc) |
1392 | return rc; | 1392 | return rc; |
@@ -1410,7 +1410,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1410 | * called for the "base" bus/dev/func of an | 1410 | * called for the "base" bus/dev/func of an |
1411 | * adapter. */ | 1411 | * adapter. */ |
1412 | 1412 | ||
1413 | down(&ctrl->crit_sect); | 1413 | mutex_lock(&ctrl->crit_sect); |
1414 | 1414 | ||
1415 | amber_LED_on (ctrl, hp_slot); | 1415 | amber_LED_on (ctrl, hp_slot); |
1416 | green_LED_off (ctrl, hp_slot); | 1416 | green_LED_off (ctrl, hp_slot); |
@@ -1421,13 +1421,13 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1421 | /* Wait for SOBS to be unset */ | 1421 | /* Wait for SOBS to be unset */ |
1422 | wait_for_ctrl_irq (ctrl); | 1422 | wait_for_ctrl_irq (ctrl); |
1423 | 1423 | ||
1424 | up(&ctrl->crit_sect); | 1424 | mutex_unlock(&ctrl->crit_sect); |
1425 | 1425 | ||
1426 | return rc; | 1426 | return rc; |
1427 | } | 1427 | } |
1428 | /* Done configuring so turn LED on full time */ | 1428 | /* Done configuring so turn LED on full time */ |
1429 | 1429 | ||
1430 | down(&ctrl->crit_sect); | 1430 | mutex_lock(&ctrl->crit_sect); |
1431 | 1431 | ||
1432 | green_LED_on (ctrl, hp_slot); | 1432 | green_LED_on (ctrl, hp_slot); |
1433 | 1433 | ||
@@ -1436,7 +1436,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1436 | /* Wait for SOBS to be unset */ | 1436 | /* Wait for SOBS to be unset */ |
1437 | wait_for_ctrl_irq (ctrl); | 1437 | wait_for_ctrl_irq (ctrl); |
1438 | 1438 | ||
1439 | up(&ctrl->crit_sect); | 1439 | mutex_unlock(&ctrl->crit_sect); |
1440 | rc = 0; | 1440 | rc = 0; |
1441 | } else { | 1441 | } else { |
1442 | /* Something is wrong | 1442 | /* Something is wrong |
@@ -1445,7 +1445,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1445 | * in this case it will always be called for the "base" | 1445 | * in this case it will always be called for the "base" |
1446 | * bus/dev/func of an adapter. */ | 1446 | * bus/dev/func of an adapter. */ |
1447 | 1447 | ||
1448 | down(&ctrl->crit_sect); | 1448 | mutex_lock(&ctrl->crit_sect); |
1449 | 1449 | ||
1450 | amber_LED_on (ctrl, hp_slot); | 1450 | amber_LED_on (ctrl, hp_slot); |
1451 | green_LED_off (ctrl, hp_slot); | 1451 | green_LED_off (ctrl, hp_slot); |
@@ -1456,7 +1456,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1456 | /* Wait for SOBS to be unset */ | 1456 | /* Wait for SOBS to be unset */ |
1457 | wait_for_ctrl_irq (ctrl); | 1457 | wait_for_ctrl_irq (ctrl); |
1458 | 1458 | ||
1459 | up(&ctrl->crit_sect); | 1459 | mutex_unlock(&ctrl->crit_sect); |
1460 | } | 1460 | } |
1461 | 1461 | ||
1462 | } | 1462 | } |
@@ -1488,7 +1488,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1488 | dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n", | 1488 | dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n", |
1489 | __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot); | 1489 | __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot); |
1490 | 1490 | ||
1491 | down(&ctrl->crit_sect); | 1491 | mutex_lock(&ctrl->crit_sect); |
1492 | 1492 | ||
1493 | /* turn on board without attaching to the bus */ | 1493 | /* turn on board without attaching to the bus */ |
1494 | enable_slot_power(ctrl, hp_slot); | 1494 | enable_slot_power(ctrl, hp_slot); |
@@ -1522,7 +1522,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1522 | /* Wait for SOBS to be unset */ | 1522 | /* Wait for SOBS to be unset */ |
1523 | wait_for_ctrl_irq(ctrl); | 1523 | wait_for_ctrl_irq(ctrl); |
1524 | 1524 | ||
1525 | up(&ctrl->crit_sect); | 1525 | mutex_unlock(&ctrl->crit_sect); |
1526 | 1526 | ||
1527 | if (rc) | 1527 | if (rc) |
1528 | return rc; | 1528 | return rc; |
@@ -1532,7 +1532,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1532 | /* turn on board and blink green LED */ | 1532 | /* turn on board and blink green LED */ |
1533 | 1533 | ||
1534 | dbg("%s: before down\n", __FUNCTION__); | 1534 | dbg("%s: before down\n", __FUNCTION__); |
1535 | down(&ctrl->crit_sect); | 1535 | mutex_lock(&ctrl->crit_sect); |
1536 | dbg("%s: after down\n", __FUNCTION__); | 1536 | dbg("%s: after down\n", __FUNCTION__); |
1537 | 1537 | ||
1538 | dbg("%s: before slot_enable\n", __FUNCTION__); | 1538 | dbg("%s: before slot_enable\n", __FUNCTION__); |
@@ -1553,7 +1553,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1553 | dbg("%s: after wait_for_ctrl_irq\n", __FUNCTION__); | 1553 | dbg("%s: after wait_for_ctrl_irq\n", __FUNCTION__); |
1554 | 1554 | ||
1555 | dbg("%s: before up\n", __FUNCTION__); | 1555 | dbg("%s: before up\n", __FUNCTION__); |
1556 | up(&ctrl->crit_sect); | 1556 | mutex_unlock(&ctrl->crit_sect); |
1557 | dbg("%s: after up\n", __FUNCTION__); | 1557 | dbg("%s: after up\n", __FUNCTION__); |
1558 | 1558 | ||
1559 | /* Wait for ~1 second because of hot plug spec */ | 1559 | /* Wait for ~1 second because of hot plug spec */ |
@@ -1607,7 +1607,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1607 | cpqhp_resource_sort_and_combine(&(ctrl->bus_head)); | 1607 | cpqhp_resource_sort_and_combine(&(ctrl->bus_head)); |
1608 | 1608 | ||
1609 | if (rc) { | 1609 | if (rc) { |
1610 | down(&ctrl->crit_sect); | 1610 | mutex_lock(&ctrl->crit_sect); |
1611 | 1611 | ||
1612 | amber_LED_on (ctrl, hp_slot); | 1612 | amber_LED_on (ctrl, hp_slot); |
1613 | green_LED_off (ctrl, hp_slot); | 1613 | green_LED_off (ctrl, hp_slot); |
@@ -1618,7 +1618,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1618 | /* Wait for SOBS to be unset */ | 1618 | /* Wait for SOBS to be unset */ |
1619 | wait_for_ctrl_irq (ctrl); | 1619 | wait_for_ctrl_irq (ctrl); |
1620 | 1620 | ||
1621 | up(&ctrl->crit_sect); | 1621 | mutex_unlock(&ctrl->crit_sect); |
1622 | return rc; | 1622 | return rc; |
1623 | } else { | 1623 | } else { |
1624 | cpqhp_save_slot_config(ctrl, func); | 1624 | cpqhp_save_slot_config(ctrl, func); |
@@ -1640,7 +1640,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1640 | } | 1640 | } |
1641 | } while (new_slot); | 1641 | } while (new_slot); |
1642 | 1642 | ||
1643 | down(&ctrl->crit_sect); | 1643 | mutex_lock(&ctrl->crit_sect); |
1644 | 1644 | ||
1645 | green_LED_on (ctrl, hp_slot); | 1645 | green_LED_on (ctrl, hp_slot); |
1646 | 1646 | ||
@@ -1649,9 +1649,9 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1649 | /* Wait for SOBS to be unset */ | 1649 | /* Wait for SOBS to be unset */ |
1650 | wait_for_ctrl_irq (ctrl); | 1650 | wait_for_ctrl_irq (ctrl); |
1651 | 1651 | ||
1652 | up(&ctrl->crit_sect); | 1652 | mutex_unlock(&ctrl->crit_sect); |
1653 | } else { | 1653 | } else { |
1654 | down(&ctrl->crit_sect); | 1654 | mutex_lock(&ctrl->crit_sect); |
1655 | 1655 | ||
1656 | amber_LED_on (ctrl, hp_slot); | 1656 | amber_LED_on (ctrl, hp_slot); |
1657 | green_LED_off (ctrl, hp_slot); | 1657 | green_LED_off (ctrl, hp_slot); |
@@ -1662,7 +1662,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1662 | /* Wait for SOBS to be unset */ | 1662 | /* Wait for SOBS to be unset */ |
1663 | wait_for_ctrl_irq (ctrl); | 1663 | wait_for_ctrl_irq (ctrl); |
1664 | 1664 | ||
1665 | up(&ctrl->crit_sect); | 1665 | mutex_unlock(&ctrl->crit_sect); |
1666 | 1666 | ||
1667 | return rc; | 1667 | return rc; |
1668 | } | 1668 | } |
@@ -1721,7 +1721,7 @@ static u32 remove_board(struct pci_func * func, u32 replace_flag, struct control | |||
1721 | func->status = 0x01; | 1721 | func->status = 0x01; |
1722 | func->configured = 0; | 1722 | func->configured = 0; |
1723 | 1723 | ||
1724 | down(&ctrl->crit_sect); | 1724 | mutex_lock(&ctrl->crit_sect); |
1725 | 1725 | ||
1726 | green_LED_off (ctrl, hp_slot); | 1726 | green_LED_off (ctrl, hp_slot); |
1727 | slot_disable (ctrl, hp_slot); | 1727 | slot_disable (ctrl, hp_slot); |
@@ -1736,7 +1736,7 @@ static u32 remove_board(struct pci_func * func, u32 replace_flag, struct control | |||
1736 | /* Wait for SOBS to be unset */ | 1736 | /* Wait for SOBS to be unset */ |
1737 | wait_for_ctrl_irq (ctrl); | 1737 | wait_for_ctrl_irq (ctrl); |
1738 | 1738 | ||
1739 | up(&ctrl->crit_sect); | 1739 | mutex_unlock(&ctrl->crit_sect); |
1740 | 1740 | ||
1741 | if (!replace_flag && ctrl->add_support) { | 1741 | if (!replace_flag && ctrl->add_support) { |
1742 | while (func) { | 1742 | while (func) { |
@@ -1899,7 +1899,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1899 | dbg("button cancel\n"); | 1899 | dbg("button cancel\n"); |
1900 | del_timer(&p_slot->task_event); | 1900 | del_timer(&p_slot->task_event); |
1901 | 1901 | ||
1902 | down(&ctrl->crit_sect); | 1902 | mutex_lock(&ctrl->crit_sect); |
1903 | 1903 | ||
1904 | if (p_slot->state == BLINKINGOFF_STATE) { | 1904 | if (p_slot->state == BLINKINGOFF_STATE) { |
1905 | /* slot is on */ | 1905 | /* slot is on */ |
@@ -1922,7 +1922,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1922 | /* Wait for SOBS to be unset */ | 1922 | /* Wait for SOBS to be unset */ |
1923 | wait_for_ctrl_irq (ctrl); | 1923 | wait_for_ctrl_irq (ctrl); |
1924 | 1924 | ||
1925 | up(&ctrl->crit_sect); | 1925 | mutex_unlock(&ctrl->crit_sect); |
1926 | } | 1926 | } |
1927 | /*** button Released (No action on press...) */ | 1927 | /*** button Released (No action on press...) */ |
1928 | else if (ctrl->event_queue[loop].event_type == INT_BUTTON_RELEASE) { | 1928 | else if (ctrl->event_queue[loop].event_type == INT_BUTTON_RELEASE) { |
@@ -1937,7 +1937,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1937 | p_slot->state = BLINKINGON_STATE; | 1937 | p_slot->state = BLINKINGON_STATE; |
1938 | info(msg_button_on, p_slot->number); | 1938 | info(msg_button_on, p_slot->number); |
1939 | } | 1939 | } |
1940 | down(&ctrl->crit_sect); | 1940 | mutex_lock(&ctrl->crit_sect); |
1941 | 1941 | ||
1942 | dbg("blink green LED and turn off amber\n"); | 1942 | dbg("blink green LED and turn off amber\n"); |
1943 | 1943 | ||
@@ -1949,7 +1949,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1949 | /* Wait for SOBS to be unset */ | 1949 | /* Wait for SOBS to be unset */ |
1950 | wait_for_ctrl_irq (ctrl); | 1950 | wait_for_ctrl_irq (ctrl); |
1951 | 1951 | ||
1952 | up(&ctrl->crit_sect); | 1952 | mutex_unlock(&ctrl->crit_sect); |
1953 | init_timer(&p_slot->task_event); | 1953 | init_timer(&p_slot->task_event); |
1954 | p_slot->hp_slot = hp_slot; | 1954 | p_slot->hp_slot = hp_slot; |
1955 | p_slot->ctrl = ctrl; | 1955 | p_slot->ctrl = ctrl; |
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 1a3eb8d3d4cb..d680bb472c7b 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <linux/smp_lock.h> | 35 | #include <linux/smp_lock.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/mutex.h> | ||
38 | |||
37 | #include "ibmphp.h" | 39 | #include "ibmphp.h" |
38 | 40 | ||
39 | static int to_debug = FALSE; | 41 | static int to_debug = FALSE; |
@@ -101,7 +103,7 @@ static int to_debug = FALSE; | |||
101 | //---------------------------------------------------------------------------- | 103 | //---------------------------------------------------------------------------- |
102 | static int ibmphp_shutdown; | 104 | static int ibmphp_shutdown; |
103 | static int tid_poll; | 105 | static int tid_poll; |
104 | static struct semaphore sem_hpcaccess; // lock access to HPC | 106 | static struct mutex sem_hpcaccess; // lock access to HPC |
105 | static struct semaphore semOperations; // lock all operations and | 107 | static struct semaphore semOperations; // lock all operations and |
106 | // access to data structures | 108 | // access to data structures |
107 | static struct semaphore sem_exit; // make sure polling thread goes away | 109 | static struct semaphore sem_exit; // make sure polling thread goes away |
@@ -131,7 +133,7 @@ void __init ibmphp_hpc_initvars (void) | |||
131 | { | 133 | { |
132 | debug ("%s - Entry\n", __FUNCTION__); | 134 | debug ("%s - Entry\n", __FUNCTION__); |
133 | 135 | ||
134 | init_MUTEX (&sem_hpcaccess); | 136 | mutex_init(&sem_hpcaccess); |
135 | init_MUTEX (&semOperations); | 137 | init_MUTEX (&semOperations); |
136 | init_MUTEX_LOCKED (&sem_exit); | 138 | init_MUTEX_LOCKED (&sem_exit); |
137 | to_debug = FALSE; | 139 | to_debug = FALSE; |
@@ -778,7 +780,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | |||
778 | *---------------------------------------------------------------------*/ | 780 | *---------------------------------------------------------------------*/ |
779 | static void get_hpc_access (void) | 781 | static void get_hpc_access (void) |
780 | { | 782 | { |
781 | down (&sem_hpcaccess); | 783 | mutex_lock(&sem_hpcaccess); |
782 | } | 784 | } |
783 | 785 | ||
784 | /*---------------------------------------------------------------------- | 786 | /*---------------------------------------------------------------------- |
@@ -786,7 +788,7 @@ static void get_hpc_access (void) | |||
786 | *---------------------------------------------------------------------*/ | 788 | *---------------------------------------------------------------------*/ |
787 | void free_hpc_access (void) | 789 | void free_hpc_access (void) |
788 | { | 790 | { |
789 | up (&sem_hpcaccess); | 791 | mutex_unlock(&sem_hpcaccess); |
790 | } | 792 | } |
791 | 793 | ||
792 | /*---------------------------------------------------------------------- | 794 | /*---------------------------------------------------------------------- |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 0aac6a61337d..e0adf4bc89e8 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/sched.h> /* signal_pending() */ | 35 | #include <linux/sched.h> /* signal_pending() */ |
36 | #include <linux/pcieport_if.h> | 36 | #include <linux/pcieport_if.h> |
37 | #include <linux/mutex.h> | ||
37 | #include "pci_hotplug.h" | 38 | #include "pci_hotplug.h" |
38 | 39 | ||
39 | #define MY_NAME "pciehp" | 40 | #define MY_NAME "pciehp" |
@@ -96,7 +97,7 @@ struct php_ctlr_state_s { | |||
96 | #define MAX_EVENTS 10 | 97 | #define MAX_EVENTS 10 |
97 | struct controller { | 98 | struct controller { |
98 | struct controller *next; | 99 | struct controller *next; |
99 | struct semaphore crit_sect; /* critical section semaphore */ | 100 | struct mutex crit_sect; /* critical section mutex */ |
100 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ | 101 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ |
101 | int num_slots; /* Number of slots on ctlr */ | 102 | int num_slots; /* Number of slots on ctlr */ |
102 | int slot_num_inc; /* 1 or -1 */ | 103 | int slot_num_inc; /* 1 or -1 */ |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 4fb569018a24..1e8506e0fd87 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -439,7 +439,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
439 | } | 439 | } |
440 | 440 | ||
441 | /* Wait for exclusive access to hardware */ | 441 | /* Wait for exclusive access to hardware */ |
442 | down(&ctrl->crit_sect); | 442 | mutex_lock(&ctrl->crit_sect); |
443 | 443 | ||
444 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ | 444 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ |
445 | 445 | ||
@@ -447,7 +447,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
447 | rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ | 447 | rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ |
448 | if (rc) { | 448 | if (rc) { |
449 | /* Done with exclusive hardware access */ | 449 | /* Done with exclusive hardware access */ |
450 | up(&ctrl->crit_sect); | 450 | mutex_unlock(&ctrl->crit_sect); |
451 | goto err_out_free_ctrl_slot; | 451 | goto err_out_free_ctrl_slot; |
452 | } else | 452 | } else |
453 | /* Wait for the command to complete */ | 453 | /* Wait for the command to complete */ |
@@ -455,7 +455,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
455 | } | 455 | } |
456 | 456 | ||
457 | /* Done with exclusive hardware access */ | 457 | /* Done with exclusive hardware access */ |
458 | up(&ctrl->crit_sect); | 458 | mutex_unlock(&ctrl->crit_sect); |
459 | 459 | ||
460 | return 0; | 460 | return 0; |
461 | 461 | ||
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 83c4b865718a..33d198768356 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -229,13 +229,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
229 | static void set_slot_off(struct controller *ctrl, struct slot * pslot) | 229 | static void set_slot_off(struct controller *ctrl, struct slot * pslot) |
230 | { | 230 | { |
231 | /* Wait for exclusive access to hardware */ | 231 | /* Wait for exclusive access to hardware */ |
232 | down(&ctrl->crit_sect); | 232 | mutex_lock(&ctrl->crit_sect); |
233 | 233 | ||
234 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ | 234 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ |
235 | if (POWER_CTRL(ctrl->ctrlcap)) { | 235 | if (POWER_CTRL(ctrl->ctrlcap)) { |
236 | if (pslot->hpc_ops->power_off_slot(pslot)) { | 236 | if (pslot->hpc_ops->power_off_slot(pslot)) { |
237 | err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__); | 237 | err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__); |
238 | up(&ctrl->crit_sect); | 238 | mutex_unlock(&ctrl->crit_sect); |
239 | return; | 239 | return; |
240 | } | 240 | } |
241 | wait_for_ctrl_irq (ctrl); | 241 | wait_for_ctrl_irq (ctrl); |
@@ -249,14 +249,14 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
249 | if (ATTN_LED(ctrl->ctrlcap)) { | 249 | if (ATTN_LED(ctrl->ctrlcap)) { |
250 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { | 250 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { |
251 | err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__); | 251 | err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__); |
252 | up(&ctrl->crit_sect); | 252 | mutex_unlock(&ctrl->crit_sect); |
253 | return; | 253 | return; |
254 | } | 254 | } |
255 | wait_for_ctrl_irq (ctrl); | 255 | wait_for_ctrl_irq (ctrl); |
256 | } | 256 | } |
257 | 257 | ||
258 | /* Done with exclusive hardware access */ | 258 | /* Done with exclusive hardware access */ |
259 | up(&ctrl->crit_sect); | 259 | mutex_unlock(&ctrl->crit_sect); |
260 | } | 260 | } |
261 | 261 | ||
262 | /** | 262 | /** |
@@ -279,13 +279,13 @@ static int board_added(struct slot *p_slot) | |||
279 | ctrl->slot_device_offset, hp_slot); | 279 | ctrl->slot_device_offset, hp_slot); |
280 | 280 | ||
281 | /* Wait for exclusive access to hardware */ | 281 | /* Wait for exclusive access to hardware */ |
282 | down(&ctrl->crit_sect); | 282 | mutex_lock(&ctrl->crit_sect); |
283 | 283 | ||
284 | if (POWER_CTRL(ctrl->ctrlcap)) { | 284 | if (POWER_CTRL(ctrl->ctrlcap)) { |
285 | /* Power on slot */ | 285 | /* Power on slot */ |
286 | rc = p_slot->hpc_ops->power_on_slot(p_slot); | 286 | rc = p_slot->hpc_ops->power_on_slot(p_slot); |
287 | if (rc) { | 287 | if (rc) { |
288 | up(&ctrl->crit_sect); | 288 | mutex_unlock(&ctrl->crit_sect); |
289 | return -1; | 289 | return -1; |
290 | } | 290 | } |
291 | 291 | ||
@@ -301,7 +301,7 @@ static int board_added(struct slot *p_slot) | |||
301 | } | 301 | } |
302 | 302 | ||
303 | /* Done with exclusive hardware access */ | 303 | /* Done with exclusive hardware access */ |
304 | up(&ctrl->crit_sect); | 304 | mutex_unlock(&ctrl->crit_sect); |
305 | 305 | ||
306 | /* Wait for ~1 second */ | 306 | /* Wait for ~1 second */ |
307 | wait_for_ctrl_irq (ctrl); | 307 | wait_for_ctrl_irq (ctrl); |
@@ -335,7 +335,7 @@ static int board_added(struct slot *p_slot) | |||
335 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); | 335 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); |
336 | if (PWR_LED(ctrl->ctrlcap)) { | 336 | if (PWR_LED(ctrl->ctrlcap)) { |
337 | /* Wait for exclusive access to hardware */ | 337 | /* Wait for exclusive access to hardware */ |
338 | down(&ctrl->crit_sect); | 338 | mutex_lock(&ctrl->crit_sect); |
339 | 339 | ||
340 | p_slot->hpc_ops->green_led_on(p_slot); | 340 | p_slot->hpc_ops->green_led_on(p_slot); |
341 | 341 | ||
@@ -343,7 +343,7 @@ static int board_added(struct slot *p_slot) | |||
343 | wait_for_ctrl_irq (ctrl); | 343 | wait_for_ctrl_irq (ctrl); |
344 | 344 | ||
345 | /* Done with exclusive hardware access */ | 345 | /* Done with exclusive hardware access */ |
346 | up(&ctrl->crit_sect); | 346 | mutex_unlock(&ctrl->crit_sect); |
347 | } | 347 | } |
348 | return 0; | 348 | return 0; |
349 | 349 | ||
@@ -375,14 +375,14 @@ static int remove_board(struct slot *p_slot) | |||
375 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 375 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); |
376 | 376 | ||
377 | /* Wait for exclusive access to hardware */ | 377 | /* Wait for exclusive access to hardware */ |
378 | down(&ctrl->crit_sect); | 378 | mutex_lock(&ctrl->crit_sect); |
379 | 379 | ||
380 | if (POWER_CTRL(ctrl->ctrlcap)) { | 380 | if (POWER_CTRL(ctrl->ctrlcap)) { |
381 | /* power off slot */ | 381 | /* power off slot */ |
382 | rc = p_slot->hpc_ops->power_off_slot(p_slot); | 382 | rc = p_slot->hpc_ops->power_off_slot(p_slot); |
383 | if (rc) { | 383 | if (rc) { |
384 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); | 384 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); |
385 | up(&ctrl->crit_sect); | 385 | mutex_unlock(&ctrl->crit_sect); |
386 | return rc; | 386 | return rc; |
387 | } | 387 | } |
388 | /* Wait for the command to complete */ | 388 | /* Wait for the command to complete */ |
@@ -398,7 +398,7 @@ static int remove_board(struct slot *p_slot) | |||
398 | } | 398 | } |
399 | 399 | ||
400 | /* Done with exclusive hardware access */ | 400 | /* Done with exclusive hardware access */ |
401 | up(&ctrl->crit_sect); | 401 | mutex_unlock(&ctrl->crit_sect); |
402 | 402 | ||
403 | return 0; | 403 | return 0; |
404 | } | 404 | } |
@@ -445,7 +445,7 @@ static void pciehp_pushbutton_thread(unsigned long slot) | |||
445 | 445 | ||
446 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 446 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
447 | /* Wait for exclusive access to hardware */ | 447 | /* Wait for exclusive access to hardware */ |
448 | down(&p_slot->ctrl->crit_sect); | 448 | mutex_lock(&p_slot->ctrl->crit_sect); |
449 | 449 | ||
450 | p_slot->hpc_ops->green_led_off(p_slot); | 450 | p_slot->hpc_ops->green_led_off(p_slot); |
451 | 451 | ||
@@ -453,7 +453,7 @@ static void pciehp_pushbutton_thread(unsigned long slot) | |||
453 | wait_for_ctrl_irq (p_slot->ctrl); | 453 | wait_for_ctrl_irq (p_slot->ctrl); |
454 | 454 | ||
455 | /* Done with exclusive hardware access */ | 455 | /* Done with exclusive hardware access */ |
456 | up(&p_slot->ctrl->crit_sect); | 456 | mutex_unlock(&p_slot->ctrl->crit_sect); |
457 | } | 457 | } |
458 | p_slot->state = STATIC_STATE; | 458 | p_slot->state = STATIC_STATE; |
459 | } | 459 | } |
@@ -495,7 +495,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot) | |||
495 | 495 | ||
496 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 496 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
497 | /* Wait for exclusive access to hardware */ | 497 | /* Wait for exclusive access to hardware */ |
498 | down(&p_slot->ctrl->crit_sect); | 498 | mutex_lock(&p_slot->ctrl->crit_sect); |
499 | 499 | ||
500 | p_slot->hpc_ops->green_led_off(p_slot); | 500 | p_slot->hpc_ops->green_led_off(p_slot); |
501 | 501 | ||
@@ -503,7 +503,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot) | |||
503 | wait_for_ctrl_irq (p_slot->ctrl); | 503 | wait_for_ctrl_irq (p_slot->ctrl); |
504 | 504 | ||
505 | /* Done with exclusive hardware access */ | 505 | /* Done with exclusive hardware access */ |
506 | up(&p_slot->ctrl->crit_sect); | 506 | mutex_unlock(&p_slot->ctrl->crit_sect); |
507 | } | 507 | } |
508 | p_slot->state = STATIC_STATE; | 508 | p_slot->state = STATIC_STATE; |
509 | } | 509 | } |
@@ -616,7 +616,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
616 | switch (p_slot->state) { | 616 | switch (p_slot->state) { |
617 | case BLINKINGOFF_STATE: | 617 | case BLINKINGOFF_STATE: |
618 | /* Wait for exclusive access to hardware */ | 618 | /* Wait for exclusive access to hardware */ |
619 | down(&ctrl->crit_sect); | 619 | mutex_lock(&ctrl->crit_sect); |
620 | 620 | ||
621 | if (PWR_LED(ctrl->ctrlcap)) { | 621 | if (PWR_LED(ctrl->ctrlcap)) { |
622 | p_slot->hpc_ops->green_led_on(p_slot); | 622 | p_slot->hpc_ops->green_led_on(p_slot); |
@@ -630,11 +630,11 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
630 | wait_for_ctrl_irq (ctrl); | 630 | wait_for_ctrl_irq (ctrl); |
631 | } | 631 | } |
632 | /* Done with exclusive hardware access */ | 632 | /* Done with exclusive hardware access */ |
633 | up(&ctrl->crit_sect); | 633 | mutex_unlock(&ctrl->crit_sect); |
634 | break; | 634 | break; |
635 | case BLINKINGON_STATE: | 635 | case BLINKINGON_STATE: |
636 | /* Wait for exclusive access to hardware */ | 636 | /* Wait for exclusive access to hardware */ |
637 | down(&ctrl->crit_sect); | 637 | mutex_lock(&ctrl->crit_sect); |
638 | 638 | ||
639 | if (PWR_LED(ctrl->ctrlcap)) { | 639 | if (PWR_LED(ctrl->ctrlcap)) { |
640 | p_slot->hpc_ops->green_led_off(p_slot); | 640 | p_slot->hpc_ops->green_led_off(p_slot); |
@@ -647,7 +647,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
647 | wait_for_ctrl_irq (ctrl); | 647 | wait_for_ctrl_irq (ctrl); |
648 | } | 648 | } |
649 | /* Done with exclusive hardware access */ | 649 | /* Done with exclusive hardware access */ |
650 | up(&ctrl->crit_sect); | 650 | mutex_unlock(&ctrl->crit_sect); |
651 | 651 | ||
652 | break; | 652 | break; |
653 | default: | 653 | default: |
@@ -676,7 +676,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
676 | } | 676 | } |
677 | 677 | ||
678 | /* Wait for exclusive access to hardware */ | 678 | /* Wait for exclusive access to hardware */ |
679 | down(&ctrl->crit_sect); | 679 | mutex_lock(&ctrl->crit_sect); |
680 | 680 | ||
681 | /* blink green LED and turn off amber */ | 681 | /* blink green LED and turn off amber */ |
682 | if (PWR_LED(ctrl->ctrlcap)) { | 682 | if (PWR_LED(ctrl->ctrlcap)) { |
@@ -693,7 +693,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
693 | } | 693 | } |
694 | 694 | ||
695 | /* Done with exclusive hardware access */ | 695 | /* Done with exclusive hardware access */ |
696 | up(&ctrl->crit_sect); | 696 | mutex_unlock(&ctrl->crit_sect); |
697 | 697 | ||
698 | init_timer(&p_slot->task_event); | 698 | init_timer(&p_slot->task_event); |
699 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ | 699 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ |
@@ -708,7 +708,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
708 | if (POWER_CTRL(ctrl->ctrlcap)) { | 708 | if (POWER_CTRL(ctrl->ctrlcap)) { |
709 | dbg("power fault\n"); | 709 | dbg("power fault\n"); |
710 | /* Wait for exclusive access to hardware */ | 710 | /* Wait for exclusive access to hardware */ |
711 | down(&ctrl->crit_sect); | 711 | mutex_lock(&ctrl->crit_sect); |
712 | 712 | ||
713 | if (ATTN_LED(ctrl->ctrlcap)) { | 713 | if (ATTN_LED(ctrl->ctrlcap)) { |
714 | p_slot->hpc_ops->set_attention_status(p_slot, 1); | 714 | p_slot->hpc_ops->set_attention_status(p_slot, 1); |
@@ -721,7 +721,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
721 | } | 721 | } |
722 | 722 | ||
723 | /* Done with exclusive hardware access */ | 723 | /* Done with exclusive hardware access */ |
724 | up(&ctrl->crit_sect); | 724 | mutex_unlock(&ctrl->crit_sect); |
725 | } | 725 | } |
726 | } | 726 | } |
727 | /***********SURPRISE REMOVAL********************/ | 727 | /***********SURPRISE REMOVAL********************/ |
@@ -756,19 +756,19 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
756 | int rc; | 756 | int rc; |
757 | 757 | ||
758 | /* Check to see if (latch closed, card present, power off) */ | 758 | /* Check to see if (latch closed, card present, power off) */ |
759 | down(&p_slot->ctrl->crit_sect); | 759 | mutex_lock(&p_slot->ctrl->crit_sect); |
760 | 760 | ||
761 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 761 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
762 | if (rc || !getstatus) { | 762 | if (rc || !getstatus) { |
763 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 763 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
764 | up(&p_slot->ctrl->crit_sect); | 764 | mutex_unlock(&p_slot->ctrl->crit_sect); |
765 | return 1; | 765 | return 1; |
766 | } | 766 | } |
767 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { | 767 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { |
768 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 768 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
769 | if (rc || getstatus) { | 769 | if (rc || getstatus) { |
770 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 770 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
771 | up(&p_slot->ctrl->crit_sect); | 771 | mutex_unlock(&p_slot->ctrl->crit_sect); |
772 | return 1; | 772 | return 1; |
773 | } | 773 | } |
774 | } | 774 | } |
@@ -777,11 +777,11 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
777 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 777 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
778 | if (rc || getstatus) { | 778 | if (rc || getstatus) { |
779 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); | 779 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); |
780 | up(&p_slot->ctrl->crit_sect); | 780 | mutex_unlock(&p_slot->ctrl->crit_sect); |
781 | return 1; | 781 | return 1; |
782 | } | 782 | } |
783 | } | 783 | } |
784 | up(&p_slot->ctrl->crit_sect); | 784 | mutex_unlock(&p_slot->ctrl->crit_sect); |
785 | 785 | ||
786 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 786 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
787 | 787 | ||
@@ -806,13 +806,13 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
806 | return 1; | 806 | return 1; |
807 | 807 | ||
808 | /* Check to see if (latch closed, card present, power on) */ | 808 | /* Check to see if (latch closed, card present, power on) */ |
809 | down(&p_slot->ctrl->crit_sect); | 809 | mutex_lock(&p_slot->ctrl->crit_sect); |
810 | 810 | ||
811 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { | 811 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { |
812 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 812 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
813 | if (ret || !getstatus) { | 813 | if (ret || !getstatus) { |
814 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 814 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
815 | up(&p_slot->ctrl->crit_sect); | 815 | mutex_unlock(&p_slot->ctrl->crit_sect); |
816 | return 1; | 816 | return 1; |
817 | } | 817 | } |
818 | } | 818 | } |
@@ -821,7 +821,7 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
821 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 821 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
822 | if (ret || getstatus) { | 822 | if (ret || getstatus) { |
823 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 823 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
824 | up(&p_slot->ctrl->crit_sect); | 824 | mutex_unlock(&p_slot->ctrl->crit_sect); |
825 | return 1; | 825 | return 1; |
826 | } | 826 | } |
827 | } | 827 | } |
@@ -830,12 +830,12 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
830 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 830 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
831 | if (ret || !getstatus) { | 831 | if (ret || !getstatus) { |
832 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); | 832 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); |
833 | up(&p_slot->ctrl->crit_sect); | 833 | mutex_unlock(&p_slot->ctrl->crit_sect); |
834 | return 1; | 834 | return 1; |
835 | } | 835 | } |
836 | } | 836 | } |
837 | 837 | ||
838 | up(&p_slot->ctrl->crit_sect); | 838 | mutex_unlock(&p_slot->ctrl->crit_sect); |
839 | 839 | ||
840 | ret = remove_board(p_slot); | 840 | ret = remove_board(p_slot); |
841 | update_slot_info(p_slot); | 841 | update_slot_info(p_slot); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 77e530321de2..2427b0862cbf 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -1334,7 +1334,7 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev) | |||
1334 | if (pci_enable_device(pdev)) | 1334 | if (pci_enable_device(pdev)) |
1335 | goto abort_free_ctlr; | 1335 | goto abort_free_ctlr; |
1336 | 1336 | ||
1337 | init_MUTEX(&ctrl->crit_sect); | 1337 | mutex_init(&ctrl->crit_sect); |
1338 | /* setup wait queue */ | 1338 | /* setup wait queue */ |
1339 | init_waitqueue_head(&ctrl->queue); | 1339 | init_waitqueue_head(&ctrl->queue); |
1340 | 1340 | ||
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index 7d6f521d02ea..5a22a43cc387 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/sched.h> /* signal_pending(), struct timer_list */ | 35 | #include <linux/sched.h> /* signal_pending(), struct timer_list */ |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #include "pci_hotplug.h" | 38 | #include "pci_hotplug.h" |
38 | 39 | ||
@@ -79,7 +80,7 @@ struct event_info { | |||
79 | 80 | ||
80 | struct controller { | 81 | struct controller { |
81 | struct controller *next; | 82 | struct controller *next; |
82 | struct semaphore crit_sect; /* critical section semaphore */ | 83 | struct mutex crit_sect; /* critical section mutex */ |
83 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ | 84 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ |
84 | int num_slots; /* Number of slots on ctlr */ | 85 | int num_slots; /* Number of slots on ctlr */ |
85 | int slot_num_inc; /* 1 or -1 */ | 86 | int slot_num_inc; /* 1 or -1 */ |
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index 643252d9bf3b..65e69252e2f9 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c | |||
@@ -242,10 +242,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, | |||
242 | int rc = 0; | 242 | int rc = 0; |
243 | 243 | ||
244 | dbg("%s: change to speed %d\n", __FUNCTION__, speed); | 244 | dbg("%s: change to speed %d\n", __FUNCTION__, speed); |
245 | down(&ctrl->crit_sect); | 245 | mutex_lock(&ctrl->crit_sect); |
246 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { | 246 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { |
247 | err("%s: Issue of set bus speed mode command failed\n", __FUNCTION__); | 247 | err("%s: Issue of set bus speed mode command failed\n", __FUNCTION__); |
248 | up(&ctrl->crit_sect); | 248 | mutex_unlock(&ctrl->crit_sect); |
249 | return WRONG_BUS_FREQUENCY; | 249 | return WRONG_BUS_FREQUENCY; |
250 | } | 250 | } |
251 | 251 | ||
@@ -253,10 +253,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, | |||
253 | err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", | 253 | err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", |
254 | __FUNCTION__); | 254 | __FUNCTION__); |
255 | err("%s: Error code (%d)\n", __FUNCTION__, rc); | 255 | err("%s: Error code (%d)\n", __FUNCTION__, rc); |
256 | up(&ctrl->crit_sect); | 256 | mutex_unlock(&ctrl->crit_sect); |
257 | return WRONG_BUS_FREQUENCY; | 257 | return WRONG_BUS_FREQUENCY; |
258 | } | 258 | } |
259 | up(&ctrl->crit_sect); | 259 | mutex_unlock(&ctrl->crit_sect); |
260 | return rc; | 260 | return rc; |
261 | } | 261 | } |
262 | 262 | ||
@@ -319,14 +319,14 @@ static int board_added(struct slot *p_slot) | |||
319 | ctrl->slot_device_offset, hp_slot); | 319 | ctrl->slot_device_offset, hp_slot); |
320 | 320 | ||
321 | /* Wait for exclusive access to hardware */ | 321 | /* Wait for exclusive access to hardware */ |
322 | down(&ctrl->crit_sect); | 322 | mutex_lock(&ctrl->crit_sect); |
323 | 323 | ||
324 | /* Power on slot without connecting to bus */ | 324 | /* Power on slot without connecting to bus */ |
325 | rc = p_slot->hpc_ops->power_on_slot(p_slot); | 325 | rc = p_slot->hpc_ops->power_on_slot(p_slot); |
326 | if (rc) { | 326 | if (rc) { |
327 | err("%s: Failed to power on slot\n", __FUNCTION__); | 327 | err("%s: Failed to power on slot\n", __FUNCTION__); |
328 | /* Done with exclusive hardware access */ | 328 | /* Done with exclusive hardware access */ |
329 | up(&ctrl->crit_sect); | 329 | mutex_unlock(&ctrl->crit_sect); |
330 | return -1; | 330 | return -1; |
331 | } | 331 | } |
332 | 332 | ||
@@ -334,7 +334,7 @@ static int board_added(struct slot *p_slot) | |||
334 | if (rc) { | 334 | if (rc) { |
335 | err("%s: Failed to power on slot, error code(%d)\n", __FUNCTION__, rc); | 335 | err("%s: Failed to power on slot, error code(%d)\n", __FUNCTION__, rc); |
336 | /* Done with exclusive hardware access */ | 336 | /* Done with exclusive hardware access */ |
337 | up(&ctrl->crit_sect); | 337 | mutex_unlock(&ctrl->crit_sect); |
338 | return -1; | 338 | return -1; |
339 | } | 339 | } |
340 | 340 | ||
@@ -345,7 +345,7 @@ static int board_added(struct slot *p_slot) | |||
345 | 345 | ||
346 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { | 346 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { |
347 | err("%s: Issue of set bus speed mode command failed\n", __FUNCTION__); | 347 | err("%s: Issue of set bus speed mode command failed\n", __FUNCTION__); |
348 | up(&ctrl->crit_sect); | 348 | mutex_unlock(&ctrl->crit_sect); |
349 | return WRONG_BUS_FREQUENCY; | 349 | return WRONG_BUS_FREQUENCY; |
350 | } | 350 | } |
351 | 351 | ||
@@ -353,19 +353,19 @@ static int board_added(struct slot *p_slot) | |||
353 | err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", | 353 | err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", |
354 | __FUNCTION__); | 354 | __FUNCTION__); |
355 | err("%s: Error code (%d)\n", __FUNCTION__, rc); | 355 | err("%s: Error code (%d)\n", __FUNCTION__, rc); |
356 | up(&ctrl->crit_sect); | 356 | mutex_unlock(&ctrl->crit_sect); |
357 | return WRONG_BUS_FREQUENCY; | 357 | return WRONG_BUS_FREQUENCY; |
358 | } | 358 | } |
359 | /* turn on board, blink green LED, turn off Amber LED */ | 359 | /* turn on board, blink green LED, turn off Amber LED */ |
360 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { | 360 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { |
361 | err("%s: Issue of Slot Enable command failed\n", __FUNCTION__); | 361 | err("%s: Issue of Slot Enable command failed\n", __FUNCTION__); |
362 | up(&ctrl->crit_sect); | 362 | mutex_unlock(&ctrl->crit_sect); |
363 | return rc; | 363 | return rc; |
364 | } | 364 | } |
365 | 365 | ||
366 | if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { | 366 | if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { |
367 | err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); | 367 | err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); |
368 | up(&ctrl->crit_sect); | 368 | mutex_unlock(&ctrl->crit_sect); |
369 | return rc; | 369 | return rc; |
370 | } | 370 | } |
371 | } | 371 | } |
@@ -380,7 +380,7 @@ static int board_added(struct slot *p_slot) | |||
380 | if (rc || adapter_speed == PCI_SPEED_UNKNOWN) { | 380 | if (rc || adapter_speed == PCI_SPEED_UNKNOWN) { |
381 | err("%s: Can't get adapter speed or bus mode mismatch\n", __FUNCTION__); | 381 | err("%s: Can't get adapter speed or bus mode mismatch\n", __FUNCTION__); |
382 | /* Done with exclusive hardware access */ | 382 | /* Done with exclusive hardware access */ |
383 | up(&ctrl->crit_sect); | 383 | mutex_unlock(&ctrl->crit_sect); |
384 | return WRONG_BUS_FREQUENCY; | 384 | return WRONG_BUS_FREQUENCY; |
385 | } | 385 | } |
386 | 386 | ||
@@ -388,7 +388,7 @@ static int board_added(struct slot *p_slot) | |||
388 | if (rc || bus_speed == PCI_SPEED_UNKNOWN) { | 388 | if (rc || bus_speed == PCI_SPEED_UNKNOWN) { |
389 | err("%s: Can't get bus operation speed\n", __FUNCTION__); | 389 | err("%s: Can't get bus operation speed\n", __FUNCTION__); |
390 | /* Done with exclusive hardware access */ | 390 | /* Done with exclusive hardware access */ |
391 | up(&ctrl->crit_sect); | 391 | mutex_unlock(&ctrl->crit_sect); |
392 | return WRONG_BUS_FREQUENCY; | 392 | return WRONG_BUS_FREQUENCY; |
393 | } | 393 | } |
394 | 394 | ||
@@ -399,7 +399,7 @@ static int board_added(struct slot *p_slot) | |||
399 | } | 399 | } |
400 | 400 | ||
401 | /* Done with exclusive hardware access */ | 401 | /* Done with exclusive hardware access */ |
402 | up(&ctrl->crit_sect); | 402 | mutex_unlock(&ctrl->crit_sect); |
403 | 403 | ||
404 | if ((rc = p_slot->hpc_ops->get_prog_int(p_slot, &pi))) { | 404 | if ((rc = p_slot->hpc_ops->get_prog_int(p_slot, &pi))) { |
405 | err("%s: Can't get controller programming interface, set it to 1\n", __FUNCTION__); | 405 | err("%s: Can't get controller programming interface, set it to 1\n", __FUNCTION__); |
@@ -481,21 +481,21 @@ static int board_added(struct slot *p_slot) | |||
481 | return rc; | 481 | return rc; |
482 | } | 482 | } |
483 | 483 | ||
484 | down(&ctrl->crit_sect); | 484 | mutex_lock(&ctrl->crit_sect); |
485 | /* turn on board, blink green LED, turn off Amber LED */ | 485 | /* turn on board, blink green LED, turn off Amber LED */ |
486 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { | 486 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { |
487 | err("%s: Issue of Slot Enable command failed\n", __FUNCTION__); | 487 | err("%s: Issue of Slot Enable command failed\n", __FUNCTION__); |
488 | up(&ctrl->crit_sect); | 488 | mutex_unlock(&ctrl->crit_sect); |
489 | return rc; | 489 | return rc; |
490 | } | 490 | } |
491 | 491 | ||
492 | if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { | 492 | if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { |
493 | err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); | 493 | err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); |
494 | up(&ctrl->crit_sect); | 494 | mutex_unlock(&ctrl->crit_sect); |
495 | return rc; | 495 | return rc; |
496 | } | 496 | } |
497 | 497 | ||
498 | up(&ctrl->crit_sect); | 498 | mutex_unlock(&ctrl->crit_sect); |
499 | 499 | ||
500 | /* Wait for ~1 second */ | 500 | /* Wait for ~1 second */ |
501 | wait_for_ctrl_irq (ctrl); | 501 | wait_for_ctrl_irq (ctrl); |
@@ -521,25 +521,25 @@ static int board_added(struct slot *p_slot) | |||
521 | p_slot->pwr_save = 1; | 521 | p_slot->pwr_save = 1; |
522 | 522 | ||
523 | /* Wait for exclusive access to hardware */ | 523 | /* Wait for exclusive access to hardware */ |
524 | down(&ctrl->crit_sect); | 524 | mutex_lock(&ctrl->crit_sect); |
525 | 525 | ||
526 | p_slot->hpc_ops->green_led_on(p_slot); | 526 | p_slot->hpc_ops->green_led_on(p_slot); |
527 | 527 | ||
528 | /* Done with exclusive hardware access */ | 528 | /* Done with exclusive hardware access */ |
529 | up(&ctrl->crit_sect); | 529 | mutex_unlock(&ctrl->crit_sect); |
530 | 530 | ||
531 | return 0; | 531 | return 0; |
532 | 532 | ||
533 | err_exit: | 533 | err_exit: |
534 | /* Wait for exclusive access to hardware */ | 534 | /* Wait for exclusive access to hardware */ |
535 | down(&ctrl->crit_sect); | 535 | mutex_lock(&ctrl->crit_sect); |
536 | 536 | ||
537 | /* turn off slot, turn on Amber LED, turn off Green LED */ | 537 | /* turn off slot, turn on Amber LED, turn off Green LED */ |
538 | rc = p_slot->hpc_ops->slot_disable(p_slot); | 538 | rc = p_slot->hpc_ops->slot_disable(p_slot); |
539 | if (rc) { | 539 | if (rc) { |
540 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); | 540 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); |
541 | /* Done with exclusive hardware access */ | 541 | /* Done with exclusive hardware access */ |
542 | up(&ctrl->crit_sect); | 542 | mutex_unlock(&ctrl->crit_sect); |
543 | return rc; | 543 | return rc; |
544 | } | 544 | } |
545 | 545 | ||
@@ -547,12 +547,12 @@ err_exit: | |||
547 | if (rc) { | 547 | if (rc) { |
548 | err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, rc); | 548 | err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, rc); |
549 | /* Done with exclusive hardware access */ | 549 | /* Done with exclusive hardware access */ |
550 | up(&ctrl->crit_sect); | 550 | mutex_unlock(&ctrl->crit_sect); |
551 | return rc; | 551 | return rc; |
552 | } | 552 | } |
553 | 553 | ||
554 | /* Done with exclusive hardware access */ | 554 | /* Done with exclusive hardware access */ |
555 | up(&ctrl->crit_sect); | 555 | mutex_unlock(&ctrl->crit_sect); |
556 | 556 | ||
557 | return(rc); | 557 | return(rc); |
558 | } | 558 | } |
@@ -581,14 +581,14 @@ static int remove_board(struct slot *p_slot) | |||
581 | p_slot->status = 0x01; | 581 | p_slot->status = 0x01; |
582 | 582 | ||
583 | /* Wait for exclusive access to hardware */ | 583 | /* Wait for exclusive access to hardware */ |
584 | down(&ctrl->crit_sect); | 584 | mutex_lock(&ctrl->crit_sect); |
585 | 585 | ||
586 | /* turn off slot, turn on Amber LED, turn off Green LED */ | 586 | /* turn off slot, turn on Amber LED, turn off Green LED */ |
587 | rc = p_slot->hpc_ops->slot_disable(p_slot); | 587 | rc = p_slot->hpc_ops->slot_disable(p_slot); |
588 | if (rc) { | 588 | if (rc) { |
589 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); | 589 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); |
590 | /* Done with exclusive hardware access */ | 590 | /* Done with exclusive hardware access */ |
591 | up(&ctrl->crit_sect); | 591 | mutex_unlock(&ctrl->crit_sect); |
592 | return rc; | 592 | return rc; |
593 | } | 593 | } |
594 | 594 | ||
@@ -596,7 +596,7 @@ static int remove_board(struct slot *p_slot) | |||
596 | if (rc) { | 596 | if (rc) { |
597 | err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, rc); | 597 | err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, rc); |
598 | /* Done with exclusive hardware access */ | 598 | /* Done with exclusive hardware access */ |
599 | up(&ctrl->crit_sect); | 599 | mutex_unlock(&ctrl->crit_sect); |
600 | return rc; | 600 | return rc; |
601 | } | 601 | } |
602 | 602 | ||
@@ -604,12 +604,12 @@ static int remove_board(struct slot *p_slot) | |||
604 | if (rc) { | 604 | if (rc) { |
605 | err("%s: Issue of Set Attention command failed\n", __FUNCTION__); | 605 | err("%s: Issue of Set Attention command failed\n", __FUNCTION__); |
606 | /* Done with exclusive hardware access */ | 606 | /* Done with exclusive hardware access */ |
607 | up(&ctrl->crit_sect); | 607 | mutex_unlock(&ctrl->crit_sect); |
608 | return rc; | 608 | return rc; |
609 | } | 609 | } |
610 | 610 | ||
611 | /* Done with exclusive hardware access */ | 611 | /* Done with exclusive hardware access */ |
612 | up(&ctrl->crit_sect); | 612 | mutex_unlock(&ctrl->crit_sect); |
613 | 613 | ||
614 | p_slot->pwr_save = 0; | 614 | p_slot->pwr_save = 0; |
615 | p_slot->is_a_board = 0; | 615 | p_slot->is_a_board = 0; |
@@ -656,12 +656,12 @@ static void shpchp_pushbutton_thread (unsigned long slot) | |||
656 | 656 | ||
657 | if (shpchp_enable_slot(p_slot)) { | 657 | if (shpchp_enable_slot(p_slot)) { |
658 | /* Wait for exclusive access to hardware */ | 658 | /* Wait for exclusive access to hardware */ |
659 | down(&p_slot->ctrl->crit_sect); | 659 | mutex_lock(&p_slot->ctrl->crit_sect); |
660 | 660 | ||
661 | p_slot->hpc_ops->green_led_off(p_slot); | 661 | p_slot->hpc_ops->green_led_off(p_slot); |
662 | 662 | ||
663 | /* Done with exclusive hardware access */ | 663 | /* Done with exclusive hardware access */ |
664 | up(&p_slot->ctrl->crit_sect); | 664 | mutex_unlock(&p_slot->ctrl->crit_sect); |
665 | } | 665 | } |
666 | p_slot->state = STATIC_STATE; | 666 | p_slot->state = STATIC_STATE; |
667 | } | 667 | } |
@@ -768,25 +768,25 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
768 | switch (p_slot->state) { | 768 | switch (p_slot->state) { |
769 | case BLINKINGOFF_STATE: | 769 | case BLINKINGOFF_STATE: |
770 | /* Wait for exclusive access to hardware */ | 770 | /* Wait for exclusive access to hardware */ |
771 | down(&ctrl->crit_sect); | 771 | mutex_lock(&ctrl->crit_sect); |
772 | 772 | ||
773 | p_slot->hpc_ops->green_led_on(p_slot); | 773 | p_slot->hpc_ops->green_led_on(p_slot); |
774 | 774 | ||
775 | p_slot->hpc_ops->set_attention_status(p_slot, 0); | 775 | p_slot->hpc_ops->set_attention_status(p_slot, 0); |
776 | 776 | ||
777 | /* Done with exclusive hardware access */ | 777 | /* Done with exclusive hardware access */ |
778 | up(&ctrl->crit_sect); | 778 | mutex_unlock(&ctrl->crit_sect); |
779 | break; | 779 | break; |
780 | case BLINKINGON_STATE: | 780 | case BLINKINGON_STATE: |
781 | /* Wait for exclusive access to hardware */ | 781 | /* Wait for exclusive access to hardware */ |
782 | down(&ctrl->crit_sect); | 782 | mutex_lock(&ctrl->crit_sect); |
783 | 783 | ||
784 | p_slot->hpc_ops->green_led_off(p_slot); | 784 | p_slot->hpc_ops->green_led_off(p_slot); |
785 | 785 | ||
786 | p_slot->hpc_ops->set_attention_status(p_slot, 0); | 786 | p_slot->hpc_ops->set_attention_status(p_slot, 0); |
787 | 787 | ||
788 | /* Done with exclusive hardware access */ | 788 | /* Done with exclusive hardware access */ |
789 | up(&ctrl->crit_sect); | 789 | mutex_unlock(&ctrl->crit_sect); |
790 | 790 | ||
791 | break; | 791 | break; |
792 | default: | 792 | default: |
@@ -813,7 +813,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
813 | } | 813 | } |
814 | 814 | ||
815 | /* Wait for exclusive access to hardware */ | 815 | /* Wait for exclusive access to hardware */ |
816 | down(&ctrl->crit_sect); | 816 | mutex_lock(&ctrl->crit_sect); |
817 | 817 | ||
818 | /* blink green LED and turn off amber */ | 818 | /* blink green LED and turn off amber */ |
819 | p_slot->hpc_ops->green_led_blink(p_slot); | 819 | p_slot->hpc_ops->green_led_blink(p_slot); |
@@ -821,7 +821,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
821 | p_slot->hpc_ops->set_attention_status(p_slot, 0); | 821 | p_slot->hpc_ops->set_attention_status(p_slot, 0); |
822 | 822 | ||
823 | /* Done with exclusive hardware access */ | 823 | /* Done with exclusive hardware access */ |
824 | up(&ctrl->crit_sect); | 824 | mutex_unlock(&ctrl->crit_sect); |
825 | 825 | ||
826 | init_timer(&p_slot->task_event); | 826 | init_timer(&p_slot->task_event); |
827 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ | 827 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ |
@@ -834,14 +834,14 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
834 | /***********POWER FAULT********************/ | 834 | /***********POWER FAULT********************/ |
835 | dbg("%s: power fault\n", __FUNCTION__); | 835 | dbg("%s: power fault\n", __FUNCTION__); |
836 | /* Wait for exclusive access to hardware */ | 836 | /* Wait for exclusive access to hardware */ |
837 | down(&ctrl->crit_sect); | 837 | mutex_lock(&ctrl->crit_sect); |
838 | 838 | ||
839 | p_slot->hpc_ops->set_attention_status(p_slot, 1); | 839 | p_slot->hpc_ops->set_attention_status(p_slot, 1); |
840 | 840 | ||
841 | p_slot->hpc_ops->green_led_off(p_slot); | 841 | p_slot->hpc_ops->green_led_off(p_slot); |
842 | 842 | ||
843 | /* Done with exclusive hardware access */ | 843 | /* Done with exclusive hardware access */ |
844 | up(&ctrl->crit_sect); | 844 | mutex_unlock(&ctrl->crit_sect); |
845 | } else { | 845 | } else { |
846 | /* refresh notification */ | 846 | /* refresh notification */ |
847 | if (p_slot) | 847 | if (p_slot) |
@@ -865,26 +865,26 @@ int shpchp_enable_slot (struct slot *p_slot) | |||
865 | int rc; | 865 | int rc; |
866 | 866 | ||
867 | /* Check to see if (latch closed, card present, power off) */ | 867 | /* Check to see if (latch closed, card present, power off) */ |
868 | down(&p_slot->ctrl->crit_sect); | 868 | mutex_lock(&p_slot->ctrl->crit_sect); |
869 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 869 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
870 | if (rc || !getstatus) { | 870 | if (rc || !getstatus) { |
871 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 871 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
872 | up(&p_slot->ctrl->crit_sect); | 872 | mutex_unlock(&p_slot->ctrl->crit_sect); |
873 | return -ENODEV; | 873 | return -ENODEV; |
874 | } | 874 | } |
875 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 875 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
876 | if (rc || getstatus) { | 876 | if (rc || getstatus) { |
877 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 877 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
878 | up(&p_slot->ctrl->crit_sect); | 878 | mutex_unlock(&p_slot->ctrl->crit_sect); |
879 | return -ENODEV; | 879 | return -ENODEV; |
880 | } | 880 | } |
881 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 881 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
882 | if (rc || getstatus) { | 882 | if (rc || getstatus) { |
883 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); | 883 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); |
884 | up(&p_slot->ctrl->crit_sect); | 884 | mutex_unlock(&p_slot->ctrl->crit_sect); |
885 | return -ENODEV; | 885 | return -ENODEV; |
886 | } | 886 | } |
887 | up(&p_slot->ctrl->crit_sect); | 887 | mutex_unlock(&p_slot->ctrl->crit_sect); |
888 | 888 | ||
889 | p_slot->is_a_board = 1; | 889 | p_slot->is_a_board = 1; |
890 | 890 | ||
@@ -925,27 +925,27 @@ int shpchp_disable_slot (struct slot *p_slot) | |||
925 | return -ENODEV; | 925 | return -ENODEV; |
926 | 926 | ||
927 | /* Check to see if (latch closed, card present, power on) */ | 927 | /* Check to see if (latch closed, card present, power on) */ |
928 | down(&p_slot->ctrl->crit_sect); | 928 | mutex_lock(&p_slot->ctrl->crit_sect); |
929 | 929 | ||
930 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 930 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
931 | if (ret || !getstatus) { | 931 | if (ret || !getstatus) { |
932 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 932 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
933 | up(&p_slot->ctrl->crit_sect); | 933 | mutex_unlock(&p_slot->ctrl->crit_sect); |
934 | return -ENODEV; | 934 | return -ENODEV; |
935 | } | 935 | } |
936 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 936 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
937 | if (ret || getstatus) { | 937 | if (ret || getstatus) { |
938 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 938 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
939 | up(&p_slot->ctrl->crit_sect); | 939 | mutex_unlock(&p_slot->ctrl->crit_sect); |
940 | return -ENODEV; | 940 | return -ENODEV; |
941 | } | 941 | } |
942 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 942 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
943 | if (ret || !getstatus) { | 943 | if (ret || !getstatus) { |
944 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); | 944 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); |
945 | up(&p_slot->ctrl->crit_sect); | 945 | mutex_unlock(&p_slot->ctrl->crit_sect); |
946 | return -ENODEV; | 946 | return -ENODEV; |
947 | } | 947 | } |
948 | up(&p_slot->ctrl->crit_sect); | 948 | mutex_unlock(&p_slot->ctrl->crit_sect); |
949 | 949 | ||
950 | ret = remove_board(p_slot); | 950 | ret = remove_board(p_slot); |
951 | update_slot_info(p_slot); | 951 | update_slot_info(p_slot); |
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index b4226ff3a854..ae81427e42b1 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c | |||
@@ -1454,7 +1454,7 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev) | |||
1454 | } | 1454 | } |
1455 | dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg); | 1455 | dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg); |
1456 | 1456 | ||
1457 | init_MUTEX(&ctrl->crit_sect); | 1457 | mutex_init(&ctrl->crit_sect); |
1458 | /* Setup wait queue */ | 1458 | /* Setup wait queue */ |
1459 | init_waitqueue_head(&ctrl->queue); | 1459 | init_waitqueue_head(&ctrl->queue); |
1460 | 1460 | ||