Commit e0605c9c authored by Kamila Wojciechowska's avatar Kamila Wojciechowska
Browse files

Adjust to bus_type changes in 6.11+

Reference: https://lore.kernel.org/all/2024070136-wrongdoer-busily-01e8@gregkh/

Adds a new macro (DDCCI_DRV_CONST) to avoid LINUX_VERSION_CODE conditionals everywhere.
parent 0233e1ee
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1228,10 +1228,10 @@ static const struct ddcci_device_id *ddcci_match_id(const struct ddcci_device_id
	return NULL;
}

static int ddcci_device_match(struct device *dev, struct device_driver *drv)
static int ddcci_device_match(struct device *dev, DDCCI_DRV_CONST struct device_driver *drv)
{
	struct ddcci_device	*device = ddcci_verify_device(dev);
	struct ddcci_driver	*driver;
	DDCCI_DRV_CONST struct ddcci_driver	*driver;

	if (!device)
		return 0;
@@ -1247,7 +1247,7 @@ static int ddcci_device_match(struct device *dev, struct device_driver *drv)
static int ddcci_device_probe(struct device *dev)
{
	struct ddcci_device	*device = ddcci_verify_device(dev);
	struct ddcci_driver	*driver;
	DDCCI_DRV_CONST struct ddcci_driver	*driver;
	const struct ddcci_device_id *id;
	int ret = 0;

@@ -1268,7 +1268,7 @@ static int ddcci_device_probe(struct device *dev)
static int ddcci_device_remove(struct device *dev)
{
	struct ddcci_device	*device = ddcci_verify_device(dev);
	struct ddcci_driver	*driver;
	DDCCI_DRV_CONST struct ddcci_driver	*driver;
	int ret = 0;

	if (!device)
+6 −0
Original line number Diff line number Diff line
@@ -131,7 +131,13 @@ struct ddcci_driver {
	struct device_driver driver;
	struct ddcci_device_id *id_table;
};
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
#define to_ddcci_driver(d) container_of_const(d, struct ddcci_driver, driver)
#define DDCCI_DRV_CONST const
#else
#define to_ddcci_driver(d) container_of(d, struct ddcci_driver, driver)
#define DDCCI_DRV_CONST
#endif

int ddcci_register_driver(struct module *owner, struct ddcci_driver *driver);
#define ddcci_add_driver(driver) \