Skip to content

Commit

Permalink
platform/x86: i2c-multi-instantiate: Use device_get_match_data() to g…
Browse files Browse the repository at this point in the history
…et driver data

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

Signed-off-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
  • Loading branch information
andy-shev authored and jwrdegoede committed Nov 24, 2020
1 parent a9d1c25 commit 469bc41
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/platform/x86/i2c-multi-instantiate.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/types.h>

#define IRQ_RESOURCE_TYPE GENMASK(1, 0)
Expand Down Expand Up @@ -59,20 +60,18 @@ static int i2c_multi_inst_count_resources(struct acpi_device *adev)
static int i2c_multi_inst_probe(struct platform_device *pdev)
{
struct i2c_multi_inst_data *multi;
const struct acpi_device_id *match;
const struct i2c_inst_data *inst_data;
struct i2c_board_info board_info = {};
struct device *dev = &pdev->dev;
struct acpi_device *adev;
char name[32];
int i, ret;

match = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!match) {
inst_data = device_get_match_data(dev);
if (!inst_data) {
dev_err(dev, "Error ACPI match data is missing\n");
return -ENODEV;
}
inst_data = (const struct i2c_inst_data *)match->driver_data;

adev = ACPI_COMPANION(dev);

Expand Down

0 comments on commit 469bc41

Please sign in to comment.