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

Configure Feed

Select the types of activity you want to include in your feed.

driver core: mark async_driver as a const *

Within struct device_private, mark the async_driver * as const as it is
never modified. This requires some internal-to-the-driver-core
functions to also have their parameters marked as constant, and there is
one place where we cast _back_ from the const pointer to a real one, as
the driver core still wants to modify the structure in a number of
remaining places.

Cc: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20240611130103.3262749-12-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+9 -8
+1 -1
drivers/base/base.h
··· 112 112 struct klist_node knode_bus; 113 113 struct klist_node knode_class; 114 114 struct list_head deferred_probe; 115 - struct device_driver *async_driver; 115 + const struct device_driver *async_driver; 116 116 char *deferred_probe_reason; 117 117 struct device *device; 118 118 u8 dead:1;
+8 -7
drivers/base/dd.c
··· 568 568 dev->driver->remove(dev); 569 569 } 570 570 571 - static int call_driver_probe(struct device *dev, struct device_driver *drv) 571 + static int call_driver_probe(struct device *dev, const struct device_driver *drv) 572 572 { 573 573 int ret = 0; 574 574 ··· 599 599 return ret; 600 600 } 601 601 602 - static int really_probe(struct device *dev, struct device_driver *drv) 602 + static int really_probe(struct device *dev, const struct device_driver *drv) 603 603 { 604 604 bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) && 605 605 !drv->suppress_bind_attrs; ··· 628 628 } 629 629 630 630 re_probe: 631 - dev->driver = drv; 631 + // FIXME - this cast should not be needed "soon" 632 + dev->driver = (struct device_driver *)drv; 632 633 633 634 /* If using pinctrl, bind pins now before probing */ 634 635 ret = pinctrl_bind_pins(dev); ··· 728 727 /* 729 728 * For initcall_debug, show the driver probe time. 730 729 */ 731 - static int really_probe_debug(struct device *dev, struct device_driver *drv) 730 + static int really_probe_debug(struct device *dev, const struct device_driver *drv) 732 731 { 733 732 ktime_t calltime, rettime; 734 733 int ret; ··· 775 774 } 776 775 EXPORT_SYMBOL_GPL(wait_for_device_probe); 777 776 778 - static int __driver_probe_device(struct device_driver *drv, struct device *dev) 777 + static int __driver_probe_device(const struct device_driver *drv, struct device *dev) 779 778 { 780 779 int ret = 0; 781 780 ··· 820 819 * 821 820 * If the device has a parent, runtime-resume the parent before driver probing. 822 821 */ 823 - static int driver_probe_device(struct device_driver *drv, struct device *dev) 822 + static int driver_probe_device(const struct device_driver *drv, struct device *dev) 824 823 { 825 824 int trigger_count = atomic_read(&deferred_trigger_count); 826 825 int ret; ··· 1138 1137 static void __driver_attach_async_helper(void *_dev, async_cookie_t cookie) 1139 1138 { 1140 1139 struct device *dev = _dev; 1141 - struct device_driver *drv; 1140 + const struct device_driver *drv; 1142 1141 int ret; 1143 1142 1144 1143 __device_driver_lock(dev, dev->parent);