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

iio:potentiometer:mcp4531: Drop of_match_ptr and CONFIG_OF protections.

These prevent use of this driver with ACPI via PRP0001 and are
an example of an anti pattern I'm trying to remove from IIO.
Hence drop them from this driver.

Also switch to device_get_match_data() from of_ variant and adjust
headers to reflect the change.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20200910173242.621168-9-jic23@kernel.org

+4 -7
+4 -7
drivers/iio/potentiometer/mcp4531.c
··· 28 28 #include <linux/module.h> 29 29 #include <linux/i2c.h> 30 30 #include <linux/err.h> 31 - #include <linux/of.h> 32 - #include <linux/of_device.h> 31 + #include <linux/mod_devicetable.h> 32 + #include <linux/property.h> 33 33 34 34 #include <linux/iio/iio.h> 35 35 ··· 275 275 }; 276 276 MODULE_DEVICE_TABLE(i2c, mcp4531_id); 277 277 278 - #ifdef CONFIG_OF 279 - 280 278 #define MCP4531_COMPATIBLE(of_compatible, cfg) { \ 281 279 .compatible = of_compatible, \ 282 280 .data = &mcp4531_cfg[cfg], \ ··· 348 350 { /* sentinel */ } 349 351 }; 350 352 MODULE_DEVICE_TABLE(of, mcp4531_of_match); 351 - #endif 352 353 353 354 static int mcp4531_probe(struct i2c_client *client) 354 355 { ··· 368 371 i2c_set_clientdata(client, indio_dev); 369 372 data->client = client; 370 373 371 - data->cfg = of_device_get_match_data(dev); 374 + data->cfg = device_get_match_data(dev); 372 375 if (!data->cfg) 373 376 data->cfg = &mcp4531_cfg[i2c_match_id(mcp4531_id, client)->driver_data]; 374 377 ··· 383 386 static struct i2c_driver mcp4531_driver = { 384 387 .driver = { 385 388 .name = "mcp4531", 386 - .of_match_table = of_match_ptr(mcp4531_of_match), 389 + .of_match_table = mcp4531_of_match, 387 390 }, 388 391 .probe_new = mcp4531_probe, 389 392 .id_table = mcp4531_id,