Skip to content

Commit a5f1bd1

Browse files
LuBaolujoergroedel
authored andcommitted
iommu: Remove iommu group changes notifier
The iommu group changes notifer is not referenced in the tree. Remove it to avoid dead code. Suggested-by: Christoph Hellwig <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 3b86f31 commit a5f1bd1

File tree

2 files changed

+0
-98
lines changed

2 files changed

+0
-98
lines changed

drivers/iommu/iommu.c

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <linux/errno.h>
1919
#include <linux/iommu.h>
2020
#include <linux/idr.h>
21-
#include <linux/notifier.h>
2221
#include <linux/err.h>
2322
#include <linux/pci.h>
2423
#include <linux/bitops.h>
@@ -40,7 +39,6 @@ struct iommu_group {
4039
struct kobject *devices_kobj;
4140
struct list_head devices;
4241
struct mutex mutex;
43-
struct blocking_notifier_head notifier;
4442
void *iommu_data;
4543
void (*iommu_data_release)(void *iommu_data);
4644
char *name;
@@ -632,7 +630,6 @@ struct iommu_group *iommu_group_alloc(void)
632630
mutex_init(&group->mutex);
633631
INIT_LIST_HEAD(&group->devices);
634632
INIT_LIST_HEAD(&group->entry);
635-
BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
636633

637634
ret = ida_simple_get(&iommu_group_ida, 0, 0, GFP_KERNEL);
638635
if (ret < 0) {
@@ -905,10 +902,6 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
905902
if (ret)
906903
goto err_put_group;
907904

908-
/* Notify any listeners about change to group. */
909-
blocking_notifier_call_chain(&group->notifier,
910-
IOMMU_GROUP_NOTIFY_ADD_DEVICE, dev);
911-
912905
trace_add_device_to_group(group->id, dev);
913906

914907
dev_info(dev, "Adding to iommu group %d\n", group->id);
@@ -950,10 +943,6 @@ void iommu_group_remove_device(struct device *dev)
950943

951944
dev_info(dev, "Removing from iommu group %d\n", group->id);
952945

953-
/* Pre-notify listeners that a device is being removed. */
954-
blocking_notifier_call_chain(&group->notifier,
955-
IOMMU_GROUP_NOTIFY_DEL_DEVICE, dev);
956-
957946
mutex_lock(&group->mutex);
958947
list_for_each_entry(tmp_device, &group->devices, list) {
959948
if (tmp_device->dev == dev) {
@@ -1075,36 +1064,6 @@ void iommu_group_put(struct iommu_group *group)
10751064
}
10761065
EXPORT_SYMBOL_GPL(iommu_group_put);
10771066

1078-
/**
1079-
* iommu_group_register_notifier - Register a notifier for group changes
1080-
* @group: the group to watch
1081-
* @nb: notifier block to signal
1082-
*
1083-
* This function allows iommu group users to track changes in a group.
1084-
* See include/linux/iommu.h for actions sent via this notifier. Caller
1085-
* should hold a reference to the group throughout notifier registration.
1086-
*/
1087-
int iommu_group_register_notifier(struct iommu_group *group,
1088-
struct notifier_block *nb)
1089-
{
1090-
return blocking_notifier_chain_register(&group->notifier, nb);
1091-
}
1092-
EXPORT_SYMBOL_GPL(iommu_group_register_notifier);
1093-
1094-
/**
1095-
* iommu_group_unregister_notifier - Unregister a notifier
1096-
* @group: the group to watch
1097-
* @nb: notifier block to signal
1098-
*
1099-
* Unregister a previously registered group notifier block.
1100-
*/
1101-
int iommu_group_unregister_notifier(struct iommu_group *group,
1102-
struct notifier_block *nb)
1103-
{
1104-
return blocking_notifier_chain_unregister(&group->notifier, nb);
1105-
}
1106-
EXPORT_SYMBOL_GPL(iommu_group_unregister_notifier);
1107-
11081067
/**
11091068
* iommu_register_device_fault_handler() - Register a device fault handler
11101069
* @dev: the device
@@ -1650,14 +1609,8 @@ static int remove_iommu_group(struct device *dev, void *data)
16501609
static int iommu_bus_notifier(struct notifier_block *nb,
16511610
unsigned long action, void *data)
16521611
{
1653-
unsigned long group_action = 0;
16541612
struct device *dev = data;
1655-
struct iommu_group *group;
16561613

1657-
/*
1658-
* ADD/DEL call into iommu driver ops if provided, which may
1659-
* result in ADD/DEL notifiers to group->notifier
1660-
*/
16611614
if (action == BUS_NOTIFY_ADD_DEVICE) {
16621615
int ret;
16631616

@@ -1668,34 +1621,6 @@ static int iommu_bus_notifier(struct notifier_block *nb,
16681621
return NOTIFY_OK;
16691622
}
16701623

1671-
/*
1672-
* Remaining BUS_NOTIFYs get filtered and republished to the
1673-
* group, if anyone is listening
1674-
*/
1675-
group = iommu_group_get(dev);
1676-
if (!group)
1677-
return 0;
1678-
1679-
switch (action) {
1680-
case BUS_NOTIFY_BIND_DRIVER:
1681-
group_action = IOMMU_GROUP_NOTIFY_BIND_DRIVER;
1682-
break;
1683-
case BUS_NOTIFY_BOUND_DRIVER:
1684-
group_action = IOMMU_GROUP_NOTIFY_BOUND_DRIVER;
1685-
break;
1686-
case BUS_NOTIFY_UNBIND_DRIVER:
1687-
group_action = IOMMU_GROUP_NOTIFY_UNBIND_DRIVER;
1688-
break;
1689-
case BUS_NOTIFY_UNBOUND_DRIVER:
1690-
group_action = IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER;
1691-
break;
1692-
}
1693-
1694-
if (group_action)
1695-
blocking_notifier_call_chain(&group->notifier,
1696-
group_action, dev);
1697-
1698-
iommu_group_put(group);
16991624
return 0;
17001625
}
17011626

include/linux/iommu.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,6 @@ static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)
407407
return dev->iommu->iommu_dev->ops;
408408
}
409409

410-
#define IOMMU_GROUP_NOTIFY_ADD_DEVICE 1 /* Device added */
411-
#define IOMMU_GROUP_NOTIFY_DEL_DEVICE 2 /* Pre Device removed */
412-
#define IOMMU_GROUP_NOTIFY_BIND_DRIVER 3 /* Pre Driver bind */
413-
#define IOMMU_GROUP_NOTIFY_BOUND_DRIVER 4 /* Post Driver bind */
414-
#define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */
415-
#define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */
416-
417410
extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
418411
extern int bus_iommu_probe(struct bus_type *bus);
419412
extern bool iommu_present(struct bus_type *bus);
@@ -478,10 +471,6 @@ extern int iommu_group_for_each_dev(struct iommu_group *group, void *data,
478471
extern struct iommu_group *iommu_group_get(struct device *dev);
479472
extern struct iommu_group *iommu_group_ref_get(struct iommu_group *group);
480473
extern void iommu_group_put(struct iommu_group *group);
481-
extern int iommu_group_register_notifier(struct iommu_group *group,
482-
struct notifier_block *nb);
483-
extern int iommu_group_unregister_notifier(struct iommu_group *group,
484-
struct notifier_block *nb);
485474
extern int iommu_register_device_fault_handler(struct device *dev,
486475
iommu_dev_fault_handler_t handler,
487476
void *data);
@@ -878,18 +867,6 @@ static inline void iommu_group_put(struct iommu_group *group)
878867
{
879868
}
880869

881-
static inline int iommu_group_register_notifier(struct iommu_group *group,
882-
struct notifier_block *nb)
883-
{
884-
return -ENODEV;
885-
}
886-
887-
static inline int iommu_group_unregister_notifier(struct iommu_group *group,
888-
struct notifier_block *nb)
889-
{
890-
return 0;
891-
}
892-
893870
static inline
894871
int iommu_register_device_fault_handler(struct device *dev,
895872
iommu_dev_fault_handler_t handler,

0 commit comments

Comments
 (0)