summaryrefslogtreecommitdiffstats
path: root/drivers/base/base.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-14 11:41:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-20 12:51:42 +0200
commit269e974e664207cc45f83b579565ba73de1b75dc (patch)
treef93c01cfea166488d18b6b52708026118fd52f7f /drivers/base/base.h
parentdriver core: Make dev_err_probe() silent for -ENOMEM (diff)
downloadlinux-269e974e664207cc45f83b579565ba73de1b75dc.tar.xz
linux-269e974e664207cc45f83b579565ba73de1b75dc.zip
driver core: make [device_]driver_attach take a const *
Change device_driver_attach() and driver_attach() to take a const * to struct device driver as neither of them modify the structure at all. Also, for some odd reason, drivers/dma/idxd/compat.c had a duplicate external reference to device_driver_attach(), so remove that to fix up the build, it should never have had that there in the first place. Cc: Rafael J. Wysocki <rafael@kernel.org> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Vinod Koul <vkoul@kernel.org> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Petr Tesarik <petr.tesarik.ext@huawei.com> Cc: Alexander Lobakin <aleksander.lobakin@intel.com> Cc: dmaengine@vger.kernel.org Link: https://lore.kernel.org/r/2024061401-rasping-manger-c385@gregkh Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/base.h')
-rw-r--r--drivers/base/base.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 50151e7db796..8bef47afa3a9 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -161,10 +161,11 @@ void device_release_driver_internal(struct device *dev, const struct device_driv
void driver_detach(const struct device_driver *drv);
void driver_deferred_probe_del(struct device *dev);
void device_set_deferred_probe_reason(const struct device *dev, struct va_format *vaf);
-static inline int driver_match_device(struct device_driver *drv,
+static inline int driver_match_device(const struct device_driver *drv,
struct device *dev)
{
- return drv->bus->match ? drv->bus->match(dev, drv) : 1;
+ /* cast will be removed in the future when match can handle a const pointer properly. */
+ return drv->bus->match ? drv->bus->match(dev, (struct device_driver *)drv) : 1;
}
static inline void dev_sync_state(struct device *dev)