ap_bus.c (dc14036fb3240a1bc2677cf8de33fbcb3af77826) | ap_bus.c (3f85d1df26a9d9b0d1a5237c580e085c41d6bf50) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright IBM Corp. 2006, 2021 4 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 5 * Martin Schwidefsky <schwidefsky@de.ibm.com> 6 * Ralph Wuerthner <rwuerthn@de.ibm.com> 7 * Felix Beck <felix.beck@de.ibm.com> 8 * Holger Dengler <hd@linux.vnet.ibm.com> --- 821 unchanged lines hidden (view full) --- 830 return 0; 831} 832 833static void ap_bus_revise_bindings(void) 834{ 835 bus_for_each_dev(&ap_bus_type, NULL, NULL, __ap_revise_reserved); 836} 837 | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright IBM Corp. 2006, 2021 4 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 5 * Martin Schwidefsky <schwidefsky@de.ibm.com> 6 * Ralph Wuerthner <rwuerthn@de.ibm.com> 7 * Felix Beck <felix.beck@de.ibm.com> 8 * Holger Dengler <hd@linux.vnet.ibm.com> --- 821 unchanged lines hidden (view full) --- 830 return 0; 831} 832 833static void ap_bus_revise_bindings(void) 834{ 835 bus_for_each_dev(&ap_bus_type, NULL, NULL, __ap_revise_reserved); 836} 837 |
838/** 839 * ap_owned_by_def_drv: indicates whether an AP adapter is reserved for the 840 * default host driver or not. 841 * @card: the APID of the adapter card to check 842 * @queue: the APQI of the queue to check 843 * 844 * Note: the ap_perms_mutex must be locked by the caller of this function. 845 * 846 * Return: an int specifying whether the AP adapter is reserved for the host (1) 847 * or not (0). 848 */ |
|
838int ap_owned_by_def_drv(int card, int queue) 839{ 840 int rc = 0; 841 842 if (card < 0 || card >= AP_DEVICES || queue < 0 || queue >= AP_DOMAINS) 843 return -EINVAL; 844 | 849int ap_owned_by_def_drv(int card, int queue) 850{ 851 int rc = 0; 852 853 if (card < 0 || card >= AP_DEVICES || queue < 0 || queue >= AP_DOMAINS) 854 return -EINVAL; 855 |
845 mutex_lock(&ap_perms_mutex); 846 | |
847 if (test_bit_inv(card, ap_perms.apm) && 848 test_bit_inv(queue, ap_perms.aqm)) 849 rc = 1; 850 | 856 if (test_bit_inv(card, ap_perms.apm) && 857 test_bit_inv(queue, ap_perms.aqm)) 858 rc = 1; 859 |
851 mutex_unlock(&ap_perms_mutex); 852 | |
853 return rc; 854} 855EXPORT_SYMBOL(ap_owned_by_def_drv); 856 | 860 return rc; 861} 862EXPORT_SYMBOL(ap_owned_by_def_drv); 863 |
864/** 865 * ap_apqn_in_matrix_owned_by_def_drv: indicates whether every APQN contained in 866 * a set is reserved for the host drivers 867 * or not. 868 * @apm: a bitmap specifying a set of APIDs comprising the APQNs to check 869 * @aqm: a bitmap specifying a set of APQIs comprising the APQNs to check 870 * 871 * Note: the ap_perms_mutex must be locked by the caller of this function. 872 * 873 * Return: an int specifying whether each APQN is reserved for the host (1) or 874 * not (0) 875 */ |
|
857int ap_apqn_in_matrix_owned_by_def_drv(unsigned long *apm, 858 unsigned long *aqm) 859{ 860 int card, queue, rc = 0; 861 | 876int ap_apqn_in_matrix_owned_by_def_drv(unsigned long *apm, 877 unsigned long *aqm) 878{ 879 int card, queue, rc = 0; 880 |
862 mutex_lock(&ap_perms_mutex); 863 | |
864 for (card = 0; !rc && card < AP_DEVICES; card++) 865 if (test_bit_inv(card, apm) && 866 test_bit_inv(card, ap_perms.apm)) 867 for (queue = 0; !rc && queue < AP_DOMAINS; queue++) 868 if (test_bit_inv(queue, aqm) && 869 test_bit_inv(queue, ap_perms.aqm)) 870 rc = 1; 871 | 881 for (card = 0; !rc && card < AP_DEVICES; card++) 882 if (test_bit_inv(card, apm) && 883 test_bit_inv(card, ap_perms.apm)) 884 for (queue = 0; !rc && queue < AP_DOMAINS; queue++) 885 if (test_bit_inv(queue, aqm) && 886 test_bit_inv(queue, ap_perms.aqm)) 887 rc = 1; 888 |
872 mutex_unlock(&ap_perms_mutex); 873 | |
874 return rc; 875} 876EXPORT_SYMBOL(ap_apqn_in_matrix_owned_by_def_drv); 877 878static int ap_device_probe(struct device *dev) 879{ 880 struct ap_device *ap_dev = to_ap_dev(dev); 881 struct ap_driver *ap_drv = to_ap_drv(dev->driver); --- 548 unchanged lines hidden (view full) --- 1430 * going away when we invoke the callback function. 1431 */ 1432 if (!try_module_get(drv->owner)) 1433 return 0; 1434 1435 if (ap_drv->in_use) { 1436 rc = ap_drv->in_use(ap_perms.apm, newaqm); 1437 if (rc) | 889 return rc; 890} 891EXPORT_SYMBOL(ap_apqn_in_matrix_owned_by_def_drv); 892 893static int ap_device_probe(struct device *dev) 894{ 895 struct ap_device *ap_dev = to_ap_dev(dev); 896 struct ap_driver *ap_drv = to_ap_drv(dev->driver); --- 548 unchanged lines hidden (view full) --- 1445 * going away when we invoke the callback function. 1446 */ 1447 if (!try_module_get(drv->owner)) 1448 return 0; 1449 1450 if (ap_drv->in_use) { 1451 rc = ap_drv->in_use(ap_perms.apm, newaqm); 1452 if (rc) |
1438 rc = -EBUSY; | 1453 return -EBUSY; |
1439 } 1440 1441 /* release the driver's module */ 1442 module_put(drv->owner); 1443 1444 return rc; 1445} 1446 --- 804 unchanged lines hidden --- | 1454 } 1455 1456 /* release the driver's module */ 1457 module_put(drv->owner); 1458 1459 return rc; 1460} 1461 --- 804 unchanged lines hidden --- |