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

platform/x86: i2c-multi-instantiate: Use device_get_match_data() to get driver data

Use device_get_match_data() to get driver data instead of boilerplate code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20201105110530.27888-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Andy Shevchenko and committed by
Hans de Goede
469bc41c a9d1c250

+3 -4
+3 -4
drivers/platform/x86/i2c-multi-instantiate.c
··· 13 13 #include <linux/kernel.h> 14 14 #include <linux/module.h> 15 15 #include <linux/platform_device.h> 16 + #include <linux/property.h> 16 17 #include <linux/types.h> 17 18 18 19 #define IRQ_RESOURCE_TYPE GENMASK(1, 0) ··· 60 59 static int i2c_multi_inst_probe(struct platform_device *pdev) 61 60 { 62 61 struct i2c_multi_inst_data *multi; 63 - const struct acpi_device_id *match; 64 62 const struct i2c_inst_data *inst_data; 65 63 struct i2c_board_info board_info = {}; 66 64 struct device *dev = &pdev->dev; ··· 67 67 char name[32]; 68 68 int i, ret; 69 69 70 - match = acpi_match_device(dev->driver->acpi_match_table, dev); 71 - if (!match) { 70 + inst_data = device_get_match_data(dev); 71 + if (!inst_data) { 72 72 dev_err(dev, "Error ACPI match data is missing\n"); 73 73 return -ENODEV; 74 74 } 75 - inst_data = (const struct i2c_inst_data *)match->driver_data; 76 75 77 76 adev = ACPI_COMPANION(dev); 78 77