Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu: make the pointer to struct bus_type constant

A number of iommu functions take a struct bus_type * and never modify
the data passed in, so make them all const * as that is what the driver
core is expecting to have passed into as well.

This is a step toward making all struct bus_type pointers constant in
the kernel.

Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux.dev
Acked-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20230313182918.1312597-34-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+12 -12
+7 -7
drivers/iommu/iommu.c
··· 89 89 unsigned long action, void *data); 90 90 static int iommu_alloc_default_domain(struct iommu_group *group, 91 91 struct device *dev); 92 - static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, 92 + static struct iommu_domain *__iommu_domain_alloc(const struct bus_type *bus, 93 93 unsigned type); 94 94 static int __iommu_attach_device(struct iommu_domain *domain, 95 95 struct device *dev); ··· 1631 1631 return 0; 1632 1632 } 1633 1633 1634 - static int iommu_group_alloc_default_domain(struct bus_type *bus, 1634 + static int iommu_group_alloc_default_domain(const struct bus_type *bus, 1635 1635 struct iommu_group *group, 1636 1636 unsigned int type) 1637 1637 { ··· 1777 1777 return 0; 1778 1778 } 1779 1779 1780 - static void probe_alloc_default_domain(struct bus_type *bus, 1780 + static void probe_alloc_default_domain(const struct bus_type *bus, 1781 1781 struct iommu_group *group) 1782 1782 { 1783 1783 struct __group_domain_type gtype; ··· 1832 1832 iommu_do_create_direct_mappings); 1833 1833 } 1834 1834 1835 - int bus_iommu_probe(struct bus_type *bus) 1835 + int bus_iommu_probe(const struct bus_type *bus) 1836 1836 { 1837 1837 struct iommu_group *group, *next; 1838 1838 LIST_HEAD(group_list); ··· 1876 1876 return ret; 1877 1877 } 1878 1878 1879 - bool iommu_present(struct bus_type *bus) 1879 + bool iommu_present(const struct bus_type *bus) 1880 1880 { 1881 1881 return bus->iommu_ops != NULL; 1882 1882 } ··· 1951 1951 } 1952 1952 EXPORT_SYMBOL_GPL(iommu_set_fault_handler); 1953 1953 1954 - static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, 1954 + static struct iommu_domain *__iommu_domain_alloc(const struct bus_type *bus, 1955 1955 unsigned type) 1956 1956 { 1957 1957 struct iommu_domain *domain; ··· 1976 1976 return domain; 1977 1977 } 1978 1978 1979 - struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) 1979 + struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus) 1980 1980 { 1981 1981 return __iommu_domain_alloc(bus, IOMMU_DOMAIN_UNMANAGED); 1982 1982 }
+5 -5
include/linux/iommu.h
··· 455 455 return dev->iommu->iommu_dev->ops; 456 456 } 457 457 458 - extern int bus_iommu_probe(struct bus_type *bus); 459 - extern bool iommu_present(struct bus_type *bus); 458 + extern int bus_iommu_probe(const struct bus_type *bus); 459 + extern bool iommu_present(const struct bus_type *bus); 460 460 extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap); 461 461 extern bool iommu_group_has_isolated_msi(struct iommu_group *group); 462 - extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 462 + extern struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus); 463 463 extern struct iommu_group *iommu_group_get_by_id(int id); 464 464 extern void iommu_domain_free(struct iommu_domain *domain); 465 465 extern int iommu_attach_device(struct iommu_domain *domain, ··· 732 732 struct iommu_fault_param {}; 733 733 struct iommu_iotlb_gather {}; 734 734 735 - static inline bool iommu_present(struct bus_type *bus) 735 + static inline bool iommu_present(const struct bus_type *bus) 736 736 { 737 737 return false; 738 738 } ··· 742 742 return false; 743 743 } 744 744 745 - static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) 745 + static inline struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus) 746 746 { 747 747 return NULL; 748 748 }