i2c: sh_mobile: Use of_device_get_match_data() helper

Use the of_device_get_match_data() helper instead of open coding.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
Geert Uytterhoeven 2017-10-04 14:17:05 +02:00 committed by Wolfram Sang
parent 5515ae1121
commit ad59c5ea7f

View File

@ -881,7 +881,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
struct sh_mobile_i2c_data *pd; struct sh_mobile_i2c_data *pd;
struct i2c_adapter *adap; struct i2c_adapter *adap;
struct resource *res; struct resource *res;
const struct of_device_id *match; const struct sh_mobile_dt_config *config;
int ret; int ret;
u32 bus_speed; u32 bus_speed;
@ -913,10 +913,8 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
pd->bus_speed = ret ? STANDARD_MODE : bus_speed; pd->bus_speed = ret ? STANDARD_MODE : bus_speed;
pd->clks_per_count = 1; pd->clks_per_count = 1;
match = of_match_device(sh_mobile_i2c_dt_ids, &dev->dev); config = of_device_get_match_data(&dev->dev);
if (match) { if (config) {
const struct sh_mobile_dt_config *config = match->data;
pd->clks_per_count = config->clks_per_count; pd->clks_per_count = config->clks_per_count;
if (config->setup) if (config->setup)