iommu: Constify struct iommu_ops
[deliverable/linux.git] / drivers / iommu / iommu.c
index d061c8677a81453540ecbf2e2412e54849c6017d..169836020208d1a8a5755f16b60f68a66fec6d43 100644 (file)
@@ -36,6 +36,10 @@ static struct kset *iommu_group_kset;
 static struct ida iommu_group_ida;
 static struct mutex iommu_group_mutex;
 
+struct iommu_callback_data {
+       const struct iommu_ops *ops;
+};
+
 struct iommu_group {
        struct kobject kobj;
        struct kobject *devices_kobj;
@@ -698,7 +702,8 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
 
 static int add_iommu_group(struct device *dev, void *data)
 {
-       struct iommu_ops *ops = data;
+       struct iommu_callback_data *cb = data;
+       const struct iommu_ops *ops = cb->ops;
 
        if (!ops->add_device)
                return -ENODEV;
@@ -714,7 +719,7 @@ static int iommu_bus_notifier(struct notifier_block *nb,
                              unsigned long action, void *data)
 {
        struct device *dev = data;
-       struct iommu_ops *ops = dev->bus->iommu_ops;
+       const struct iommu_ops *ops = dev->bus->iommu_ops;
        struct iommu_group *group;
        unsigned long group_action = 0;
 
@@ -767,10 +772,14 @@ static struct notifier_block iommu_bus_nb = {
        .notifier_call = iommu_bus_notifier,
 };
 
-static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops)
+static void iommu_bus_init(struct bus_type *bus, const struct iommu_ops *ops)
 {
+       struct iommu_callback_data cb = {
+               .ops = ops,
+       };
+
        bus_register_notifier(bus, &iommu_bus_nb);
-       bus_for_each_dev(bus, NULL, ops, add_iommu_group);
+       bus_for_each_dev(bus, NULL, &cb, add_iommu_group);
 }
 
 /**
@@ -786,7 +795,7 @@ static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops)
  * is set up. With this function the iommu-driver can set the iommu-ops
  * afterwards.
  */
-int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops)
+int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops)
 {
        if (bus->iommu_ops != NULL)
                return -EBUSY;
This page took 0.035974 seconds and 5 git commands to generate.